diff options
| author | ivarlovlie <git@ivarlovlie.no> | 2022-06-07 01:33:52 +0200 |
|---|---|---|
| committer | ivarlovlie <git@ivarlovlie.no> | 2022-06-07 01:34:48 +0200 |
| commit | a8b44b09a404aee477e735501b828d1b14aad311 (patch) | |
| tree | 41b8e21f7484a3f93867a137826da255081fb0ab /apps/projects/src/app/lib/i18n/i18n-util.sync.ts | |
| parent | 591f1c5fd81bd2b92e91a90847ea06438211078d (diff) | |
| download | greatoffice-a8b44b09a404aee477e735501b828d1b14aad311.tar.xz greatoffice-a8b44b09a404aee477e735501b828d1b14aad311.zip | |
feat: Add inital translation support
Diffstat (limited to 'apps/projects/src/app/lib/i18n/i18n-util.sync.ts')
| -rw-r--r-- | apps/projects/src/app/lib/i18n/i18n-util.sync.ts | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/apps/projects/src/app/lib/i18n/i18n-util.sync.ts b/apps/projects/src/app/lib/i18n/i18n-util.sync.ts new file mode 100644 index 0000000..7a1d51e --- /dev/null +++ b/apps/projects/src/app/lib/i18n/i18n-util.sync.ts @@ -0,0 +1,27 @@ +// This file was auto-generated by 'typesafe-i18n'. Any manual changes will be overwritten. +/* eslint-disable */ + +import { initFormatters } from './formatters' +import type { Locales, Translations } from './i18n-types' +import { loadedFormatters, loadedLocales, locales } from './i18n-util' + +import en from './en' +import nb from './nb' + +const localeTranslations = { + en, + nb, +} + +export const loadLocale = (locale: Locales): void => { + if (loadedLocales[locale]) return + + loadedLocales[locale] = localeTranslations[locale] as unknown as Translations + loadFormatters(locale) +} + +export const loadAllLocales = (): void => locales.forEach(loadLocale) + +export const loadFormatters = (locale: Locales): void => { + loadedFormatters[locale] = initFormatters(locale) +} |
