Sv443 1 месяц назад
Родитель
Сommit
84721975e5
2 измененных файлов с 5 добавлено и 4 удалено
  1. 1 0
      contributing.md
  2. 4 4
      src/tools/tr-format.ts

+ 1 - 0
contributing.md

@@ -160,6 +160,7 @@ To edit an existing translation, please follow these steps:
   - `--prep` or `-p` - Prepares the files for translation via GitHub Copilot by providing the missing key once in English and once without any value
   - `--only="<value>"` or `-o="<value>"` - Only applies formatting to the files of the specified locales. Has to be a quoted, case-sensitive, comma separated list! (e.g. `-o="fr-FR,de-DE"` or `-o="pt-BR"`)
   - `--include-based` or `-b` - Also includes files which have a base locale specified
+  - `--keys="<keys>"` or `-k="<keys>"` - Ignores all keys except the ones specified (comma-separated)
 - **`pnpm tr-prep`**  
   Shorthand for `pnpm tr-format --prep` (see above).
 - **`pnpm --silent invisible "<command>"`**  

+ 4 - 4
src/tools/tr-format.ts

@@ -34,7 +34,7 @@ async function run() {
     let localeFile = enUS;
     const localeObj = JSON.parse(await readFile(`./assets/translations/${locale}.json`, "utf-8"));
 
-    if(!includeBased && localeObj.base)
+    if(!includeBased && localeObj.meta.base)
       continue;
 
     for(const k of Object.keys(enUS_obj)) {
@@ -82,9 +82,9 @@ async function run() {
     }
 
     // reinsert base if present in locale file
-
-    if(localeObj.base)
-      localeFile = localeFile.replace(/\s*\{\s*/, `{\n  "base": "${localeObj.base}",\n  `);
+    // TODO:FIXME:
+    // if(localeObj.meta.base)
+    //   localeFile = localeFile.replace(/\s*\{\s*/, `{\n  "base": "${localeObj.meta.base}",\n  `);
 
     // add EOL newline if not present
     if(!localeFile.endsWith("\n"))