How to use the svelte-i18n.addMessages function in svelte-i18n

To help you get started, we’ve selected a few svelte-i18n examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github appist / appy / internal / templates / scaffold / web / src / initI18n.ts View on Github external
export default async () => {
  let locale = getLocaleFromNavigator();
  if (process.env.AVAILABLE_LOCALES && process.env.AVAILABLE_LOCALES.indexOf(locale) < 0) {
    locale = locale.split("-")[0];
  }

  const messages = await import(`@/locales/${locale}.json`);
  addMessages(locale, messages.default);

  init({
    fallbackLocale: "en",
    initialLocale: locale,
  });
};

svelte-i18n

Internationalization library for Svelte

MIT
Latest version published 18 days ago

Package Health Score

80 / 100
Full package analysis