@drone1/alt 1.0.4 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -44
- package/{localization/config.json → alt.config.json} +3 -1
- package/localization/.localization.cache.json +554 -140
- package/localization/aa.json +4 -1
- package/localization/af.json +4 -1
- package/localization/agq.json +4 -1
- package/localization/ak.json +4 -1
- package/localization/am.json +4 -1
- package/localization/ar.json +4 -1
- package/localization/as.json +4 -1
- package/localization/asa.json +4 -1
- package/localization/ast.json +4 -1
- package/localization/az.json +4 -1
- package/localization/ba.json +4 -1
- package/localization/bas.json +4 -1
- package/localization/be.json +4 -1
- package/localization/bem.json +4 -1
- package/localization/bez.json +4 -1
- package/localization/bg.json +4 -1
- package/localization/bm.json +4 -1
- package/localization/bn.json +4 -1
- package/localization/bo.json +4 -1
- package/localization/br.json +4 -1
- package/localization/brx.json +4 -1
- package/localization/bs.json +4 -1
- package/localization/byn.json +4 -1
- package/localization/ca.json +4 -1
- package/localization/ccp.json +4 -1
- package/localization/cd-RU.json +4 -1
- package/localization/ceb.json +4 -1
- package/localization/cgg.json +4 -1
- package/localization/chr.json +4 -1
- package/localization/co.json +4 -1
- package/localization/cs.json +4 -1
- package/localization/cu-RU.json +4 -1
- package/localization/da.json +4 -1
- package/localization/de-AT.json +4 -1
- package/localization/de-CH.json +4 -1
- package/localization/de-DE.json +4 -1
- package/localization/dua.json +4 -1
- package/localization/dv.json +4 -1
- package/localization/dz.json +4 -1
- package/localization/ebu.json +4 -1
- package/localization/en.json +4 -1
- package/localization/es-ES.json +4 -1
- package/localization/es-MX.json +4 -1
- package/localization/et.json +4 -1
- package/localization/eu.json +4 -1
- package/localization/fr-CA.json +4 -1
- package/localization/fr-CH.json +4 -1
- package/localization/fr-FR.json +4 -1
- package/localization/gsw.json +4 -1
- package/localization/hi.json +4 -1
- package/localization/hr.json +4 -1
- package/localization/hy.json +4 -1
- package/localization/ja.json +4 -1
- package/localization/km.json +4 -1
- package/localization/ksf.json +4 -1
- package/localization/ku.json +4 -1
- package/localization/kw.json +4 -1
- package/localization/my.json +4 -1
- package/localization/nl.json +4 -1
- package/localization/prs.json +4 -1
- package/localization/reference.js +3 -0
- package/localization/ru.json +4 -1
- package/localization/sq.json +4 -1
- package/localization/swc.json +4 -1
- package/localization/th.json +4 -1
- package/localization/tzm-Latn-.json +4 -1
- package/localization/uk.json +4 -1
- package/localization/vi.json +4 -1
- package/localization/zh-Hans.json +4 -1
- package/localization/zh-Hant.json +4 -1
- package/package.json +2 -2
- package/src/commands/translate.js +78 -17
- package/src/lib/config.js +30 -14
- package/src/lib/consts.js +3 -6
- package/src/lib/io.js +5 -0
- package/src/lib/reference-loader.js +1 -1
- package/src/lib/utils.js +1 -1
- package/src/main.mjs +9 -9
- package/test/main-cli.test.js +0 -18
- package/test/translate-command.test.js +6 -2
package/localization/fr-CH.json
CHANGED
|
@@ -35,5 +35,8 @@
|
|
|
35
35
|
"error-no-reference-data-in-variable": "Aucune donnée de référence trouvée dans la variable \"%%referenceExportedVarName%%\" dans \"%%referenceFile%%\"",
|
|
36
36
|
"error-no-provider-specified": "Aucun fournisseur spécifié.",
|
|
37
37
|
"error-copying-file-to-temp-dir": "Erreur lors de la copie du fichier dans le répertoire temporaire : %%error%%",
|
|
38
|
-
"supported-providers": "Les fournisseurs pris en charge sont : %%providers%%"
|
|
38
|
+
"supported-providers": "Les fournisseurs pris en charge sont : %%providers%%",
|
|
39
|
+
"error-no-output-dir-specified": "Aucun répertoire de sortie spécifié via '--output-dir', dans un fichier de configuration (via 'outputDir'), ou dans le même répertoire que votre fichier de référence (\"%%refFileDir%%\")",
|
|
40
|
+
"error-dir-create-failed": "Échec de création du répertoire \"%%dir%%\"",
|
|
41
|
+
"error-no-reference-file-specified": "Aucun fichier de référence spécifié via '--reference-file' ou dans le fichier de configuration (via 'referenceFile')"
|
|
39
42
|
}
|
package/localization/fr-FR.json
CHANGED
|
@@ -35,5 +35,8 @@
|
|
|
35
35
|
"error-no-reference-data-in-variable": "Aucune donnée de référence trouvée dans la variable \"%%referenceExportedVarName%%\" dans \"%%referenceFile%%\"",
|
|
36
36
|
"error-no-provider-specified": "Aucun fournisseur spécifié.",
|
|
37
37
|
"error-copying-file-to-temp-dir": "Erreur lors de la copie du fichier vers le répertoire temporaire : %%error%%",
|
|
38
|
-
"supported-providers": "Les fournisseurs pris en charge sont : %%providers%%"
|
|
38
|
+
"supported-providers": "Les fournisseurs pris en charge sont : %%providers%%",
|
|
39
|
+
"error-no-output-dir-specified": "Aucun répertoire de sortie spécifié via '--output-dir', dans un fichier de configuration (via 'outputDir'), ou dans le même répertoire que votre fichier de référence (\"%%refFileDir%%\")",
|
|
40
|
+
"error-dir-create-failed": "Échec lors de la création du répertoire \"%%dir%%\"",
|
|
41
|
+
"error-no-reference-file-specified": "Aucun fichier de référence spécifié via '--reference-file' ou dans le fichier de configuration (via 'referenceFile')"
|
|
39
42
|
}
|
package/localization/gsw.json
CHANGED
|
@@ -35,5 +35,8 @@
|
|
|
35
35
|
"error-no-reference-data-in-variable": "Kei Referenzdate gfunde in Variable \"%%referenceExportedVarName%%\" in \"%%referenceFile%%\"",
|
|
36
36
|
"error-no-provider-specified": "Kei Aabieter aagee.",
|
|
37
37
|
"error-copying-file-to-temp-dir": "Fähler biim Kopiere vo de Datei i ds temporäre Verzeichnis: %%error%%",
|
|
38
|
-
"supported-providers": "Unterstützti Aabieter sind: %%providers%%"
|
|
38
|
+
"supported-providers": "Unterstützti Aabieter sind: %%providers%%",
|
|
39
|
+
"error-no-output-dir-specified": "Kei Ausgab-Verzeichnis bstimmt übr '--output-dir', inere Config-Datei (übr 'outputDir'), oder im gliiche Verzeichnis wie dini Referänz-Datei (\"%%refFileDir%%\")",
|
|
40
|
+
"error-dir-create-failed": "Han nöd chönne s Verzeichnis \"%%dir%%\" erstelle",
|
|
41
|
+
"error-no-reference-file-specified": "Kei Referänzdatei aagee via '--reference-file' oder i de Konfigurationsdatei (via 'referenceFile')"
|
|
39
42
|
}
|
package/localization/hi.json
CHANGED
|
@@ -35,5 +35,8 @@
|
|
|
35
35
|
"error-no-reference-data-in-variable": "चर \"%%referenceExportedVarName%%\" में \"%%referenceFile%%\" से कोई संदर्भ डेटा नहीं मिला।",
|
|
36
36
|
"error-no-provider-specified": "कोई प्रदाता निर्दिष्ट नहीं है।",
|
|
37
37
|
"error-copying-file-to-temp-dir": "फ़ाइल को टेम्प डायरेक्टरी में कॉपी करने में त्रुटि: %%error%%",
|
|
38
|
-
"supported-providers": "समर्थित प्रदाता हैं: %%providers%%"
|
|
38
|
+
"supported-providers": "समर्थित प्रदाता हैं: %%providers%%",
|
|
39
|
+
"error-no-output-dir-specified": "कोई आउटपुट डायरेक्टरी नहीं दी गई है '--output-dir' के माध्यम से, एक कॉन्फिग फ़ाइल में (via 'outputDir'), या आपकी संदर्भ फ़ाइल (\"%%refFileDir%%\") के समान डायरेक्टरी में",
|
|
40
|
+
"error-dir-create-failed": "\"%%dir%%\" निर्देशिका बनाने में विफल",
|
|
41
|
+
"error-no-reference-file-specified": "संदर्भ फ़ाइल '--reference-file' के माध्यम से या कॉन्फ़िग फ़ाइल में (via 'referenceFile') निर्दिष्ट नहीं की गई है"
|
|
39
42
|
}
|
package/localization/hr.json
CHANGED
|
@@ -35,5 +35,8 @@
|
|
|
35
35
|
"error-no-reference-data-in-variable": "Nema referentnih podataka u varijabli \"%%referenceExportedVarName%%\" u \"%%referenceFile%%\"",
|
|
36
36
|
"error-no-provider-specified": "Nije naveden pružatelj usluge.",
|
|
37
37
|
"error-copying-file-to-temp-dir": "Greška pri kopiranju datoteke u privremeni direktorij: %%error%%",
|
|
38
|
-
"supported-providers": "Podržani pružatelji usluga su: %%providers%%"
|
|
38
|
+
"supported-providers": "Podržani pružatelji usluga su: %%providers%%",
|
|
39
|
+
"error-no-output-dir-specified": "Nije naveden izlazni direktorij putem '--output-dir', u konfiguracijskoj datoteci (putem 'outputDir') ili u istom direktoriju kao i vaša referentna datoteka (\"%%refFileDir%%\")",
|
|
40
|
+
"error-dir-create-failed": "Neuspješno stvaranje direktorija \"%%dir%%\"",
|
|
41
|
+
"error-no-reference-file-specified": "Nije navedena referentna datoteka putem '--reference-file' ili u konfiguracijskoj datoteci (putem 'referenceFile')"
|
|
39
42
|
}
|
package/localization/hy.json
CHANGED
|
@@ -35,5 +35,8 @@
|
|
|
35
35
|
"error-no-reference-data-in-variable": "Չի հայտնաբերվել որևէ հղումային տվյալ \"%%referenceExportedVarName%%\" փոփոխականում \"%%referenceFile%%\" ֆայլում։",
|
|
36
36
|
"error-no-provider-specified": "Մատակարար չի նշված։",
|
|
37
37
|
"error-copying-file-to-temp-dir": "Ֆայլի պատճենման սխալ դեպի ժամանակավոր թղթապանակը՝ %%error%%",
|
|
38
|
-
"supported-providers": "Սպասարկող մատակարարներն են՝ %%providers%%"
|
|
38
|
+
"supported-providers": "Սպասարկող մատակարարներն են՝ %%providers%%",
|
|
39
|
+
"error-no-output-dir-specified": "Ելքային պապանակը նշված չէ ո՛չ '--output-dir' միջոցով, ո՛չ կարգավորման ֆայլում (այսպես՝ 'outputDir'), և ո՛չ էլ նույն պապանակում, ինչ որ ձեր հղումային ֆայլն է (\"%%refFileDir%%\")",
|
|
40
|
+
"error-dir-create-failed": "Չհաջողվեց ստեղծել «%%dir%%» թղթապանակը",
|
|
41
|
+
"error-no-reference-file-specified": "Հղման ֆայլը նշված չէ '--reference-file' միջոցով կամ կոնֆիգուրացիոն ֆայլում (միջոցով 'referenceFile')"
|
|
39
42
|
}
|
package/localization/ja.json
CHANGED
|
@@ -35,5 +35,8 @@
|
|
|
35
35
|
"error-no-reference-data-in-variable": "変数「%%referenceExportedVarName%%」の参照データが「%%referenceFile%%」で見つかりませんでした。",
|
|
36
36
|
"error-no-provider-specified": "プロバイダーが指定されていません。",
|
|
37
37
|
"error-copying-file-to-temp-dir": "一時ディレクトリへのファイルコピー中にエラーが発生しました: %%error%%",
|
|
38
|
-
"supported-providers": "対応しているプロバイダーは次のとおりです: %%providers%%"
|
|
38
|
+
"supported-providers": "対応しているプロバイダーは次のとおりです: %%providers%%",
|
|
39
|
+
"error-no-output-dir-specified": "'--output-dir'、設定ファイル('outputDir'経由)、または参照ファイルと同じディレクトリ(\"%%refFileDir%%\")を通じて出力ディレクトリが指定されていません",
|
|
40
|
+
"error-dir-create-failed": "ディレクトリ「%%dir%%」の作成に失敗しました",
|
|
41
|
+
"error-no-reference-file-specified": "参照ファイルが'--reference-file'オプションまたは設定ファイル('referenceFile'経由)で指定されていません"
|
|
39
42
|
}
|
package/localization/km.json
CHANGED
|
@@ -35,5 +35,8 @@
|
|
|
35
35
|
"error-no-reference-data-in-variable": "មិនមានទិន្នន័យយោងត្រូវបានរកឃើញក្នុងអថេរ \"%%referenceExportedVarName%%\" នៅក្នុង \"%%referenceFile%%\" ទេ។",
|
|
36
36
|
"error-no-provider-specified": "មិនបានបញ្ជាក់អ្នកផ្តល់សេវាទេ។",
|
|
37
37
|
"error-copying-file-to-temp-dir": "កំហុសក្នុងការចម្លងឯកសារទៅថតបណ្តោះអាសន្ន៖ %%error%%",
|
|
38
|
-
"supported-providers": "ក្រុមហ៊ុនដែលគាំទ្រមាន៖ %%providers%%"
|
|
38
|
+
"supported-providers": "ក្រុមហ៊ុនដែលគាំទ្រមាន៖ %%providers%%",
|
|
39
|
+
"error-no-output-dir-specified": "មិនបានបញ្ជាក់ថតឯកសារបញ្ចេញតាមរយៈ '--output-dir' ក្នុងឯកសារកំណត់រចនាសម្ព័ន្ធ (តាមរយៈ 'outputDir') ឬនៅក្នុងថតតែមួយជាមួយឯកសារយោងរបស់អ្នក (\"%%refFileDir%%\")",
|
|
40
|
+
"error-dir-create-failed": "បរាជ័យក្នុងការបង្កើតថត \"%%dir%%\"",
|
|
41
|
+
"error-no-reference-file-specified": "មិនមានបញ្ជាក់ឯកសារយោងតាមរយៈ '--reference-file' ឬក្នុងឯកសារកំណត់រចនាសម្ព័ន្ធ (តាមរយៈ 'referenceFile')"
|
|
39
42
|
}
|
package/localization/ksf.json
CHANGED
|
@@ -35,5 +35,8 @@
|
|
|
35
35
|
"error-no-reference-data-in-variable": "Pa gen done referans trouv nan variab \"%%referenceExportedVarName%%\" nan \"%%referenceFile%%\"",
|
|
36
36
|
"error-no-provider-specified": "Aucun fournisseur spécifié.",
|
|
37
37
|
"error-copying-file-to-temp-dir": "Erɛr kɔpi fayil tɔ tɛmp dirɛktɔri: %%error%%",
|
|
38
|
-
"supported-providers": "Bâ pɛ́ na nkap: %%providers%%"
|
|
38
|
+
"supported-providers": "Bâ pɛ́ na nkap: %%providers%%",
|
|
39
|
+
"error-no-output-dir-specified": "Ngɑ̀ŋà yi a bǝ̆ yi ntsò kɑ̌s ŏ nga fɛ̀'lǝ̀ njwí mbɛ'tǝ via '--output-dir', ŏ ri nshwùn mbweliŋ (via 'outputDir'), kɛ bɛ sí ŏ sɑ́ŋ ntǝ̀n abǝ̆ fɑ́il yi a bɛ̌ njwí (\"%%refFileDir%%\")",
|
|
40
|
+
"error-dir-create-failed": "Kéʼ ghî pʉʼsǝ́ mǝ ntʉk kày lǝtèʼ \"%%dir%%\"",
|
|
41
|
+
"error-no-reference-file-specified": "Ntáŋ féh cút ajiŋti i a mbә nә tésә via '--reference-file' andә nә fájil kɔnfík (via 'referenceFile')"
|
|
39
42
|
}
|
package/localization/ku.json
CHANGED
|
@@ -35,5 +35,8 @@
|
|
|
35
35
|
"error-no-reference-data-in-variable": "Daneyên referansê di guherbarê \"%%referenceExportedVarName%%\" de di \"%%referenceFile%%\" de nehatine dîtin.",
|
|
36
36
|
"error-no-provider-specified": "Nabêjêrek diyarkirî ne.",
|
|
37
37
|
"error-copying-file-to-temp-dir": "هەڵە لە کۆچکردنی پەڕگە بۆ بوخچەی کاتی: %%error%%",
|
|
38
|
-
"supported-providers": "Pêşkêşkarên piştgirîkirî: %%providers%%"
|
|
38
|
+
"supported-providers": "Pêşkêşkarên piştgirîkirî: %%providers%%",
|
|
39
|
+
"error-no-output-dir-specified": "Ti rêya '--output-dir' ve ti peldanka derketinê nehatiye diyarkirin, di pelê veavakirinê de (bi rêya 'outputDir'), an jî di heman peldankê de wek pelê te yê referansê (\"%%refFileDir%%\")",
|
|
40
|
+
"error-dir-create-failed": "Nehêna ku peldanka \"%%dir%%\" were afirandin",
|
|
41
|
+
"error-no-reference-file-specified": "Ti riya '--reference-file' an di faylê configuration de (bi riya 'referenceFile') tu pelê referansê nehatiye diyarkirin"
|
|
39
42
|
}
|
package/localization/kw.json
CHANGED
|
@@ -35,5 +35,8 @@
|
|
|
35
35
|
"error-no-reference-data-in-variable": "Nyns eus data kevrennow kavadow a-barth an varians \"%%referenceExportedVarName%%\" yn \"%%referenceFile%%\"",
|
|
36
36
|
"error-no-provider-specified": "Nyns eus provyder spesifys.",
|
|
37
37
|
"error-copying-file-to-temp-dir": "Gwall ow kopia restren dhe'n gever temporyel: %%error%%",
|
|
38
|
-
"supported-providers": "An provydoryans skoodhys yw: %%providers%%"
|
|
38
|
+
"supported-providers": "An provydoryans skoodhys yw: %%providers%%",
|
|
39
|
+
"error-no-output-dir-specified": "Nyns eus Directory iswedh res styrys dre '--output-dir', yn restren cumyans (dre 'outputDir'), po y'n keth directory avel dha restren wonisogethel (\"%%refFileDir%%\")",
|
|
40
|
+
"error-dir-create-failed": "Gwerdhys dhe wul restorva \"%%dir%%\"",
|
|
41
|
+
"error-no-reference-file-specified": "Nyns eus restren-davarn res via '--reference-file' po y'n restren gefunssyans (via 'referenceFile')"
|
|
39
42
|
}
|
package/localization/my.json
CHANGED
|
@@ -35,5 +35,8 @@
|
|
|
35
35
|
"error-no-reference-data-in-variable": "\"%%referenceExportedVarName%%\" အမည်ရှိ ကိန်းဂဏန်းတွင် \"%%referenceFile%%\" တွင် ကိုးကားချက်ဒေတာများ မတွေ့ရှိပါ။",
|
|
36
36
|
"error-no-provider-specified": "ပံ့ပိုးသူမျှမသတ်မှတ်ထားပါ။",
|
|
37
37
|
"error-copying-file-to-temp-dir": "ဖိုင်ကို temp ဖိုင်တွဲသို့ ကူးယူနေစဉ် အမှားဖြစ်ပွားခဲ့သည်။ %%error%%",
|
|
38
|
-
"supported-providers": "ထောက်ပံ့ပေးသူများမှာ။ %%providers%%"
|
|
38
|
+
"supported-providers": "ထောက်ပံ့ပေးသူများမှာ။ %%providers%%",
|
|
39
|
+
"error-no-output-dir-specified": "သင့်ရဲ့ထုတ်လုပ်မှုဒါရိုက်ထရီကို '--output-dir' မှတစ်ဆင့်၊ config ဖိုင်တွင် ('outputDir' မှတစ်ဆင့်) သို့မဟုတ် သင့်ရဲ့ရည်ညွှန်းဖိုင်နှင့် ဒါရိုက်ထရီတူတွင် (\"%%refFileDir%%\") သတ်မှတ်ပေးထားခြင်းမရှိပါ",
|
|
40
|
+
"error-dir-create-failed": "ဒါရိုက်ထရီ \"%%dir%%\" ကို ဖန်တီးရန် မအောင်မြင်ပါ",
|
|
41
|
+
"error-no-reference-file-specified": "လုပ်ဆောင်ချက်ဖိုင် '--reference-file' သို့မဟုတ် config ဖိုင် (ဖြင့် 'referenceFile') မှတဆင့် သတ်မှတ်ထားခြင်းမရှိပါ"
|
|
39
42
|
}
|
package/localization/nl.json
CHANGED
|
@@ -35,5 +35,8 @@
|
|
|
35
35
|
"error-no-reference-data-in-variable": "Geen referentiegegevens gevonden in variabele \"%%referenceExportedVarName%%\" in \"%%referenceFile%%\"",
|
|
36
36
|
"error-no-provider-specified": "Geen aanbieder opgegeven.",
|
|
37
37
|
"error-copying-file-to-temp-dir": "Fout bij het kopiëren van bestand naar tijdelijke map: %%error%%",
|
|
38
|
-
"supported-providers": "Ondersteunde aanbieders zijn: %%providers%%"
|
|
38
|
+
"supported-providers": "Ondersteunde aanbieders zijn: %%providers%%",
|
|
39
|
+
"error-no-output-dir-specified": "Geen uitvoermap opgegeven via '--output-dir', in een configuratiebestand (via 'outputDir') of in dezelfde map als uw referentiebestand (\"%%refFileDir%%\")",
|
|
40
|
+
"error-dir-create-failed": "Kan map \"%%dir%%\" niet aanmaken",
|
|
41
|
+
"error-no-reference-file-specified": "Geen referentiebestand gespecificeerd via '--reference-file' of in configuratiebestand (via 'referenceFile')"
|
|
39
42
|
}
|
package/localization/prs.json
CHANGED
|
@@ -35,5 +35,8 @@
|
|
|
35
35
|
"error-no-reference-data-in-variable": "هیچ دادهی مرجعی در متغیر \"%%referenceExportedVarName%%\" در \"%%referenceFile%%\" یافت نشد.",
|
|
36
36
|
"error-no-provider-specified": "هیچ فراهمکنندهای مشخص نشده است.",
|
|
37
37
|
"error-copying-file-to-temp-dir": "خطا در کپی کردن فایل به دایرکتوری موقت: %%error%%",
|
|
38
|
-
"supported-providers": "پشتیبانی شده تامین کنندگان عبارتند از: %%providers%%"
|
|
38
|
+
"supported-providers": "پشتیبانی شده تامین کنندگان عبارتند از: %%providers%%",
|
|
39
|
+
"error-no-output-dir-specified": "هیچ مسیر خروجی از طریق '--output-dir'، در فایل پیکربندی (از طریق 'outputDir')، یا در همان دایرکتوری که فایل مرجع شما قرار دارد (\"%%refFileDir%%\") مشخص نشده است",
|
|
40
|
+
"error-dir-create-failed": "نتوانست دایرکتوری \"%%dir%%\" را ایجاد کند",
|
|
41
|
+
"error-no-reference-file-specified": "فایل مرجع از طریق '--reference-file' یا در فایل تنظیمات (از طریق 'referenceFile') مشخص نشده است"
|
|
39
42
|
}
|
|
@@ -33,6 +33,9 @@ export default {
|
|
|
33
33
|
'error-no-target-languages': `No target languages specified. Use --target-languages option or add 'targetLanguages' to your config file`,
|
|
34
34
|
'error-no-reference-data-in-variable': `No reference data found in variable "%%referenceExportedVarName%%" in "%%referenceFile%%"`,
|
|
35
35
|
'error-copying-file-to-temp-dir': `Error copying file to temp directory: %%error%%`,
|
|
36
|
+
'error-no-output-dir-specified': `No output directory specified via '--output-dir', in a config file (via 'outputDir'), or in the same directory as your reference file ("%%refFileDir%%")`,
|
|
37
|
+
'error-dir-create-failed': `Failed to create directory "%%dir%%"`,
|
|
38
|
+
'error-no-reference-file-specified': `No reference file specified via '--reference-file' or in config file (via 'referenceFile')`,
|
|
36
39
|
|
|
37
40
|
'supported-providers': `Supported providers are: %%providers%%`
|
|
38
41
|
}
|
package/localization/ru.json
CHANGED
|
@@ -35,5 +35,8 @@
|
|
|
35
35
|
"error-no-reference-data-in-variable": "Не найдены данные для ссылки в переменной \"%%referenceExportedVarName%%\" в файле \"%%referenceFile%%\"",
|
|
36
36
|
"error-no-provider-specified": "Не указан провайдер.",
|
|
37
37
|
"error-copying-file-to-temp-dir": "Ошибка копирования файла во временный каталог: %%error%%",
|
|
38
|
-
"supported-providers": "Поддерживаемые провайдеры: %%providers%%"
|
|
38
|
+
"supported-providers": "Поддерживаемые провайдеры: %%providers%%",
|
|
39
|
+
"error-no-output-dir-specified": "Не указан каталог вывода через '--output-dir', в конфигурационном файле (через 'outputDir') или в том же каталоге, что и ваш ссылочный файл (\"%%refFileDir%%\")",
|
|
40
|
+
"error-dir-create-failed": "Не удалось создать директорию \"%%dir%%\"",
|
|
41
|
+
"error-no-reference-file-specified": "Файл для сравнения не указан через '--reference-file' или в конфигурационном файле (через 'referenceFile')"
|
|
39
42
|
}
|
package/localization/sq.json
CHANGED
|
@@ -35,5 +35,8 @@
|
|
|
35
35
|
"error-no-reference-data-in-variable": "Nuk u gjetën të dhëna referimi në variablin \"%%referenceExportedVarName%%\" në \"%%referenceFile%%\"",
|
|
36
36
|
"error-no-provider-specified": "Nuk është specifikuar asnjë ofrues.",
|
|
37
37
|
"error-copying-file-to-temp-dir": "Gabim në kopjimin e skedarit në drejtorinë temp: %%error%%",
|
|
38
|
-
"supported-providers": "Ofruesit e mbështetur janë: %%providers%%"
|
|
38
|
+
"supported-providers": "Ofruesit e mbështetur janë: %%providers%%",
|
|
39
|
+
"error-no-output-dir-specified": "Asnjë direktorium daljeje nuk është specifikuar përmes '--output-dir', në një skedar konfigurimi (përmes 'outputDir'), ose në të njëjtin direktorium me skedarin tuaj të referencës (\"%%refFileDir%%\")",
|
|
40
|
+
"error-dir-create-failed": "Dështoi në krijimin e direktorisë \"%%dir%%\"",
|
|
41
|
+
"error-no-reference-file-specified": "Asnjë skedar reference nuk është specifikuar nëpërmjet '--reference-file' ose në skedarin e konfigurimit (nëpërmjet 'referenceFile')"
|
|
39
42
|
}
|
package/localization/swc.json
CHANGED
|
@@ -35,5 +35,8 @@
|
|
|
35
35
|
"error-no-reference-data-in-variable": "Hakuna data ya rejea iliyopatikana katika kigezo \"%%referenceExportedVarName%%\" katika \"%%referenceFile%%\"",
|
|
36
36
|
"error-no-provider-specified": "Hakuna mtoa huduma aliyetajwa.",
|
|
37
37
|
"error-copying-file-to-temp-dir": "Kosa la kunakili faili kwenda kwenye saraka ya muda: %%error%%",
|
|
38
|
-
"supported-providers": "Watoa huduma wanaoungwa mkono ni: %%providers%%"
|
|
38
|
+
"supported-providers": "Watoa huduma wanaoungwa mkono ni: %%providers%%",
|
|
39
|
+
"error-no-output-dir-specified": "Hakuna saraka ya kutoa iliyobainishwa kupitia '--output-dir', katika faili ya usanidi (kupitia 'outputDir'), au katika saraka moja na faili yako ya kumbukumbu (\"%%refFileDir%%\")",
|
|
40
|
+
"error-dir-create-failed": "Imeshindwa kuunda saraka \"%%dir%%\"",
|
|
41
|
+
"error-no-reference-file-specified": "Hakuna faili ya marejeleo iliyotajwa kupitia '--reference-file' au kwenye faili ya usanidi (kupitia 'referenceFile')"
|
|
39
42
|
}
|
package/localization/th.json
CHANGED
|
@@ -35,5 +35,8 @@
|
|
|
35
35
|
"error-no-reference-data-in-variable": "ไม่พบข้อมูลอ้างอิงในตัวแปร \"%%referenceExportedVarName%%\" ใน \"%%referenceFile%%\"",
|
|
36
36
|
"error-no-provider-specified": "ไม่ได้ระบุผู้ให้บริการ",
|
|
37
37
|
"error-copying-file-to-temp-dir": "เกิดข้อผิดพลาดในการคัดลอกไฟล์ไปยังไดเรกทอรีชั่วคราว: %%error%%",
|
|
38
|
-
"supported-providers": "ผู้ให้บริการที่รองรับคือ: %%providers%%"
|
|
38
|
+
"supported-providers": "ผู้ให้บริการที่รองรับคือ: %%providers%%",
|
|
39
|
+
"error-no-output-dir-specified": "ไม่ได้ระบุไดเรกทอรีสำหรับการส่งออกผ่าน '--output-dir', ในไฟล์การกำหนดค่า (ผ่าน 'outputDir') หรือในไดเรกทอรีเดียวกับไฟล์อ้างอิงของคุณ (\"%%refFileDir%%\")",
|
|
40
|
+
"error-dir-create-failed": "ไม่สามารถสร้างไดเรกทอรี \"%%dir%%\"",
|
|
41
|
+
"error-no-reference-file-specified": "ไม่ได้ระบุไฟล์อ้างอิงผ่าน '--reference-file' หรือในไฟล์การกำหนดค่า (ผ่าน 'referenceFile')"
|
|
39
42
|
}
|
|
@@ -35,5 +35,8 @@
|
|
|
35
35
|
"error-no-reference-data-in-variable": "Ulac isaffen n umeskar deg umutti \"%%referenceExportedVarName%%\" deg \"%%referenceFile%%\"",
|
|
36
36
|
"error-no-provider-specified": "Ulac amdan yettwassen.",
|
|
37
37
|
"error-copying-file-to-temp-dir": "Tuccḍa n ufus ar tmudda n ugurru temp: %%error%%",
|
|
38
|
-
"supported-providers": "Isaffen yettwaskaren d-iyuran: %%providers%%"
|
|
38
|
+
"supported-providers": "Isaffen yettwaskaren d-iyuran: %%providers%%",
|
|
39
|
+
"error-no-output-dir-specified": "Ur ittwaḥdid umluɣ n uffuɣ s '--output-dir', tammara n usuddes (s 'outputDir'), niɣ ɣ umluɣ-nnes am ufaylu n usmmaqql (\"%%refFileDir%%\")",
|
|
40
|
+
"error-dir-create-failed": "Ur yizmir ad ysnulfu akaram \"%%dir%%\"",
|
|
41
|
+
"error-no-reference-file-specified": "Ur illi afaylu n timmẓilt yuran s '--reference-file' niɣ ɣ ufaylu n uswuddu (s 'referenceFile')"
|
|
39
42
|
}
|
package/localization/uk.json
CHANGED
|
@@ -35,5 +35,8 @@
|
|
|
35
35
|
"error-no-reference-data-in-variable": "Не знайдено даних у змінній \"%%referenceExportedVarName%%\" у файлі \"%%referenceFile%%\"",
|
|
36
36
|
"error-no-provider-specified": "Не вказано жодного провайдера.",
|
|
37
37
|
"error-copying-file-to-temp-dir": "Помилка копіювання файлу в тимчасову папку: %%error%%",
|
|
38
|
-
"supported-providers": "Підтримувані провайдери: %%providers%%"
|
|
38
|
+
"supported-providers": "Підтримувані провайдери: %%providers%%",
|
|
39
|
+
"error-no-output-dir-specified": "Не вказано каталог виводу через '--output-dir', у файлі конфігурації (через 'outputDir') або в тому ж каталозі, що й ваш еталонний файл (\"%%refFileDir%%\")",
|
|
40
|
+
"error-dir-create-failed": "Не вдалося створити каталог \"%%dir%%\"",
|
|
41
|
+
"error-no-reference-file-specified": "Не вказано файл посилань через '--reference-file' або у конфігураційному файлі (через 'referenceFile')"
|
|
39
42
|
}
|
package/localization/vi.json
CHANGED
|
@@ -35,5 +35,8 @@
|
|
|
35
35
|
"error-no-reference-data-in-variable": "Không tìm thấy dữ liệu tham chiếu trong biến \"%%referenceExportedVarName%%\" trong \"%%referenceFile%%\"",
|
|
36
36
|
"error-no-provider-specified": "Không có nhà cung cấp được chỉ định.",
|
|
37
37
|
"error-copying-file-to-temp-dir": "Lỗi khi sao chép tệp vào thư mục tạm thời: %%error%%",
|
|
38
|
-
"supported-providers": "Các nhà cung cấp được hỗ trợ là: %%providers%%"
|
|
38
|
+
"supported-providers": "Các nhà cung cấp được hỗ trợ là: %%providers%%",
|
|
39
|
+
"error-no-output-dir-specified": "Không có thư mục đầu ra được chỉ định qua '--output-dir', trong tệp cấu hình (qua 'outputDir'), hoặc trong cùng thư mục với tệp tham chiếu của bạn (\"%%refFileDir%%\")",
|
|
40
|
+
"error-dir-create-failed": "Không thể tạo thư mục \"%%dir%%\"",
|
|
41
|
+
"error-no-reference-file-specified": "Không có tệp tham chiếu nào được chỉ định qua '--reference-file' hoặc trong tệp cấu hình (qua 'referenceFile')"
|
|
39
42
|
}
|
|
@@ -35,5 +35,8 @@
|
|
|
35
35
|
"error-no-reference-data-in-variable": "未在 \"%%referenceFile%%\" 中找到变量 \"%%referenceExportedVarName%%\" 的参考数据。",
|
|
36
36
|
"error-no-provider-specified": "未指定提供者。",
|
|
37
37
|
"error-copying-file-to-temp-dir": "复制文件到临时目录时出错:%%error%%",
|
|
38
|
-
"supported-providers": "支持的提供商有:%%providers%%"
|
|
38
|
+
"supported-providers": "支持的提供商有:%%providers%%",
|
|
39
|
+
"error-no-output-dir-specified": "未通过\"--output-dir\"、配置文件(通过\"outputDir\")或在与您的参考文件(\"%%refFileDir%%\")相同的目录中指定输出目录",
|
|
40
|
+
"error-dir-create-failed": "创建目录\"%%dir%%\"失败",
|
|
41
|
+
"error-no-reference-file-specified": "未通过\"--reference-file\"或在配置文件中(通过\"referenceFile\")指定参考文件"
|
|
39
42
|
}
|
|
@@ -35,5 +35,8 @@
|
|
|
35
35
|
"error-no-reference-data-in-variable": "未在 \"%%referenceFile%%\" 中找到變數 \"%%referenceExportedVarName%%\" 的參考數據。",
|
|
36
36
|
"error-no-provider-specified": "未指定提供者。",
|
|
37
37
|
"error-copying-file-to-temp-dir": "複製文件到臨時目錄時出錯:%%error%%",
|
|
38
|
-
"supported-providers": "支援的供應商包括:%%providers%%"
|
|
38
|
+
"supported-providers": "支援的供應商包括:%%providers%%",
|
|
39
|
+
"error-no-output-dir-specified": "未通過 '--output-dir' 指定輸出目錄,也未在配置文件中(通過 'outputDir')指定,或未指定為與參考文件(\"%%refFileDir%%\")相同的目錄",
|
|
40
|
+
"error-dir-create-failed": "無法建立目錄「%%dir%%」",
|
|
41
|
+
"error-no-reference-file-specified": "未通過 '--reference-file' 或在配置檔案中(通過 'referenceFile')指定參考檔案"
|
|
39
42
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@drone1/alt",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.1.1",
|
|
5
5
|
"description": "An AI-powered localization tool",
|
|
6
6
|
"main": "src/index.mjs",
|
|
7
7
|
"bin": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"test:targeted": "ALT_TEST=1 mocha --grep 'multiple target'",
|
|
13
13
|
"test": "ALT_TEST=1 mocha",
|
|
14
14
|
"test:coverage": "ALT_TEST=1 nyc mocha",
|
|
15
|
-
"localize-display-strings": "./alt.mjs
|
|
15
|
+
"localize-display-strings": "./alt.mjs",
|
|
16
16
|
"print-all-help": "rm -f help.txt && (./alt.mjs help && echo -e '\n---\n' && ./alt.mjs help translate && echo -e '\n---\n' && ./alt.mjs help list-models) > help.txt",
|
|
17
17
|
"generate-toc": "./scripts/gh-md-toc --insert README.md && rm -f README.md.orig.* README.md.toc.* && echo '\n**README.md updated with new table of contents**'"
|
|
18
18
|
},
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import * as path from 'path'
|
|
2
2
|
import axios from 'axios'
|
|
3
|
-
import { fileURLToPath } from 'url'
|
|
4
3
|
import { Listr } from 'listr2'
|
|
5
4
|
import { localize, localizeFormatted } from '../localizer/localize.js'
|
|
6
5
|
import {
|
|
7
6
|
DEFAULT_CACHE_FILENAME, DEFAULT_LLM_MODELS,
|
|
8
7
|
OVERLOADED_BACKOFF_INTERVAL_MS,
|
|
9
|
-
TRANSLATION_FAILED_RESPONSE_TEXT,
|
|
10
8
|
VALID_TRANSLATION_PROVIDERS
|
|
11
9
|
} from '../lib/consts.js'
|
|
12
|
-
import { assertValidPath } from '../lib/assert.js'
|
|
13
|
-
import {
|
|
14
|
-
|
|
10
|
+
import { assertIsObj, assertValidPath } from '../lib/assert.js'
|
|
11
|
+
import {
|
|
12
|
+
dirExists,
|
|
13
|
+
ensureDir,
|
|
14
|
+
mkTmpDir,
|
|
15
|
+
normalizeOutputPath,
|
|
16
|
+
readFileAsText,
|
|
17
|
+
readJsonFile,
|
|
18
|
+
writeJsonFile,
|
|
19
|
+
} from '../lib/io.js'
|
|
20
|
+
import { calculateHash, getFileExtension, normalizeData, sleep } from '../lib/utils.js'
|
|
15
21
|
import { formatContextKeyFromKey, isContextKey } from '../lib/context-keys.js'
|
|
16
22
|
import { loadConfig } from '../lib/config.js'
|
|
17
23
|
import { loadTranslationProvider } from '../lib/provider.js'
|
|
@@ -22,15 +28,73 @@ import { loadReferenceFile } from '../lib/reference-loader.js'
|
|
|
22
28
|
export async function runTranslation({ appState, options, log }) {
|
|
23
29
|
let exitCode = 0
|
|
24
30
|
try {
|
|
25
|
-
|
|
26
|
-
let outputDir = options.outputDir ?? refFileDir
|
|
27
|
-
|
|
28
|
-
// Load config file or create default
|
|
31
|
+
// Attempt to load a config file, or return default values
|
|
29
32
|
const config = await loadConfig({
|
|
30
33
|
configFile: options.configFile,
|
|
31
|
-
refFileDir,
|
|
32
34
|
log
|
|
33
35
|
})
|
|
36
|
+
assertIsObj(config)
|
|
37
|
+
|
|
38
|
+
const referenceFile = options.referenceFile ?? config.referenceFile
|
|
39
|
+
if (!referenceFile?.length) {
|
|
40
|
+
throw new Error(
|
|
41
|
+
localize({
|
|
42
|
+
token: 'error-no-reference-file-specified',
|
|
43
|
+
lang: appState.lang,
|
|
44
|
+
log
|
|
45
|
+
})
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
log.D(`referenceFile=${referenceFile}`)
|
|
49
|
+
|
|
50
|
+
// Resolve referenceExportedVarName
|
|
51
|
+
let referenceExportedVarName
|
|
52
|
+
const referenceFileExt = getFileExtension(referenceFile)
|
|
53
|
+
if (['js','mjs'].includes(referenceFileExt)) {
|
|
54
|
+
log.D(`Searching for reference exported var name for .${referenceFileExt} extension...`)
|
|
55
|
+
if (options.referenceExportedVarName?.length) {
|
|
56
|
+
log.D(`Found reference exported var name via --reference-exported-var-name`)
|
|
57
|
+
referenceExportedVarName = options.referenceExportedVarName
|
|
58
|
+
} else if (config.referenceExportedVarName?.length) {
|
|
59
|
+
log.D(`Found reference exported var name in config, via 'referenceExportedVarName'`)
|
|
60
|
+
referenceExportedVarName = config.referenceExportedVarName
|
|
61
|
+
} else {
|
|
62
|
+
log.D(`No reference exported var name found; `)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
log.D(`referenceExportedVarName=${referenceExportedVarName}`)
|
|
66
|
+
|
|
67
|
+
const refFileDir = path.dirname(referenceFile)
|
|
68
|
+
let outputDir = path.resolve(options.outputDir ?? config.outputDir ?? refFileDir)
|
|
69
|
+
log.D(`outputDir=${outputDir}`)
|
|
70
|
+
if (!outputDir?.length) {
|
|
71
|
+
throw new Error(
|
|
72
|
+
localizeFormatted({
|
|
73
|
+
token: 'error-no-output-dir-specified',
|
|
74
|
+
data: { refFileDir },
|
|
75
|
+
lang: appState.lang,
|
|
76
|
+
log
|
|
77
|
+
})
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (!dirExists(outputDir, log)) {
|
|
82
|
+
log.V(`Directory "${outputDir}" did not exist -- creating...`)
|
|
83
|
+
ensureDir(outputDir, log)
|
|
84
|
+
|
|
85
|
+
if (!dirExists(outputDir, log)) {
|
|
86
|
+
throw new Error(
|
|
87
|
+
localizeFormatted({
|
|
88
|
+
token: 'error-dir-create-failed',
|
|
89
|
+
data: { dir: outputDir },
|
|
90
|
+
lang: appState.lang,
|
|
91
|
+
log
|
|
92
|
+
})
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
log.D(`Output dir "${outputDir}" existed`)
|
|
97
|
+
}
|
|
34
98
|
|
|
35
99
|
// Validate provider
|
|
36
100
|
const providerName = (options.provider ?? config.provider)?.toLowerCase()
|
|
@@ -89,14 +153,14 @@ export async function runTranslation({ appState, options, log }) {
|
|
|
89
153
|
appState.tmpDir = tmpDir
|
|
90
154
|
|
|
91
155
|
// Copy to a temp location first so we can ensure it has an .mjs extension
|
|
92
|
-
const referenceData = await loadReferenceFile({ appLang: appState.lang,
|
|
156
|
+
const referenceData = await loadReferenceFile({ appLang: appState.lang, referenceFile, referenceExportedVarName, tmpDir, log })
|
|
93
157
|
if (!referenceData) {
|
|
94
158
|
throw new Error(
|
|
95
159
|
localizeFormatted({
|
|
96
160
|
token: 'error-no-reference-data-in-variable',
|
|
97
161
|
data: {
|
|
98
|
-
referenceExportedVarName
|
|
99
|
-
referenceFile
|
|
162
|
+
referenceExportedVarName,
|
|
163
|
+
referenceFile,
|
|
100
164
|
},
|
|
101
165
|
lang: appState.lang,
|
|
102
166
|
log
|
|
@@ -104,7 +168,7 @@ export async function runTranslation({ appState, options, log }) {
|
|
|
104
168
|
)
|
|
105
169
|
}
|
|
106
170
|
|
|
107
|
-
const referenceHash = calculateHash(await readFileAsText(
|
|
171
|
+
const referenceHash = calculateHash(await readFileAsText(referenceFile))
|
|
108
172
|
const referenceChanged = referenceHash !== readOnlyCache.referenceHash
|
|
109
173
|
if (referenceChanged) {
|
|
110
174
|
log.V('Reference file has changed since last run')
|
|
@@ -571,8 +635,6 @@ async function translateTextViaProvider({
|
|
|
571
635
|
messages.push(
|
|
572
636
|
`You are a professional translator for an application's text from ${sourceLang} to ${targetLang}. `
|
|
573
637
|
+ `Translate the text accurately without adding explanations or additional content. Only return the text. `
|
|
574
|
-
//+ `If and only if you absolutely cannot translate the text, you can respond with "${TRANSLATION_FAILED_RESPONSE_TEXT}" -- but please try to translate the text if you can. It would be greatly
|
|
575
|
-
// appreciated.`, // With this, the AI seems to be lazy and use it way too often
|
|
576
638
|
)
|
|
577
639
|
if (appContextMessage?.length) {
|
|
578
640
|
messages.push(`Here is some high-level information about the application you are translating text for: ${appContextMessage}`)
|
|
@@ -593,7 +655,6 @@ async function translateTextViaProvider({
|
|
|
593
655
|
const translated = provider.getResult(response, log)
|
|
594
656
|
if (!translated?.length) throw new Error(`${providerName} translated text to empty string. You may need to top up your credits.`)
|
|
595
657
|
log.D(`${translated}`)
|
|
596
|
-
if (translated === TRANSLATION_FAILED_RESPONSE_TEXT) throw new Error(`${providerName} failed to translate string to ${targetLang}; string: ${text}`)
|
|
597
658
|
outResult.translated = translated
|
|
598
659
|
} catch (error) {
|
|
599
660
|
let errorHandled = false
|
package/src/lib/config.js
CHANGED
|
@@ -1,26 +1,42 @@
|
|
|
1
1
|
import * as path from 'path'
|
|
2
2
|
import { DEFAULT_CONFIG_FILENAME } from './consts.js'
|
|
3
|
-
import { readJsonFile } from './io.js'
|
|
3
|
+
import { fileExists, readJsonFile } from './io.js'
|
|
4
4
|
|
|
5
|
-
export async function loadConfig({ configFile,
|
|
5
|
+
export async function loadConfig({ configFile, log }) {
|
|
6
6
|
let configFilePath
|
|
7
7
|
if (configFile?.length) {
|
|
8
8
|
log.V(`Using config file specified by --config-file "${configFile}"...`)
|
|
9
9
|
configFilePath = configFile
|
|
10
10
|
} else {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
// Search for a config in the current working directory
|
|
12
|
+
const cwdConfigFilePath = path.resolve(process.cwd(), DEFAULT_CONFIG_FILENAME)
|
|
13
|
+
if (await fileExists(cwdConfigFilePath)) {
|
|
14
|
+
log.V(`Using config file in current working dir, "${process.cwd()}"...`)
|
|
15
|
+
configFilePath = cwdConfigFilePath
|
|
16
|
+
} else {
|
|
17
|
+
log.V(`"${DEFAULT_CONFIG_FILENAME}" not wasn't found in the current working directory...`)
|
|
18
|
+
}
|
|
13
19
|
}
|
|
14
20
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
let result
|
|
22
|
+
if (configFilePath?.length) {
|
|
23
|
+
log.V(`Attempting to load config file from "${configFilePath}"`)
|
|
24
|
+
result = await readJsonFile(configFilePath)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (!result) {
|
|
28
|
+
result = {
|
|
29
|
+
provider: null,
|
|
30
|
+
targetLanguages: [],
|
|
31
|
+
lookForContextData: false,
|
|
32
|
+
contextPrefix: '',
|
|
33
|
+
contextSuffix: '',
|
|
34
|
+
outputDir: null,
|
|
35
|
+
referenceFile: null,
|
|
36
|
+
referenceLanguage: null,
|
|
37
|
+
normalizeOutputFilenames: false
|
|
38
|
+
}
|
|
24
39
|
}
|
|
25
|
-
}
|
|
26
40
|
|
|
41
|
+
return result
|
|
42
|
+
}
|
package/src/lib/consts.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import * as path from 'path'
|
|
2
|
-
|
|
3
|
-
export const TRANSLATION_FAILED_RESPONSE_TEXT = '<<<TRANSLATION_FAILED>>>'
|
|
4
1
|
export const LANGTAG_ENGLISH = 'en'
|
|
5
2
|
export const LANGTAG_DEFAULT = LANGTAG_ENGLISH
|
|
6
3
|
|
|
@@ -19,7 +16,7 @@ export const ENV_VARS = [
|
|
|
19
16
|
|
|
20
17
|
export const LOCALIZATION_SRC_DIR = 'localization'
|
|
21
18
|
export const DEFAULT_CACHE_FILENAME = '.localization.cache.json'
|
|
22
|
-
export const DEFAULT_CONFIG_FILENAME = 'config.json'
|
|
19
|
+
export const DEFAULT_CONFIG_FILENAME = 'alt.config.json'
|
|
23
20
|
export const OVERLOADED_BACKOFF_INTERVAL_MS = 30 * 1000
|
|
24
21
|
export const CWD = process.cwd()
|
|
25
22
|
|
|
@@ -31,8 +28,8 @@ export const SUPPORTED_REFERENCE_FILE_EXTENSIONS = [
|
|
|
31
28
|
]
|
|
32
29
|
|
|
33
30
|
export const DEFAULT_LLM_MODELS = {
|
|
34
|
-
anthropic: 'claude-
|
|
31
|
+
anthropic: 'claude-haiku-4-5-20251001',
|
|
35
32
|
google: 'gemini-2.0-flash',
|
|
36
|
-
openai: 'gpt-4-
|
|
33
|
+
openai: 'gpt-4.1-mini'
|
|
37
34
|
}
|
|
38
35
|
|
package/src/lib/io.js
CHANGED
|
@@ -3,7 +3,7 @@ import { getFileExtension } from './utils.js'
|
|
|
3
3
|
import { SUPPORTED_REFERENCE_FILE_EXTENSIONS } from './consts.js'
|
|
4
4
|
import { localizeFormatted } from '../localizer/localize.js'
|
|
5
5
|
|
|
6
|
-
export async function loadReferenceFile({ appLang,
|
|
6
|
+
export async function loadReferenceFile({ appLang, referenceFile, referenceExportedVarName, tmpDir, log }) {
|
|
7
7
|
const ext = getFileExtension(referenceFile)?.toLowerCase()
|
|
8
8
|
if (!SUPPORTED_REFERENCE_FILE_EXTENSIONS.includes(ext)) {
|
|
9
9
|
throw new Error(
|
package/src/lib/utils.js
CHANGED
|
@@ -118,6 +118,6 @@ export function pick(o, ...props) {
|
|
|
118
118
|
// Returns the extension without the '.'
|
|
119
119
|
export function getFileExtension(path) {
|
|
120
120
|
if (path.indexOf('.') < 0) return null
|
|
121
|
-
return path.split('.').pop()
|
|
121
|
+
return path.split('.').pop().toLowerCase()
|
|
122
122
|
}
|
|
123
123
|
|
package/src/main.mjs
CHANGED
|
@@ -105,17 +105,17 @@ export async function run() {
|
|
|
105
105
|
addSharedOptions({
|
|
106
106
|
notRequired: [ 'provider' ],
|
|
107
107
|
program: program
|
|
108
|
-
.command('translate')
|
|
109
|
-
.
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
.command('translate', { isDefault: true })
|
|
109
|
+
.option('-c, --config-file <path>', `Path to config file; defaults to "${DEFAULT_CONFIG_FILENAME}" in the current working directory if not specified`)
|
|
110
|
+
.option('-r, --reference-file <path>', `Path to reference file of source strings to be translated. This file can be in .js, .mjs, .json, or .jsonc formats and is presumed to be` +
|
|
111
|
+
` in the reference language specified by --reference-language; overrides any 'referenceFile' config setting`)
|
|
112
|
+
.option('-o, --output-dir <path>', `Output directory for localized files; overrides any 'outputDir' config setting`)
|
|
112
113
|
.option('-rl, --reference-language <language>', `The reference file's language; overrides any 'referenceLanguage' config setting`)
|
|
113
|
-
.option('-o, --output-dir <path>', 'Output directory for localized files')
|
|
114
114
|
.option('-tl, --target-languages <list>', `Comma-separated list of language codes; overrides any 'targetLanguages' config setting`, value => languageList(value, log))
|
|
115
|
-
.option('-k, --keys <list>', 'Comma-separated list of keys to process', keyList)
|
|
116
|
-
.option('-R, --reference-exported-var-name <var name>', `For .js or .mjs reference files, this will be the exported variable, e.g. for 'export default = {...}' you'd use 'default' here, or 'data' for 'export const data = { ... }'. For .json or .jsonc reference files, this value is ignored.`, 'default')
|
|
117
|
-
.option('-m, --app-context-message <message>', `Description of your app to
|
|
118
|
-
.option('-f, --force',
|
|
115
|
+
.option('-k, --keys <list>', 'Comma-separated list of keys to process; if none are processed, all keys in the reference file will be processed', keyList)
|
|
116
|
+
.option('-R, --reference-exported-var-name <var name>', `For .js or .mjs reference files only, this will be the exported variable, e.g. for 'export default = {...}' you'd use 'default' here, or 'data' for 'export const data = { ... }'. For .json or .jsonc reference files, this value is ignored.`, 'default')
|
|
117
|
+
.option('-m, --app-context-message <message>', `Description of your app, to be passed along to the AI, per translation request; overrides any 'appContextMessage' config setting`)
|
|
118
|
+
.option('-f, --force', `Force regeneration of all keys; if no '--keys' argument is specified, all keys will be processed`, false)
|
|
119
119
|
.option('-rtw, --realtime-writes', 'Write updates to disk immediately, rather than on shutdown', false)
|
|
120
120
|
.option('-y, --tty', 'Use tty/simple renderer; useful for CI', false)
|
|
121
121
|
.option('-M, --model <name>', `LLM model name to use; defaults are: ${Object.keys(DEFAULT_LLM_MODELS).map(p => `for "${p}": "${DEFAULT_LLM_MODELS[p]}"`).join(', ')}; use the 'list-models' command to view all models`)
|