Explorar o código

fix: only set en-US as fallback in UserUtils if localeFallback is true

Sv443 hai 11 horas
pai
achega
769ed800fb
Modificáronse 1 ficheiros con 3 adicións e 3 borrados
  1. 3 3
      src/utils/translations.ts

+ 3 - 3
src/utils/translations.ts

@@ -20,8 +20,6 @@ let activeLocale: TrLocale = "en-US";
 tr.addTransform(tr.transforms.percent);
 tr.addTransform(tr.transforms.templateLiteral);
 
-tr.setFallbackLanguage("en-US" satisfies TrLocale);
-
 /** Initializes the translations */
 export async function initTranslations(locale: TrLocale) {
   if(initializedLocales.has(locale))
@@ -34,8 +32,10 @@ export async function initTranslations(locale: TrLocale) {
 
     let fallbackTrans: Partial<typeof tr_enUS> = {};
 
-    if(getFeature("localeFallback"))
+    if(getFeature("localeFallback")) {
+      tr.setFallbackLanguage("en-US" satisfies TrLocale);
       fallbackTrans = await fetchLocaleJson("en-US");
+    }
 
     // merge with base translations if specified
     const baseTransFile = typeof transFile?.meta === "object" && "base" in transFile.meta && typeof transFile.meta.base === "string"