tootlab-mastodon/app/javascript/mastodon/load_locale.js

15 lines
401 B
JavaScript
Raw Normal View History

2023-05-31 17:43:39 -04:00
import { setLocale } from "./locales";
export async function loadLocale() {
const locale = document.querySelector('html').lang || 'en';
const localeData = await import(
/* webpackMode: "lazy" */
/* webpackChunkName: "locale/[request]" */
/* webpackInclude: /\.json$/ */
/* webpackPreload: true */
`mastodon/locales/${locale}.json`);
setLocale({ messages: localeData });
}