Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
{
"version": 3,
"sources": ["../../../src/locale/nextFallbackLocale.ts"],
"sourcesContent": ["import { DEFAULT_LOCALE } from \"../generated/AssetParameters.js\";\n\n/**\n * Calculates the next fallback locale for the given locale.\n *\n * @param {string} locale Locale string in Java format (underscores) or null\n * @returns {string} Next fallback Locale or \"en\" if no fallbacks found.\n */\nconst nextFallbackLocale = (locale: string) => {\n\tif (!locale) {\n\t\treturn DEFAULT_LOCALE;\n\t}\n\n\tif (locale === \"zh_HK\") {\n\t\treturn \"zh_TW\";\n\t}\n\n\t// if there are multiple segments (separated by underscores), remove the last one\n\tconst p = locale.lastIndexOf(\"_\");\n\tif (p >= 0) {\n\t\treturn locale.slice(0, p);\n\t}\n\n\t// for any language but the default, fallback to the default first before falling back to the 'raw' language (empty string)\n\treturn locale !== DEFAULT_LOCALE ? DEFAULT_LOCALE : \"\";\n};\n\nexport default nextFallbackLocale;\n"],
"mappings": "aAAA,OAAS,kBAAAA,MAAsB,kCAQ/B,MAAMC,EAAsBC,GAAmB,CAC9C,GAAI,CAACA,EACJ,OAAOF,EAGR,GAAIE,IAAW,QACd,MAAO,QAIR,MAAMC,EAAID,EAAO,YAAY,GAAG,EAChC,OAAIC,GAAK,EACDD,EAAO,MAAM,EAAGC,CAAC,EAIlBD,IAAWF,EAAiBA,EAAiB,EACrD,EAEA,eAAeC",
"names": ["DEFAULT_LOCALE", "nextFallbackLocale", "locale", "p"]
}