瀏覽代碼

Help translators by showing what the English is

Kevin van Zonneveld 6 年之前
父節點
當前提交
ec8c725aaa
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      bin/locale-packs.js

+ 5 - 2
bin/locale-packs.js

@@ -189,15 +189,18 @@ function test () {
   const leadingLocaleName = 'en_US'
 
   const followerLocales = {}
+  const followerValues = {}
   const localePackagePath = path.join(__dirname, '..', 'packages', '@uppy', 'locales', 'src', '*.js')
   glob.sync(localePackagePath).forEach((localePath) => {
     const localeName = path.basename(localePath, '.js')
     // Builds array with items like: 'uploadingXFiles.2'
-    followerLocales[localeName] = Object.keys(flat(require(localePath).strings))
+    followerValues[localeName] = flat(require(localePath).strings)
+    followerLocales[localeName] = Object.keys(followerValues[localeName])
   })
 
   // Take aside our leading locale: en_US
   const leadingLocale = followerLocales[leadingLocaleName]
+  const leadingValues = followerValues[leadingLocaleName]
   delete followerLocales[leadingLocaleName]
 
   // Compare all follower Locales (RU, DE, etc) with our leader en_US
@@ -211,7 +214,7 @@ function test () {
     missing.forEach((key) => {
       // Items missing are a non-fatal warning because we don't want CI to bum out over all languages
       // as soon as we add some English
-      warnings.push(`${chalk.cyan(followerName)} locale has missing string: '${chalk.red(key)}' that is present in ${chalk.cyan(leadingLocaleName)}. `)
+      warnings.push(`${chalk.cyan(followerName)} locale has missing string: '${chalk.red(key)}' that is present in ${chalk.cyan(leadingLocaleName)} with value: ${chalk.yellow(leadingValues[key])}`)
     })
     excess.forEach((key) => {
       // Items in excess are a fatal because we should clean up follower languages once we remove English strings