i18next-cli 1.11.14 → 1.12.0
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/CHANGELOG.md +4 -0
- package/README.md +3 -3
- package/dist/cjs/cli.js +1 -1
- package/dist/cjs/extractor/core/translation-manager.js +1 -1
- package/dist/cjs/syncer.js +1 -1
- package/dist/cjs/utils/default-value.js +1 -1
- package/dist/esm/cli.js +1 -1
- package/dist/esm/extractor/core/translation-manager.js +1 -1
- package/dist/esm/syncer.js +1 -1
- package/dist/esm/utils/default-value.js +1 -1
- package/package.json +1 -1
- package/src/cli.ts +1 -1
- package/src/extractor/core/translation-manager.ts +2 -2
- package/src/syncer.ts +8 -7
- package/src/types.ts +2 -2
- package/src/utils/default-value.ts +8 -7
- package/types/syncer.d.ts.map +1 -1
- package/types/types.d.ts +2 -2
- package/types/types.d.ts.map +1 -1
- package/types/utils/default-value.d.ts +5 -5
- package/types/utils/default-value.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.12.0](https://github.com/i18next/i18next-cli/compare/v1.11.14...v1.12.0) - 2025-10-23
|
|
9
|
+
|
|
10
|
+
- feat(default-value): add value parameter to defaultValue function [#71](https://github.com/i18next/i18next-cli/pull/71)
|
|
11
|
+
|
|
8
12
|
## [1.11.14](https://github.com/i18next/i18next-cli/compare/v1.11.13...v1.11.14) - 2025-10-22
|
|
9
13
|
|
|
10
14
|
- Better Fix for: Stop infinite watch loops by properly honoring extract.ignore patterns [#70](https://github.com/i18next/i18next-cli/issues/70)
|
package/README.md
CHANGED
|
@@ -363,9 +363,9 @@ export default defineConfig({
|
|
|
363
363
|
defaultValue: '', // Simple string: all missing keys get this value
|
|
364
364
|
|
|
365
365
|
// Or use a function for dynamic defaults:
|
|
366
|
-
// defaultValue: (key, namespace, language) => key, // i18next-parser style: use key as value
|
|
367
|
-
// defaultValue: (key, namespace, language) => `TODO: translate ${key}`, // Mark untranslated keys
|
|
368
|
-
// defaultValue: (key, namespace, language) => language === 'de' ? 'German TODO' : 'TODO', // Language-specific
|
|
366
|
+
// defaultValue: (key, namespace, language, value) => key, // i18next-parser style: use key as value
|
|
367
|
+
// defaultValue: (key, namespace, language, value) => `TODO: translate ${key}`, // Mark untranslated keys
|
|
368
|
+
// defaultValue: (key, namespace, language, value) => language === 'de' ? 'German TODO' : 'TODO', // Language-specific
|
|
369
369
|
|
|
370
370
|
/** If true, keys that are not found in the source code will be removed from translation files. (default: true) */
|
|
371
371
|
removeUnusedKeys: true,
|
package/dist/cjs/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var e=require("commander"),t=require("chokidar"),n=require("glob"),o=require("minimatch"),i=require("chalk"),a=require("./config.js"),r=require("./heuristic-config.js"),c=require("./extractor/core/extractor.js");require("node:path"),require("node:fs/promises"),require("jiti");var s=require("./types-generator.js"),l=require("./syncer.js"),u=require("./migrator.js"),d=require("./init.js"),g=require("./linter.js"),p=require("./status.js"),f=require("./locize.js");const m=new e.Command;m.name("i18next-cli").description("A unified, high-performance i18next CLI.").version("1.
|
|
2
|
+
"use strict";var e=require("commander"),t=require("chokidar"),n=require("glob"),o=require("minimatch"),i=require("chalk"),a=require("./config.js"),r=require("./heuristic-config.js"),c=require("./extractor/core/extractor.js");require("node:path"),require("node:fs/promises"),require("jiti");var s=require("./types-generator.js"),l=require("./syncer.js"),u=require("./migrator.js"),d=require("./init.js"),g=require("./linter.js"),p=require("./status.js"),f=require("./locize.js");const m=new e.Command;m.name("i18next-cli").description("A unified, high-performance i18next CLI.").version("1.12.0"),m.command("extract").description("Extract translation keys from source files and update resource files.").option("-w, --watch","Watch for file changes and re-run the extractor.").option("--ci","Exit with a non-zero status code if any files are updated.").option("--dry-run","Run the extractor without writing any files to disk.").option("--sync-primary","Sync primary language values with default values from code.").action(async e=>{try{const n=await a.ensureConfig(),i=async()=>{const t=await c.runExtractor(n,{isWatchMode:!!e.watch,isDryRun:!!e.dryRun,syncPrimaryWithDefaults:!!e.syncPrimary});return e.ci&&!t?(console.log("✅ No files were updated."),process.exit(0)):e.ci&&t&&(console.error("❌ Some files were updated. This should not happen in CI mode."),process.exit(1)),t};if(await i(),e.watch){console.log("\nWatching for changes...");const e=await w(n.extract.input),a=y(n.extract.ignore),r=h(n.extract.output),c=[...a,...r].filter(Boolean),s=e.filter(e=>!c.some(t=>o.minimatch(e,t,{dot:!0})));t.watch(s,{ignored:/node_modules/,persistent:!0}).on("change",e=>{console.log(`\nFile changed: ${e}`),i()})}}catch(e){console.error("Error running extractor:",e),process.exit(1)}}),m.command("status [locale]").description("Display translation status. Provide a locale for a detailed key-by-key view.").option("-n, --namespace <ns>","Filter the status report by a specific namespace").action(async(e,t)=>{let n=await a.loadConfig();if(!n){console.log(i.blue("No config file found. Attempting to detect project structure..."));const e=await r.detectConfig();e||(console.error(i.red("Could not automatically detect your project structure.")),console.log(`Please create a config file first by running: ${i.cyan("npx i18next-cli init")}`),process.exit(1)),console.log(i.green("Project structure detected successfully!")),n=e}await p.runStatus(n,{detail:e,namespace:t.namespace})}),m.command("types").description("Generate TypeScript definitions from translation resource files.").option("-w, --watch","Watch for file changes and re-run the type generator.").action(async e=>{const n=await a.ensureConfig(),i=()=>s.runTypesGenerator(n);if(await i(),e.watch){console.log("\nWatching for changes...");const e=await w(n.types?.input||[]),a=[...y(n.extract?.ignore)].filter(Boolean),r=e.filter(e=>!a.some(t=>o.minimatch(e,t,{dot:!0})));t.watch(r,{persistent:!0}).on("change",e=>{console.log(`\nFile changed: ${e}`),i()})}}),m.command("sync").description("Synchronize secondary language files with the primary language file.").action(async()=>{const e=await a.ensureConfig();await l.runSyncer(e)}),m.command("migrate-config [configPath]").description("Migrate a legacy i18next-parser.config.js to the new format.").action(async e=>{await u.runMigrator(e)}),m.command("init").description("Create a new i18next.config.ts/js file with an interactive setup wizard.").action(d.runInit),m.command("lint").description("Find potential issues like hardcoded strings in your codebase.").option("-w, --watch","Watch for file changes and re-run the linter.").action(async e=>{const n=async()=>{let e=await a.loadConfig();if(!e){console.log(i.blue("No config file found. Attempting to detect project structure..."));const t=await r.detectConfig();t||(console.error(i.red("Could not automatically detect your project structure.")),console.log(`Please create a config file first by running: ${i.cyan("npx i18next-cli init")}`),process.exit(1)),console.log(i.green("Project structure detected successfully!")),e=t}await g.runLinter(e)};if(await n(),e.watch){console.log("\nWatching for changes...");const e=await a.loadConfig();if(e?.extract?.input){const i=await w(e.extract.input),a=[...y(e.extract.ignore),...h(e.extract.output)].filter(Boolean),r=i.filter(e=>!a.some(t=>o.minimatch(e,t,{dot:!0})));t.watch(r,{ignored:/node_modules/,persistent:!0}).on("change",e=>{console.log(`\nFile changed: ${e}`),n()})}}}),m.command("locize-sync").description("Synchronize local translations with your locize project.").option("--update-values","Update values of existing translations on locize.").option("--src-lng-only","Check for changes in source language only.").option("--compare-mtime","Compare modification times when syncing.").option("--dry-run","Run the command without making any changes.").action(async e=>{const t=await a.ensureConfig();await f.runLocizeSync(t,e)}),m.command("locize-download").description("Download all translations from your locize project.").action(async e=>{const t=await a.ensureConfig();await f.runLocizeDownload(t,e)}),m.command("locize-migrate").description("Migrate local translation files to a new locize project.").action(async e=>{const t=await a.ensureConfig();await f.runLocizeMigrate(t,e)}),m.parse(process.argv);const y=e=>Array.isArray(e)?e:e?[e]:[],h=e=>e&&"string"==typeof e?[e.replace(/\{\{[^}]+\}\}/g,"*")]:[],w=async(e=[])=>{const t=y(e),o=await Promise.all(t.map(e=>n.glob(e||"",{nodir:!0})));return Array.from(new Set(o.flat()))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("node:path"),t=require("glob"),s=require("../../utils/nested-object.js"),r=require("../../utils/file-utils.js"),n=require("../../utils/default-value.js");function a(e){const t=`^${e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`;return new RegExp(t)}function o(e,t){if("object"!=typeof e||null===e||Array.isArray(e))return e;const s={},r=t?.extract?.pluralSeparator??"_",n=["zero","one","two","few","many","other"],a=n.map(e=>`ordinal${r}${e}`),l=Object.keys(e).sort((e,t)=>{const s=e=>{for(const t of a)if(e.endsWith(`${r}${t}`)){return{base:e.slice(0,-(r.length+t.length)),form:t,isOrdinal:!0,isPlural:!0,fullKey:e}}for(const t of n)if(e.endsWith(`${r}${t}`)){return{base:e.slice(0,-(r.length+t.length)),form:t,isOrdinal:!1,isPlural:!0,fullKey:e}}return{base:e,form:"",isOrdinal:!1,isPlural:!1,fullKey:e}},o=s(e),l=s(t);if(o.isPlural&&l.isPlural){const e=o.base.localeCompare(l.base,void 0,{sensitivity:"base"});if(0!==e)return e;if(o.isOrdinal!==l.isOrdinal)return o.isOrdinal?1:-1;const t=o.isOrdinal?a:n,s=t.indexOf(o.form),r=t.indexOf(l.form);return-1!==s&&-1!==r?s-r:o.form.localeCompare(l.form)}const i=e.localeCompare(t,void 0,{sensitivity:"base"});return 0===i?e.localeCompare(t,void 0,{sensitivity:"case"}):i});for(const r of l)s[r]=o(e[r],t);return s}function l(e,t,r,a,l,i,c,u=!1){const{keySeparator:f=".",sort:d=!0,removeUnusedKeys:p=!0,primaryLanguage:g,defaultValue:y="",pluralSeparator:h="_",contextSeparator:m="_"}=r.extract,x=new Set;try{const e=new Intl.PluralRules(a,{type:"cardinal"}),t=new Intl.PluralRules(a,{type:"ordinal"});e.resolvedOptions().pluralCategories.forEach(e=>x.add(e)),t.resolvedOptions().pluralCategories.forEach(e=>x.add(`ordinal_${e}`))}catch(e){const t=new Intl.PluralRules(g||"en",{type:"cardinal"}),s=new Intl.PluralRules(g||"en",{type:"ordinal"});t.resolvedOptions().pluralCategories.forEach(e=>x.add(e)),s.resolvedOptions().pluralCategories.forEach(e=>x.add(`ordinal_${e}`))}const O=e.filter(({key:e,hasCount:t,isOrdinal:s})=>{if(i.some(t=>t.test(e)))return!1;if(!t)return!0;const r=e.split(h);if(s&&r.includes("ordinal")){const e=r[r.length-1];return x.has(`ordinal_${e}`)}if(t){const e=r[r.length-1];return x.has(e)}return!0});let v=p?{}:JSON.parse(JSON.stringify(t));const w=s.getNestedKeys(t,f??".");for(const e of w)if(i.some(t=>t.test(e))){const r=s.getNestedValue(t,e,f??".");s.setNestedValue(v,e,r,f??".")}if(p){const e=s.getNestedKeys(t,f??".");for(const r of e){const e=r.split(h);if("zero"===e[e.length-1]){const n=e.slice(0,-1).join(h);if(O.some(({key:e})=>e.split(h).slice(0,-1).join(h)===n)){const e=s.getNestedValue(t,r,f??".");s.setNestedValue(v,r,e,f??".")}}}}for(const{key:e,defaultValue:r,explicitDefault:o}of O){const i=s.getNestedValue(t,e,f??"."),d=!O.some(t=>t.key.startsWith(`${e}${f}`)&&t.key!==e),p="object"==typeof i&&null!==i&&(c.has(e)||!r||r===e),x="object"==typeof i&&null!==i&&d&&!c.has(e)&&!p;if(p){s.setNestedValue(v,e,i,f??".");continue}let w;if(void 0===i||x)if(a===g)if(u){const t=r&&(r===e||e!==r&&(e.startsWith(r+h)||e.startsWith(r+m)));w=r&&!t?r:n.resolveDefaultValue(y,e,l,a)}else w=r||e;else w=n.resolveDefaultValue(y,e,l,a);else if(a===g&&u){const t=r&&(r===e||e!==r&&(e.startsWith(r+h)||e.startsWith(r+m)));w=(e.includes(h)||e.includes(m))&&!o?i:r&&!t?r:i}else w=i;s.setNestedValue(v,e,w,f??".")}if(!0===d)return o(v,r);if("function"==typeof d){const e={},t=Object.keys(v),s=new Map;for(const e of O){const t=!1===f?e.key:e.key.split(f)[0];s.has(t)||s.set(t,e)}t.sort((e,t)=>{if("function"==typeof d){const r=s.get(e),n=s.get(t);if(r&&n)return d(r,n)}return e.localeCompare(t,void 0,{sensitivity:"base"})});for(const s of t)e[s]=o(v[s],r);v=e}return v}exports.getTranslations=async function(s,n,o,{syncPrimaryWithDefaults:i=!1}={}){o.extract.primaryLanguage||=o.locales[0]||"en",o.extract.secondaryLanguages||=o.locales.filter(e=>e!==o?.extract?.primaryLanguage);const c=o.extract.defaultNS??"translation",u=[...o.extract.preservePatterns||[]],f=o.extract.indentation??2;for(const e of n)u.push(`${e}.*`);const d=u.map(a),p=new Map;for(const e of s.values()){const t=e.ns||c;p.has(t)||p.set(t,[]),p.get(t).push(e)}const g=[],y=Array.isArray(o.extract.ignore)?o.extract.ignore:o.extract.ignore?[o.extract.ignore]:[];for(const s of o.locales){if(o.extract.mergeNamespaces||!o.extract.output.includes("{{namespace}}")){const t={},a=r.getOutputPath(o.extract.output,s),c=e.resolve(process.cwd(),a),u=await r.loadTranslationFile(c)||{},y=new Set([...p.keys(),...Object.keys(u)]);for(const e of y){const r=p.get(e)||[],a=u[e]||{};t[e]=l(r,a,o,s,e,d,n,i)}const h=JSON.stringify(u,null,f),m=JSON.stringify(t,null,f);g.push({path:c,updated:m!==h,newTranslations:t,existingTranslations:u})}else{const a=new Set(p.keys()),c=r.getOutputPath(o.extract.output,s,"*"),u=await t.glob(c,{ignore:y});for(const t of u)a.add(e.basename(t,e.extname(t)));for(const t of a){const a=p.get(t)||[],c=r.getOutputPath(o.extract.output,s,t),u=e.resolve(process.cwd(),c),y=await r.loadTranslationFile(u)||{},h=l(a,y,o,s,t,d,n,i),m=JSON.stringify(y,null,f),x=JSON.stringify(h,null,f);g.push({path:u,updated:x!==m,newTranslations:h,existingTranslations:y})}}}return g};
|
|
1
|
+
"use strict";var e=require("node:path"),t=require("glob"),s=require("../../utils/nested-object.js"),r=require("../../utils/file-utils.js"),n=require("../../utils/default-value.js");function a(e){const t=`^${e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`;return new RegExp(t)}function o(e,t){if("object"!=typeof e||null===e||Array.isArray(e))return e;const s={},r=t?.extract?.pluralSeparator??"_",n=["zero","one","two","few","many","other"],a=n.map(e=>`ordinal${r}${e}`),l=Object.keys(e).sort((e,t)=>{const s=e=>{for(const t of a)if(e.endsWith(`${r}${t}`)){return{base:e.slice(0,-(r.length+t.length)),form:t,isOrdinal:!0,isPlural:!0,fullKey:e}}for(const t of n)if(e.endsWith(`${r}${t}`)){return{base:e.slice(0,-(r.length+t.length)),form:t,isOrdinal:!1,isPlural:!0,fullKey:e}}return{base:e,form:"",isOrdinal:!1,isPlural:!1,fullKey:e}},o=s(e),l=s(t);if(o.isPlural&&l.isPlural){const e=o.base.localeCompare(l.base,void 0,{sensitivity:"base"});if(0!==e)return e;if(o.isOrdinal!==l.isOrdinal)return o.isOrdinal?1:-1;const t=o.isOrdinal?a:n,s=t.indexOf(o.form),r=t.indexOf(l.form);return-1!==s&&-1!==r?s-r:o.form.localeCompare(l.form)}const i=e.localeCompare(t,void 0,{sensitivity:"base"});return 0===i?e.localeCompare(t,void 0,{sensitivity:"case"}):i});for(const r of l)s[r]=o(e[r],t);return s}function l(e,t,r,a,l,i,c,u=!1){const{keySeparator:f=".",sort:d=!0,removeUnusedKeys:p=!0,primaryLanguage:g,defaultValue:y="",pluralSeparator:h="_",contextSeparator:m="_"}=r.extract,x=new Set;try{const e=new Intl.PluralRules(a,{type:"cardinal"}),t=new Intl.PluralRules(a,{type:"ordinal"});e.resolvedOptions().pluralCategories.forEach(e=>x.add(e)),t.resolvedOptions().pluralCategories.forEach(e=>x.add(`ordinal_${e}`))}catch(e){const t=new Intl.PluralRules(g||"en",{type:"cardinal"}),s=new Intl.PluralRules(g||"en",{type:"ordinal"});t.resolvedOptions().pluralCategories.forEach(e=>x.add(e)),s.resolvedOptions().pluralCategories.forEach(e=>x.add(`ordinal_${e}`))}const O=e.filter(({key:e,hasCount:t,isOrdinal:s})=>{if(i.some(t=>t.test(e)))return!1;if(!t)return!0;const r=e.split(h);if(s&&r.includes("ordinal")){const e=r[r.length-1];return x.has(`ordinal_${e}`)}if(t){const e=r[r.length-1];return x.has(e)}return!0});let v=p?{}:JSON.parse(JSON.stringify(t));const w=s.getNestedKeys(t,f??".");for(const e of w)if(i.some(t=>t.test(e))){const r=s.getNestedValue(t,e,f??".");s.setNestedValue(v,e,r,f??".")}if(p){const e=s.getNestedKeys(t,f??".");for(const r of e){const e=r.split(h);if("zero"===e[e.length-1]){const n=e.slice(0,-1).join(h);if(O.some(({key:e})=>e.split(h).slice(0,-1).join(h)===n)){const e=s.getNestedValue(t,r,f??".");s.setNestedValue(v,r,e,f??".")}}}}for(const{key:e,defaultValue:r,explicitDefault:o}of O){const i=s.getNestedValue(t,e,f??"."),d=!O.some(t=>t.key.startsWith(`${e}${f}`)&&t.key!==e),p="object"==typeof i&&null!==i&&(c.has(e)||!r||r===e),x="object"==typeof i&&null!==i&&d&&!c.has(e)&&!p;if(p){s.setNestedValue(v,e,i,f??".");continue}let w;if(void 0===i||x)if(a===g)if(u){const t=r&&(r===e||e!==r&&(e.startsWith(r+h)||e.startsWith(r+m)));w=r&&!t?r:n.resolveDefaultValue(y,e,l,a,r)}else w=r||e;else w=n.resolveDefaultValue(y,e,l,a,r);else if(a===g&&u){const t=r&&(r===e||e!==r&&(e.startsWith(r+h)||e.startsWith(r+m)));w=(e.includes(h)||e.includes(m))&&!o?i:r&&!t?r:i}else w=i;s.setNestedValue(v,e,w,f??".")}if(!0===d)return o(v,r);if("function"==typeof d){const e={},t=Object.keys(v),s=new Map;for(const e of O){const t=!1===f?e.key:e.key.split(f)[0];s.has(t)||s.set(t,e)}t.sort((e,t)=>{if("function"==typeof d){const r=s.get(e),n=s.get(t);if(r&&n)return d(r,n)}return e.localeCompare(t,void 0,{sensitivity:"base"})});for(const s of t)e[s]=o(v[s],r);v=e}return v}exports.getTranslations=async function(s,n,o,{syncPrimaryWithDefaults:i=!1}={}){o.extract.primaryLanguage||=o.locales[0]||"en",o.extract.secondaryLanguages||=o.locales.filter(e=>e!==o?.extract?.primaryLanguage);const c=o.extract.defaultNS??"translation",u=[...o.extract.preservePatterns||[]],f=o.extract.indentation??2;for(const e of n)u.push(`${e}.*`);const d=u.map(a),p=new Map;for(const e of s.values()){const t=e.ns||c;p.has(t)||p.set(t,[]),p.get(t).push(e)}const g=[],y=Array.isArray(o.extract.ignore)?o.extract.ignore:o.extract.ignore?[o.extract.ignore]:[];for(const s of o.locales){if(o.extract.mergeNamespaces||!o.extract.output.includes("{{namespace}}")){const t={},a=r.getOutputPath(o.extract.output,s),c=e.resolve(process.cwd(),a),u=await r.loadTranslationFile(c)||{},y=new Set([...p.keys(),...Object.keys(u)]);for(const e of y){const r=p.get(e)||[],a=u[e]||{};t[e]=l(r,a,o,s,e,d,n,i)}const h=JSON.stringify(u,null,f),m=JSON.stringify(t,null,f);g.push({path:c,updated:m!==h,newTranslations:t,existingTranslations:u})}else{const a=new Set(p.keys()),c=r.getOutputPath(o.extract.output,s,"*"),u=await t.glob(c,{ignore:y});for(const t of u)a.add(e.basename(t,e.extname(t)));for(const t of a){const a=p.get(t)||[],c=r.getOutputPath(o.extract.output,s,t),u=e.resolve(process.cwd(),c),y=await r.loadTranslationFile(u)||{},h=l(a,y,o,s,t,d,n,i),m=JSON.stringify(y,null,f),x=JSON.stringify(h,null,f);g.push({path:u,updated:x!==m,newTranslations:h,existingTranslations:y})}}}return g};
|
package/dist/cjs/syncer.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("
|
|
1
|
+
"use strict";var e=require("chalk"),t=require("glob"),o=require("node:fs/promises"),n=require("node:path"),r=require("ora"),a=require("./utils/default-value.js"),l=require("./utils/file-utils.js"),i=require("./utils/funnel-msg-tracker.js"),s=require("./utils/nested-object.js");exports.runSyncer=async function(c){const u=r("Running i18next locale synchronizer...\n").start();try{const r=c.extract.primaryLanguage||c.locales[0]||"en",d=c.locales.filter(e=>e!==r),{output:f,keySeparator:y=".",outputFormat:g="json",indentation:h=2,defaultValue:p=""}=c.extract,w=[];let m=!1;const S=l.getOutputPath(f,r,"*"),q=await t.glob(S);if(0===q.length)return void u.warn(`No translation files found for primary language "${r}". Nothing to sync.`);for(const t of q){const r=n.basename(t).split(".")[0],i=await l.loadTranslationFile(t);if(!i){w.push(` ${e.yellow("-")} Could not read primary file: ${t}`);continue}const c=s.getNestedKeys(i,y??".");for(const t of d){const u=l.getOutputPath(f,t,r),d=n.resolve(process.cwd(),u),S=await l.loadTranslationFile(d)||{},q={};for(const e of c){const o=s.getNestedValue(i,e,y??"."),n=s.getNestedValue(S,e,y??".")??a.resolveDefaultValue(p,e,r,t,o);s.setNestedValue(q,e,n,y??".")}const b=JSON.stringify(S);if(JSON.stringify(q)!==b){m=!0;const t=l.serializeTranslationFile(q,g,h);await o.mkdir(n.dirname(d),{recursive:!0}),await o.writeFile(d,t),w.push(` ${e.green("✓")} Synchronized: ${u}`)}else w.push(` ${e.gray("-")} Already in sync: ${u}`)}}u.succeed(e.bold("Synchronization complete!")),w.forEach(e=>console.log(e)),m?await async function(){if(!await i.shouldShowFunnel("syncer"))return;return console.log(e.green.bold("\n✅ Sync complete.")),console.log(e.yellow("🚀 Ready to collaborate with translators? Move your files to the cloud.")),console.log(` Get started with the official TMS for i18next: ${e.cyan("npx i18next-cli locize-migrate")}`),i.recordFunnelShown("syncer")}():console.log(e.green.bold("\n✅ All locales are already in sync."))}catch(t){u.fail(e.red("Synchronization failed.")),console.error(t)}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.resolveDefaultValue=function(t,e,r,u){if("function"==typeof t)try{return t(e,r,u)}catch(t){return""}return t||""};
|
|
1
|
+
"use strict";exports.resolveDefaultValue=function(t,e,r,u,n){if("function"==typeof t)try{return t(e,r,u,n||e)}catch(t){return""}return t||""};
|
package/dist/esm/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{Command as t}from"commander";import e from"chokidar";import{glob as o}from"glob";import{minimatch as n}from"minimatch";import i from"chalk";import{ensureConfig as a,loadConfig as r}from"./config.js";import{detectConfig as c}from"./heuristic-config.js";import{runExtractor as s}from"./extractor/core/extractor.js";import"node:path";import"node:fs/promises";import"jiti";import{runTypesGenerator as l}from"./types-generator.js";import{runSyncer as p}from"./syncer.js";import{runMigrator as m}from"./migrator.js";import{runInit as d}from"./init.js";import{runLinter as f}from"./linter.js";import{runStatus as u}from"./status.js";import{runLocizeSync as g,runLocizeDownload as y,runLocizeMigrate as h}from"./locize.js";const w=new t;w.name("i18next-cli").description("A unified, high-performance i18next CLI.").version("1.
|
|
2
|
+
import{Command as t}from"commander";import e from"chokidar";import{glob as o}from"glob";import{minimatch as n}from"minimatch";import i from"chalk";import{ensureConfig as a,loadConfig as r}from"./config.js";import{detectConfig as c}from"./heuristic-config.js";import{runExtractor as s}from"./extractor/core/extractor.js";import"node:path";import"node:fs/promises";import"jiti";import{runTypesGenerator as l}from"./types-generator.js";import{runSyncer as p}from"./syncer.js";import{runMigrator as m}from"./migrator.js";import{runInit as d}from"./init.js";import{runLinter as f}from"./linter.js";import{runStatus as u}from"./status.js";import{runLocizeSync as g,runLocizeDownload as y,runLocizeMigrate as h}from"./locize.js";const w=new t;w.name("i18next-cli").description("A unified, high-performance i18next CLI.").version("1.12.0"),w.command("extract").description("Extract translation keys from source files and update resource files.").option("-w, --watch","Watch for file changes and re-run the extractor.").option("--ci","Exit with a non-zero status code if any files are updated.").option("--dry-run","Run the extractor without writing any files to disk.").option("--sync-primary","Sync primary language values with default values from code.").action(async t=>{try{const o=await a(),i=async()=>{const e=await s(o,{isWatchMode:!!t.watch,isDryRun:!!t.dryRun,syncPrimaryWithDefaults:!!t.syncPrimary});return t.ci&&!e?(console.log("✅ No files were updated."),process.exit(0)):t.ci&&e&&(console.error("❌ Some files were updated. This should not happen in CI mode."),process.exit(1)),e};if(await i(),t.watch){console.log("\nWatching for changes...");const t=await z(o.extract.input),a=x(o.extract.ignore),r=j(o.extract.output),c=[...a,...r].filter(Boolean),s=t.filter(t=>!c.some(e=>n(t,e,{dot:!0})));e.watch(s,{ignored:/node_modules/,persistent:!0}).on("change",t=>{console.log(`\nFile changed: ${t}`),i()})}}catch(t){console.error("Error running extractor:",t),process.exit(1)}}),w.command("status [locale]").description("Display translation status. Provide a locale for a detailed key-by-key view.").option("-n, --namespace <ns>","Filter the status report by a specific namespace").action(async(t,e)=>{let o=await r();if(!o){console.log(i.blue("No config file found. Attempting to detect project structure..."));const t=await c();t||(console.error(i.red("Could not automatically detect your project structure.")),console.log(`Please create a config file first by running: ${i.cyan("npx i18next-cli init")}`),process.exit(1)),console.log(i.green("Project structure detected successfully!")),o=t}await u(o,{detail:t,namespace:e.namespace})}),w.command("types").description("Generate TypeScript definitions from translation resource files.").option("-w, --watch","Watch for file changes and re-run the type generator.").action(async t=>{const o=await a(),i=()=>l(o);if(await i(),t.watch){console.log("\nWatching for changes...");const t=await z(o.types?.input||[]),a=[...x(o.extract?.ignore)].filter(Boolean),r=t.filter(t=>!a.some(e=>n(t,e,{dot:!0})));e.watch(r,{persistent:!0}).on("change",t=>{console.log(`\nFile changed: ${t}`),i()})}}),w.command("sync").description("Synchronize secondary language files with the primary language file.").action(async()=>{const t=await a();await p(t)}),w.command("migrate-config [configPath]").description("Migrate a legacy i18next-parser.config.js to the new format.").action(async t=>{await m(t)}),w.command("init").description("Create a new i18next.config.ts/js file with an interactive setup wizard.").action(d),w.command("lint").description("Find potential issues like hardcoded strings in your codebase.").option("-w, --watch","Watch for file changes and re-run the linter.").action(async t=>{const o=async()=>{let t=await r();if(!t){console.log(i.blue("No config file found. Attempting to detect project structure..."));const e=await c();e||(console.error(i.red("Could not automatically detect your project structure.")),console.log(`Please create a config file first by running: ${i.cyan("npx i18next-cli init")}`),process.exit(1)),console.log(i.green("Project structure detected successfully!")),t=e}await f(t)};if(await o(),t.watch){console.log("\nWatching for changes...");const t=await r();if(t?.extract?.input){const i=await z(t.extract.input),a=[...x(t.extract.ignore),...j(t.extract.output)].filter(Boolean),r=i.filter(t=>!a.some(e=>n(t,e,{dot:!0})));e.watch(r,{ignored:/node_modules/,persistent:!0}).on("change",t=>{console.log(`\nFile changed: ${t}`),o()})}}}),w.command("locize-sync").description("Synchronize local translations with your locize project.").option("--update-values","Update values of existing translations on locize.").option("--src-lng-only","Check for changes in source language only.").option("--compare-mtime","Compare modification times when syncing.").option("--dry-run","Run the command without making any changes.").action(async t=>{const e=await a();await g(e,t)}),w.command("locize-download").description("Download all translations from your locize project.").action(async t=>{const e=await a();await y(e,t)}),w.command("locize-migrate").description("Migrate local translation files to a new locize project.").action(async t=>{const e=await a();await h(e,t)}),w.parse(process.argv);const x=t=>Array.isArray(t)?t:t?[t]:[],j=t=>t&&"string"==typeof t?[t.replace(/\{\{[^}]+\}\}/g,"*")]:[],z=async(t=[])=>{const e=x(t),n=await Promise.all(e.map(t=>o(t||"",{nodir:!0})));return Array.from(new Set(n.flat()))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolve as t,basename as e,extname as r}from"node:path";import{glob as s}from"glob";import{getNestedKeys as n,getNestedValue as o,setNestedValue as a}from"../../utils/nested-object.js";import{getOutputPath as i,loadTranslationFile as l}from"../../utils/file-utils.js";import{resolveDefaultValue as c}from"../../utils/default-value.js";function f(t){const e=`^${t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`;return new RegExp(e)}function u(t,e){if("object"!=typeof t||null===t||Array.isArray(t))return t;const r={},s=e?.extract?.pluralSeparator??"_",n=["zero","one","two","few","many","other"],o=n.map(t=>`ordinal${s}${t}`),a=Object.keys(t).sort((t,e)=>{const r=t=>{for(const e of o)if(t.endsWith(`${s}${e}`)){return{base:t.slice(0,-(s.length+e.length)),form:e,isOrdinal:!0,isPlural:!0,fullKey:t}}for(const e of n)if(t.endsWith(`${s}${e}`)){return{base:t.slice(0,-(s.length+e.length)),form:e,isOrdinal:!1,isPlural:!0,fullKey:t}}return{base:t,form:"",isOrdinal:!1,isPlural:!1,fullKey:t}},a=r(t),i=r(e);if(a.isPlural&&i.isPlural){const t=a.base.localeCompare(i.base,void 0,{sensitivity:"base"});if(0!==t)return t;if(a.isOrdinal!==i.isOrdinal)return a.isOrdinal?1:-1;const e=a.isOrdinal?o:n,r=e.indexOf(a.form),s=e.indexOf(i.form);return-1!==r&&-1!==s?r-s:a.form.localeCompare(i.form)}const l=t.localeCompare(e,void 0,{sensitivity:"base"});return 0===l?t.localeCompare(e,void 0,{sensitivity:"case"}):l});for(const s of a)r[s]=u(t[s],e);return r}function p(t,e,r,s,i,l,f,p=!1){const{keySeparator:d=".",sort:y=!0,removeUnusedKeys:g=!0,primaryLanguage:m,defaultValue:h="",pluralSeparator:x="_",contextSeparator:O="_"}=r.extract,w=new Set;try{const t=new Intl.PluralRules(s,{type:"cardinal"}),e=new Intl.PluralRules(s,{type:"ordinal"});t.resolvedOptions().pluralCategories.forEach(t=>w.add(t)),e.resolvedOptions().pluralCategories.forEach(t=>w.add(`ordinal_${t}`))}catch(t){const e=new Intl.PluralRules(m||"en",{type:"cardinal"}),r=new Intl.PluralRules(m||"en",{type:"ordinal"});e.resolvedOptions().pluralCategories.forEach(t=>w.add(t)),r.resolvedOptions().pluralCategories.forEach(t=>w.add(`ordinal_${t}`))}const v=t.filter(({key:t,hasCount:e,isOrdinal:r})=>{if(l.some(e=>e.test(t)))return!1;if(!e)return!0;const s=t.split(x);if(r&&s.includes("ordinal")){const t=s[s.length-1];return w.has(`ordinal_${t}`)}if(e){const t=s[s.length-1];return w.has(t)}return!0});let b=g?{}:JSON.parse(JSON.stringify(e));const $=n(e,d??".");for(const t of $)if(l.some(e=>e.test(t))){const r=o(e,t,d??".");a(b,t,r,d??".")}if(g){const t=n(e,d??".");for(const r of t){const t=r.split(x);if("zero"===t[t.length-1]){const s=t.slice(0,-1).join(x);if(v.some(({key:t})=>t.split(x).slice(0,-1).join(x)===s)){const t=o(e,r,d??".");a(b,r,t,d??".")}}}}for(const{key:t,defaultValue:r,explicitDefault:n}of v){const l=o(e,t,d??"."),u=!v.some(e=>e.key.startsWith(`${t}${d}`)&&e.key!==t),y="object"==typeof l&&null!==l&&(f.has(t)||!r||r===t),g="object"==typeof l&&null!==l&&u&&!f.has(t)&&!y;if(y){a(b,t,l,d??".");continue}let w;if(void 0===l||g)if(s===m)if(p){const e=r&&(r===t||t!==r&&(t.startsWith(r+x)||t.startsWith(r+O)));w=r&&!e?r:c(h,t,i,s)}else w=r||t;else w=c(h,t,i,s);else if(s===m&&p){const e=r&&(r===t||t!==r&&(t.startsWith(r+x)||t.startsWith(r+O)));w=(t.includes(x)||t.includes(O))&&!n?l:r&&!e?r:l}else w=l;a(b,t,w,d??".")}if(!0===y)return u(b,r);if("function"==typeof y){const t={},e=Object.keys(b),s=new Map;for(const t of v){const e=!1===d?t.key:t.key.split(d)[0];s.has(e)||s.set(e,t)}e.sort((t,e)=>{if("function"==typeof y){const r=s.get(t),n=s.get(e);if(r&&n)return y(r,n)}return t.localeCompare(e,void 0,{sensitivity:"base"})});for(const s of e)t[s]=u(b[s],r);b=t}return b}async function d(n,o,a,{syncPrimaryWithDefaults:c=!1}={}){a.extract.primaryLanguage||=a.locales[0]||"en",a.extract.secondaryLanguages||=a.locales.filter(t=>t!==a?.extract?.primaryLanguage);const u=a.extract.defaultNS??"translation",d=[...a.extract.preservePatterns||[]],y=a.extract.indentation??2;for(const t of o)d.push(`${t}.*`);const g=d.map(f),m=new Map;for(const t of n.values()){const e=t.ns||u;m.has(e)||m.set(e,[]),m.get(e).push(t)}const h=[],x=Array.isArray(a.extract.ignore)?a.extract.ignore:a.extract.ignore?[a.extract.ignore]:[];for(const n of a.locales){if(a.extract.mergeNamespaces||!a.extract.output.includes("{{namespace}}")){const e={},r=i(a.extract.output,n),s=t(process.cwd(),r),f=await l(s)||{},u=new Set([...m.keys(),...Object.keys(f)]);for(const t of u){const r=m.get(t)||[],s=f[t]||{};e[t]=p(r,s,a,n,t,g,o,c)}const d=JSON.stringify(f,null,y),x=JSON.stringify(e,null,y);h.push({path:s,updated:x!==d,newTranslations:e,existingTranslations:f})}else{const f=new Set(m.keys()),u=i(a.extract.output,n,"*"),d=await s(u,{ignore:x});for(const t of d)f.add(e(t,r(t)));for(const e of f){const r=m.get(e)||[],s=i(a.extract.output,n,e),f=t(process.cwd(),s),u=await l(f)||{},d=p(r,u,a,n,e,g,o,c),x=JSON.stringify(u,null,y),O=JSON.stringify(d,null,y);h.push({path:f,updated:O!==x,newTranslations:d,existingTranslations:u})}}}return h}export{d as getTranslations};
|
|
1
|
+
import{resolve as t,basename as e,extname as r}from"node:path";import{glob as s}from"glob";import{getNestedKeys as n,getNestedValue as o,setNestedValue as a}from"../../utils/nested-object.js";import{getOutputPath as i,loadTranslationFile as l}from"../../utils/file-utils.js";import{resolveDefaultValue as c}from"../../utils/default-value.js";function f(t){const e=`^${t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`;return new RegExp(e)}function u(t,e){if("object"!=typeof t||null===t||Array.isArray(t))return t;const r={},s=e?.extract?.pluralSeparator??"_",n=["zero","one","two","few","many","other"],o=n.map(t=>`ordinal${s}${t}`),a=Object.keys(t).sort((t,e)=>{const r=t=>{for(const e of o)if(t.endsWith(`${s}${e}`)){return{base:t.slice(0,-(s.length+e.length)),form:e,isOrdinal:!0,isPlural:!0,fullKey:t}}for(const e of n)if(t.endsWith(`${s}${e}`)){return{base:t.slice(0,-(s.length+e.length)),form:e,isOrdinal:!1,isPlural:!0,fullKey:t}}return{base:t,form:"",isOrdinal:!1,isPlural:!1,fullKey:t}},a=r(t),i=r(e);if(a.isPlural&&i.isPlural){const t=a.base.localeCompare(i.base,void 0,{sensitivity:"base"});if(0!==t)return t;if(a.isOrdinal!==i.isOrdinal)return a.isOrdinal?1:-1;const e=a.isOrdinal?o:n,r=e.indexOf(a.form),s=e.indexOf(i.form);return-1!==r&&-1!==s?r-s:a.form.localeCompare(i.form)}const l=t.localeCompare(e,void 0,{sensitivity:"base"});return 0===l?t.localeCompare(e,void 0,{sensitivity:"case"}):l});for(const s of a)r[s]=u(t[s],e);return r}function p(t,e,r,s,i,l,f,p=!1){const{keySeparator:d=".",sort:y=!0,removeUnusedKeys:g=!0,primaryLanguage:m,defaultValue:h="",pluralSeparator:x="_",contextSeparator:O="_"}=r.extract,w=new Set;try{const t=new Intl.PluralRules(s,{type:"cardinal"}),e=new Intl.PluralRules(s,{type:"ordinal"});t.resolvedOptions().pluralCategories.forEach(t=>w.add(t)),e.resolvedOptions().pluralCategories.forEach(t=>w.add(`ordinal_${t}`))}catch(t){const e=new Intl.PluralRules(m||"en",{type:"cardinal"}),r=new Intl.PluralRules(m||"en",{type:"ordinal"});e.resolvedOptions().pluralCategories.forEach(t=>w.add(t)),r.resolvedOptions().pluralCategories.forEach(t=>w.add(`ordinal_${t}`))}const v=t.filter(({key:t,hasCount:e,isOrdinal:r})=>{if(l.some(e=>e.test(t)))return!1;if(!e)return!0;const s=t.split(x);if(r&&s.includes("ordinal")){const t=s[s.length-1];return w.has(`ordinal_${t}`)}if(e){const t=s[s.length-1];return w.has(t)}return!0});let b=g?{}:JSON.parse(JSON.stringify(e));const $=n(e,d??".");for(const t of $)if(l.some(e=>e.test(t))){const r=o(e,t,d??".");a(b,t,r,d??".")}if(g){const t=n(e,d??".");for(const r of t){const t=r.split(x);if("zero"===t[t.length-1]){const s=t.slice(0,-1).join(x);if(v.some(({key:t})=>t.split(x).slice(0,-1).join(x)===s)){const t=o(e,r,d??".");a(b,r,t,d??".")}}}}for(const{key:t,defaultValue:r,explicitDefault:n}of v){const l=o(e,t,d??"."),u=!v.some(e=>e.key.startsWith(`${t}${d}`)&&e.key!==t),y="object"==typeof l&&null!==l&&(f.has(t)||!r||r===t),g="object"==typeof l&&null!==l&&u&&!f.has(t)&&!y;if(y){a(b,t,l,d??".");continue}let w;if(void 0===l||g)if(s===m)if(p){const e=r&&(r===t||t!==r&&(t.startsWith(r+x)||t.startsWith(r+O)));w=r&&!e?r:c(h,t,i,s,r)}else w=r||t;else w=c(h,t,i,s,r);else if(s===m&&p){const e=r&&(r===t||t!==r&&(t.startsWith(r+x)||t.startsWith(r+O)));w=(t.includes(x)||t.includes(O))&&!n?l:r&&!e?r:l}else w=l;a(b,t,w,d??".")}if(!0===y)return u(b,r);if("function"==typeof y){const t={},e=Object.keys(b),s=new Map;for(const t of v){const e=!1===d?t.key:t.key.split(d)[0];s.has(e)||s.set(e,t)}e.sort((t,e)=>{if("function"==typeof y){const r=s.get(t),n=s.get(e);if(r&&n)return y(r,n)}return t.localeCompare(e,void 0,{sensitivity:"base"})});for(const s of e)t[s]=u(b[s],r);b=t}return b}async function d(n,o,a,{syncPrimaryWithDefaults:c=!1}={}){a.extract.primaryLanguage||=a.locales[0]||"en",a.extract.secondaryLanguages||=a.locales.filter(t=>t!==a?.extract?.primaryLanguage);const u=a.extract.defaultNS??"translation",d=[...a.extract.preservePatterns||[]],y=a.extract.indentation??2;for(const t of o)d.push(`${t}.*`);const g=d.map(f),m=new Map;for(const t of n.values()){const e=t.ns||u;m.has(e)||m.set(e,[]),m.get(e).push(t)}const h=[],x=Array.isArray(a.extract.ignore)?a.extract.ignore:a.extract.ignore?[a.extract.ignore]:[];for(const n of a.locales){if(a.extract.mergeNamespaces||!a.extract.output.includes("{{namespace}}")){const e={},r=i(a.extract.output,n),s=t(process.cwd(),r),f=await l(s)||{},u=new Set([...m.keys(),...Object.keys(f)]);for(const t of u){const r=m.get(t)||[],s=f[t]||{};e[t]=p(r,s,a,n,t,g,o,c)}const d=JSON.stringify(f,null,y),x=JSON.stringify(e,null,y);h.push({path:s,updated:x!==d,newTranslations:e,existingTranslations:f})}else{const f=new Set(m.keys()),u=i(a.extract.output,n,"*"),d=await s(u,{ignore:x});for(const t of d)f.add(e(t,r(t)));for(const e of f){const r=m.get(e)||[],s=i(a.extract.output,n,e),f=t(process.cwd(),s),u=await l(f)||{},d=p(r,u,a,n,e,g,o,c),x=JSON.stringify(u,null,y),O=JSON.stringify(d,null,y);h.push({path:f,updated:O!==x,newTranslations:d,existingTranslations:u})}}}return h}export{d as getTranslations};
|
package/dist/esm/syncer.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mkdir as
|
|
1
|
+
import o from"chalk";import{glob as t}from"glob";import{mkdir as e,writeFile as n}from"node:fs/promises";import{basename as r,resolve as i,dirname as a}from"node:path";import l from"ora";import{resolveDefaultValue as s}from"./utils/default-value.js";import{getOutputPath as c,loadTranslationFile as f,serializeTranslationFile as u}from"./utils/file-utils.js";import{shouldShowFunnel as m,recordFunnelShown as y}from"./utils/funnel-msg-tracker.js";import{getNestedKeys as p,getNestedValue as d,setNestedValue as g}from"./utils/nested-object.js";async function h(h){const w=l("Running i18next locale synchronizer...\n").start();try{const l=h.extract.primaryLanguage||h.locales[0]||"en",S=h.locales.filter(o=>o!==l),{output:$,keySeparator:x=".",outputFormat:b="json",indentation:j=2,defaultValue:z=""}=h.extract,v=[];let N=!1;const k=c($,l,"*"),A=await t(k);if(0===A.length)return void w.warn(`No translation files found for primary language "${l}". Nothing to sync.`);for(const t of A){const l=r(t).split(".")[0],m=await f(t);if(!m){v.push(` ${o.yellow("-")} Could not read primary file: ${t}`);continue}const y=p(m,x??".");for(const t of S){const r=c($,t,l),p=i(process.cwd(),r),h=await f(p)||{},w={};for(const o of y){const e=d(m,o,x??"."),n=d(h,o,x??".")??s(z,o,l,t,e);g(w,o,n,x??".")}const S=JSON.stringify(h);if(JSON.stringify(w)!==S){N=!0;const t=u(w,b,j);await e(a(p),{recursive:!0}),await n(p,t),v.push(` ${o.green("✓")} Synchronized: ${r}`)}else v.push(` ${o.gray("-")} Already in sync: ${r}`)}}w.succeed(o.bold("Synchronization complete!")),v.forEach(o=>console.log(o)),N?await async function(){if(!await m("syncer"))return;return console.log(o.green.bold("\n✅ Sync complete.")),console.log(o.yellow("🚀 Ready to collaborate with translators? Move your files to the cloud.")),console.log(` Get started with the official TMS for i18next: ${o.cyan("npx i18next-cli locize-migrate")}`),y("syncer")}():console.log(o.green.bold("\n✅ All locales are already in sync."))}catch(t){w.fail(o.red("Synchronization failed.")),console.error(t)}}export{h as runSyncer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function t(t,r,n,e){if("function"==typeof t)try{return t(r,n,e)}catch(t){return""}return t||""}export{t as resolveDefaultValue};
|
|
1
|
+
function t(t,r,n,e,u){if("function"==typeof t)try{return t(r,n,e,u||r)}catch(t){return""}return t||""}export{t as resolveDefaultValue};
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -243,14 +243,14 @@ function buildNewTranslationsForNs (
|
|
|
243
243
|
key.startsWith(defaultValue + contextSeparator)))
|
|
244
244
|
)
|
|
245
245
|
|
|
246
|
-
valueToSet = (defaultValue && !isDerivedDefault) ? defaultValue : resolveDefaultValue(emptyDefaultValue, key, namespace, locale)
|
|
246
|
+
valueToSet = (defaultValue && !isDerivedDefault) ? defaultValue : resolveDefaultValue(emptyDefaultValue, key, namespace, locale, defaultValue)
|
|
247
247
|
} else {
|
|
248
248
|
// syncPrimaryWithDefaults is false - use original behavior
|
|
249
249
|
valueToSet = defaultValue || key
|
|
250
250
|
}
|
|
251
251
|
} else {
|
|
252
252
|
// For secondary languages, always use empty string
|
|
253
|
-
valueToSet = resolveDefaultValue(emptyDefaultValue, key, namespace, locale)
|
|
253
|
+
valueToSet = resolveDefaultValue(emptyDefaultValue, key, namespace, locale, defaultValue)
|
|
254
254
|
}
|
|
255
255
|
} else {
|
|
256
256
|
// Existing value exists - decide whether to preserve or sync
|
package/src/syncer.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { writeFile, mkdir } from 'node:fs/promises'
|
|
2
|
-
import { resolve, dirname, basename } from 'node:path'
|
|
3
1
|
import chalk from 'chalk'
|
|
4
|
-
import ora from 'ora'
|
|
5
2
|
import { glob } from 'glob'
|
|
3
|
+
import { mkdir, writeFile } from 'node:fs/promises'
|
|
4
|
+
import { basename, dirname, resolve } from 'node:path'
|
|
5
|
+
import ora from 'ora'
|
|
6
6
|
import type { I18nextToolkitConfig } from './types'
|
|
7
|
-
import { getNestedKeys, getNestedValue, setNestedValue } from './utils/nested-object'
|
|
8
|
-
import { getOutputPath, loadTranslationFile, serializeTranslationFile } from './utils/file-utils'
|
|
9
|
-
import { shouldShowFunnel, recordFunnelShown } from './utils/funnel-msg-tracker'
|
|
10
7
|
import { resolveDefaultValue } from './utils/default-value'
|
|
8
|
+
import { getOutputPath, loadTranslationFile, serializeTranslationFile } from './utils/file-utils'
|
|
9
|
+
import { recordFunnelShown, shouldShowFunnel } from './utils/funnel-msg-tracker'
|
|
10
|
+
import { getNestedKeys, getNestedValue, setNestedValue } from './utils/nested-object'
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Synchronizes translation files across different locales by ensuring all secondary
|
|
@@ -84,10 +84,11 @@ export async function runSyncer (config: I18nextToolkitConfig) {
|
|
|
84
84
|
const newSecondaryTranslations: Record<string, any> = {}
|
|
85
85
|
|
|
86
86
|
for (const key of primaryKeys) {
|
|
87
|
+
const primaryValue = getNestedValue(primaryTranslations, key, keySeparator ?? '.')
|
|
87
88
|
const existingValue = getNestedValue(existingSecondaryTranslations, key, keySeparator ?? '.')
|
|
88
89
|
|
|
89
90
|
// Use the resolved default value if no existing value
|
|
90
|
-
const valueToSet = existingValue ?? resolveDefaultValue(defaultValue, key, ns, lang)
|
|
91
|
+
const valueToSet = existingValue ?? resolveDefaultValue(defaultValue, key, ns, lang, primaryValue)
|
|
91
92
|
setNestedValue(newSecondaryTranslations, key, valueToSet, keySeparator ?? '.')
|
|
92
93
|
}
|
|
93
94
|
|
package/src/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Expression, Node, ObjectExpression } from '@swc/core'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Main configuration interface for the i18next toolkit.
|
|
@@ -88,7 +88,7 @@ export interface I18nextToolkitConfig {
|
|
|
88
88
|
indentation?: number | string;
|
|
89
89
|
|
|
90
90
|
/** Default value to use for missing translations in secondary languages */
|
|
91
|
-
defaultValue?: string | ((key: string, namespace: string, language: string) => string);
|
|
91
|
+
defaultValue?: string | ((key: string, namespace: string, language: string, value: string) => string);
|
|
92
92
|
|
|
93
93
|
/** Primary language that provides default values (default: first locale) */
|
|
94
94
|
primaryLanguage?: string;
|
|
@@ -11,29 +11,30 @@
|
|
|
11
11
|
* @example
|
|
12
12
|
* ```typescript
|
|
13
13
|
* // String-based default value
|
|
14
|
-
* const result1 = resolveDefaultValue('[MISSING]', 'user.name', 'common', 'de')
|
|
14
|
+
* const result1 = resolveDefaultValue('[MISSING]', 'user.name', 'common', 'de', 'Alice')
|
|
15
15
|
* // Returns: '[MISSING]'
|
|
16
16
|
*
|
|
17
17
|
* // Function-based default value
|
|
18
18
|
* const defaultValueFn = (key, ns, lang) => `${lang.toUpperCase()}_${ns}_${key}`
|
|
19
|
-
* const result2 = resolveDefaultValue(defaultValueFn, 'user.name', 'common', 'de')
|
|
20
|
-
* // Returns: 'DE_common_user.
|
|
19
|
+
* const result2 = resolveDefaultValue(defaultValueFn, 'user.name', 'common', 'de', 'Alice')
|
|
20
|
+
* // Returns: 'DE_common_user.name_Alice'
|
|
21
21
|
*
|
|
22
22
|
* // Error handling - function throws
|
|
23
23
|
* const errorFn = () => { throw new Error('Oops') }
|
|
24
|
-
* const result3 = resolveDefaultValue(errorFn, 'user.name', 'common', 'de')
|
|
24
|
+
* const result3 = resolveDefaultValue(errorFn, 'user.name', 'common', 'de', 'Alice')
|
|
25
25
|
* // Returns: '' (fallback to empty string)
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
28
|
export function resolveDefaultValue (
|
|
29
|
-
defaultValue: string | ((key: string, namespace: string, language: string) => string) | undefined,
|
|
29
|
+
defaultValue: string | ((key: string, namespace: string, language: string, value: string) => string) | undefined,
|
|
30
30
|
key: string,
|
|
31
31
|
namespace: string,
|
|
32
|
-
language: string
|
|
32
|
+
language: string,
|
|
33
|
+
value?: string
|
|
33
34
|
): string {
|
|
34
35
|
if (typeof defaultValue === 'function') {
|
|
35
36
|
try {
|
|
36
|
-
return defaultValue(key, namespace, language)
|
|
37
|
+
return defaultValue(key, namespace, language, value || key)
|
|
37
38
|
} catch (error) {
|
|
38
39
|
// If the function throws an error, fall back to empty string
|
|
39
40
|
return ''
|
package/types/syncer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syncer.d.ts","sourceRoot":"","sources":["../src/syncer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAMnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,SAAS,CAAE,MAAM,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"syncer.d.ts","sourceRoot":"","sources":["../src/syncer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAMnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,SAAS,CAAE,MAAM,EAAE,oBAAoB,iBAiF5D"}
|
package/types/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Expression, Node, ObjectExpression } from '@swc/core';
|
|
2
2
|
/**
|
|
3
3
|
* Main configuration interface for the i18next toolkit.
|
|
4
4
|
* Defines all available options for extraction, type generation, synchronization, and integrations.
|
|
@@ -69,7 +69,7 @@ export interface I18nextToolkitConfig {
|
|
|
69
69
|
/** Number of spaces for JSON indentation (default: 2) */
|
|
70
70
|
indentation?: number | string;
|
|
71
71
|
/** Default value to use for missing translations in secondary languages */
|
|
72
|
-
defaultValue?: string | ((key: string, namespace: string, language: string) => string);
|
|
72
|
+
defaultValue?: string | ((key: string, namespace: string, language: string, value: string) => string);
|
|
73
73
|
/** Primary language that provides default values (default: first locale) */
|
|
74
74
|
primaryLanguage?: string;
|
|
75
75
|
/** Secondary languages that get empty values initially */
|
package/types/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAEnE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,oBAAoB;IACnC,iEAAiE;IACjE,OAAO,EAAE,MAAM,EAAE,CAAC;IAElB,2DAA2D;IAC3D,OAAO,EAAE;QACP,oEAAoE;QACpE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAEzB,4DAA4D;QAC5D,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAE3B,mGAAmG;QACnG,MAAM,EAAE,MAAM,CAAC;QAEf,wEAAwE;QACxE,SAAS,CAAC,EAAE,MAAM,CAAC;QAEnB,uEAAuE;QACvE,YAAY,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;QAErC,8EAA8E;QAC9E,WAAW,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;QAEpC,oDAAoD;QACpD,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAE1B,mDAAmD;QACnD,eAAe,CAAC,EAAE,MAAM,CAAC;QAEzB,+EAA+E;QAC/E,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;QAErB,4EAA4E;QAC5E,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;QAE3B;;;;;WAKG;QACH,mBAAmB,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG;YACnC,IAAI,EAAE,MAAM,CAAC;YACb,KAAK,CAAC,EAAE,MAAM,CAAC;YACf,YAAY,CAAC,EAAE,MAAM,CAAC;SACvB,CAAC,CAAC;QAEH,kFAAkF;QAClF,iBAAiB,CAAC,EAAE,MAAM,EA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A;IAEvG;;;;;;;OAOG;IACH,8BAA8B,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,kBAAkB,CAAC,EAAE,OAAO,KAAK,MAAM,EAAE,CAAA;CACpG"}
|
|
@@ -11,19 +11,19 @@
|
|
|
11
11
|
* @example
|
|
12
12
|
* ```typescript
|
|
13
13
|
* // String-based default value
|
|
14
|
-
* const result1 = resolveDefaultValue('[MISSING]', 'user.name', 'common', 'de')
|
|
14
|
+
* const result1 = resolveDefaultValue('[MISSING]', 'user.name', 'common', 'de', 'Alice')
|
|
15
15
|
* // Returns: '[MISSING]'
|
|
16
16
|
*
|
|
17
17
|
* // Function-based default value
|
|
18
18
|
* const defaultValueFn = (key, ns, lang) => `${lang.toUpperCase()}_${ns}_${key}`
|
|
19
|
-
* const result2 = resolveDefaultValue(defaultValueFn, 'user.name', 'common', 'de')
|
|
20
|
-
* // Returns: 'DE_common_user.
|
|
19
|
+
* const result2 = resolveDefaultValue(defaultValueFn, 'user.name', 'common', 'de', 'Alice')
|
|
20
|
+
* // Returns: 'DE_common_user.name_Alice'
|
|
21
21
|
*
|
|
22
22
|
* // Error handling - function throws
|
|
23
23
|
* const errorFn = () => { throw new Error('Oops') }
|
|
24
|
-
* const result3 = resolveDefaultValue(errorFn, 'user.name', 'common', 'de')
|
|
24
|
+
* const result3 = resolveDefaultValue(errorFn, 'user.name', 'common', 'de', 'Alice')
|
|
25
25
|
* // Returns: '' (fallback to empty string)
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
|
-
export declare function resolveDefaultValue(defaultValue: string | ((key: string, namespace: string, language: string) => string) | undefined, key: string, namespace: string, language: string): string;
|
|
28
|
+
export declare function resolveDefaultValue(defaultValue: string | ((key: string, namespace: string, language: string, value: string) => string) | undefined, key: string, namespace: string, language: string, value?: string): string;
|
|
29
29
|
//# sourceMappingURL=default-value.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-value.d.ts","sourceRoot":"","sources":["../../src/utils/default-value.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"default-value.d.ts","sourceRoot":"","sources":["../../src/utils/default-value.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,SAAS,EAChH,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,MAAM,GACb,MAAM,CAWR"}
|