]> git.ipfire.org Git - thirdparty/vuejs/create-vue.git/commitdiff
feat: print warning messages for unsupported locale
authorbtea <2356281422@qq.com>
Sat, 28 Oct 2023 03:47:09 +0000 (11:47 +0800)
committerCédric Exbrayat <cexbrayat@users.noreply.github.com>
Mon, 30 Oct 2023 07:00:55 +0000 (08:00 +0100)
utils/getLanguage.ts

index 489e79f31ec1bacb041ffd940aaf20ef0b9ca5fc..325cb5744836f82d79995c86dc1ded07c3e41ac4 100644 (file)
@@ -66,6 +66,12 @@ export default function getLanguage() {
   const languageFilePath = path.resolve(localesRoot, `${locale}.json`)
   const doesLanguageExist = fs.existsSync(languageFilePath)
 
+  if (!doesLanguageExist) {
+    console.warn(
+      `\x1B[33mThe locale langage "${locale}" is not supported, fallback to "en-US".\n\x1B[39m`
+    )
+  }
+
   const lang: Language = doesLanguageExist
     ? require(languageFilePath)
     : require(path.resolve(localesRoot, 'en-US.json'))