From b7e39b59fd0fc7b5610ebff29035bf622079e0d8 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Wed, 5 Oct 2022 20:45:21 +0800 Subject: refactor: Change file structure --- .../web-shared/src/lib/i18n/i18n-util.async.ts | 27 ---------------------- 1 file changed, 27 deletions(-) delete mode 100644 old-apps/web-shared/src/lib/i18n/i18n-util.async.ts (limited to 'old-apps/web-shared/src/lib/i18n/i18n-util.async.ts') diff --git a/old-apps/web-shared/src/lib/i18n/i18n-util.async.ts b/old-apps/web-shared/src/lib/i18n/i18n-util.async.ts deleted file mode 100644 index 90e55a7..0000000 --- a/old-apps/web-shared/src/lib/i18n/i18n-util.async.ts +++ /dev/null @@ -1,27 +0,0 @@ -// 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.js' -import { loadedFormatters, loadedLocales, locales } from './i18n-util' - -const localeTranslationLoaders = { - en: () => import('./en/index.js'), - nb: () => import('./nb/index.js'), -} - -const updateDictionary = (locale: Locales, dictionary: Partial) => - loadedLocales[locale] = { ...loadedLocales[locale], ...dictionary } - -export const loadLocaleAsync = async (locale: Locales): Promise => { - updateDictionary( - locale, - (await localeTranslationLoaders[locale]()).default as unknown as Translations - ) - loadFormatters(locale) -} - -export const loadAllLocalesAsync = (): Promise => Promise.all(locales.map(loadLocaleAsync)) - -export const loadFormatters = (locale: Locales): void => - void (loadedFormatters[locale] = initFormatters(locale)) -- cgit v1.3