Skip to content

Commit 83088cb

Browse files
bteacexbrayat
authored andcommitted
feat: print warning messages for unsupported locale
1 parent 1b5cec7 commit 83088cb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

utils/getLanguage.ts

+6
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ export default function getLanguage() {
6666
const languageFilePath = path.resolve(localesRoot, `${locale}.json`)
6767
const doesLanguageExist = fs.existsSync(languageFilePath)
6868

69+
if (!doesLanguageExist) {
70+
console.warn(
71+
`\x1B[33mThe locale langage "${locale}" is not supported, fallback to "en-US".\n\x1B[39m`
72+
)
73+
}
74+
6975
const lang: Language = doesLanguageExist
7076
? require(languageFilePath)
7177
: require(path.resolve(localesRoot, 'en-US.json'))

0 commit comments

Comments
 (0)