How to use the svelte-i18n.getLocaleFromNavigator 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 caos / zitadel / site / src / i18n.js View on Github external
export function startClient() {
    console.log('nav', getLocaleFromNavigator());
    init({
        ...INIT_OPTIONS,
        initialLocale: getCookie('locale') || INIT_OPTIONS.localeOptions.find(option => option == cropCountryCode(getLocaleFromNavigator())) || INIT_OPTIONS.initialLocale,
    });
}
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,
  });
};
github caos / zitadel / site / src / i18n.js View on Github external
        initialLocale: getCookie('locale') || INIT_OPTIONS.localeOptions.find(option => option == cropCountryCode(getLocaleFromNavigator())) || INIT_OPTIONS.initialLocale,
    });

svelte-i18n

Internationalization library for Svelte

MIT
Latest version published 1 month ago

Package Health Score

80 / 100
Full package analysis