i18next-cli 1.5.3 → 1.5.4
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/dist/cjs/cli.js +1 -1
- package/dist/cjs/extractor/core/translation-manager.js +1 -1
- package/dist/esm/cli.js +1 -1
- package/dist/esm/extractor/core/translation-manager.js +1 -1
- package/package.json +1 -1
- package/src/cli.ts +1 -1
- package/src/extractor/core/translation-manager.ts +11 -1
- package/types/extractor/core/translation-manager.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.5.4](https://github.com/i18next/i18next-cli/compare/v1.5.3...v1.5.4) - 2025-10-02
|
|
9
|
+
|
|
10
|
+
- **Extractor:** Fixed a sorting edge case where keys with identical spellings but different cases (e.g., `FOO` and `foo`) were not consistently ordered. Lowercase variants now correctly appear before uppercase variants when the spelling is identical, ensuring predictable and stable sort order across all translation files.
|
|
11
|
+
|
|
8
12
|
## [1.5.3](https://github.com/i18next/i18next-cli/compare/v1.5.2...v1.5.3) - 2025-10-02
|
|
9
13
|
|
|
10
14
|
- **Extractor:** Fixed a regression where key sorting became case-sensitive (e.g., a key like `'Zebra'` would incorrectly appear before `'apple'`). Sorting has been restored to be case-insensitive, ensuring a natural alphabetical order at all levels of the translation files.
|
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("chalk"),i=require("./config.js"),a=require("./heuristic-config.js"),r=require("./extractor/core/extractor.js");require("node:path"),require("node:fs/promises"),require("jiti");var c=require("./types-generator.js"),s=require("./syncer.js"),l=require("./migrator.js"),u=require("./init.js"),d=require("./linter.js"),g=require("./status.js"),p=require("./locize.js");const f=new e.Command;f.name("i18next-cli").description("A unified, high-performance i18next CLI.").version("1.5.
|
|
2
|
+
"use strict";var e=require("commander"),t=require("chokidar"),n=require("glob"),o=require("chalk"),i=require("./config.js"),a=require("./heuristic-config.js"),r=require("./extractor/core/extractor.js");require("node:path"),require("node:fs/promises"),require("jiti");var c=require("./types-generator.js"),s=require("./syncer.js"),l=require("./migrator.js"),u=require("./init.js"),d=require("./linter.js"),g=require("./status.js"),p=require("./locize.js");const f=new e.Command;f.name("i18next-cli").description("A unified, high-performance i18next CLI.").version("1.5.4"),f.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.").action(async e=>{const a=await i.ensureConfig(),c=async()=>{const t=await r.runExtractor(a,{isWatchMode:e.watch,isDryRun:e.dryRun});e.ci&&t&&(console.error(o.red.bold("\n[CI Mode] Error: Translation files were updated. Please commit the changes.")),console.log(o.yellow("💡 Tip: Tired of committing JSON files? locize syncs your team automatically => https://www.locize.com/docs/getting-started")),console.log(` Learn more: ${o.cyan("npx i18next-cli locize-sync")}`),process.exit(1))};if(await c(),e.watch){console.log("\nWatching for changes...");t.watch(await n.glob(a.extract.input),{ignored:/node_modules/,persistent:!0}).on("change",e=>{console.log(`\nFile changed: ${e}`),c()})}}),f.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 i.loadConfig();if(!n){console.log(o.blue("No config file found. Attempting to detect project structure..."));const e=await a.detectConfig();e||(console.error(o.red("Could not automatically detect your project structure.")),console.log(`Please create a config file first by running: ${o.cyan("npx i18next-cli init")}`),process.exit(1)),console.log(o.green("Project structure detected successfully!")),n=e}await g.runStatus(n,{detail:e,namespace:t.namespace})}),f.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 o=await i.ensureConfig(),a=()=>c.runTypesGenerator(o);if(await a(),e.watch){console.log("\nWatching for changes...");t.watch(await n.glob(o.types?.input||[]),{persistent:!0}).on("change",e=>{console.log(`\nFile changed: ${e}`),a()})}}),f.command("sync").description("Synchronize secondary language files with the primary language file.").action(async()=>{const e=await i.ensureConfig();await s.runSyncer(e)}),f.command("migrate-config").description("Migrate a legacy i18next-parser.config.js to the new format.").action(async()=>{await l.runMigrator()}),f.command("init").description("Create a new i18next.config.ts/js file with an interactive setup wizard.").action(u.runInit),f.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 r=async()=>{let e=await i.loadConfig();if(!e){console.log(o.blue("No config file found. Attempting to detect project structure..."));const t=await a.detectConfig();t||(console.error(o.red("Could not automatically detect your project structure.")),console.log(`Please create a config file first by running: ${o.cyan("npx i18next-cli init")}`),process.exit(1)),console.log(o.green("Project structure detected successfully!")),e=t}await d.runLinter(e)};if(await r(),e.watch){console.log("\nWatching for changes...");const e=await i.loadConfig();if(e?.extract?.input){t.watch(await n.glob(e.extract.input),{ignored:/node_modules/,persistent:!0}).on("change",e=>{console.log(`\nFile changed: ${e}`),r()})}}}),f.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 i.ensureConfig();await p.runLocizeSync(t,e)}),f.command("locize-download").description("Download all translations from your locize project.").action(async e=>{const t=await i.ensureConfig();await p.runLocizeDownload(t,e)}),f.command("locize-migrate").description("Migrate local translation files to a new locize project.").action(async e=>{const t=await i.ensureConfig();await p.runLocizeMigrate(t,e)}),f.parse(process.argv);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t=require("node:path"),e=require("glob"),s=require("../../utils/nested-object.js"),n=require("../../utils/file-utils.js");function o(t){const e=`^${t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`;return new RegExp(e)}function r(t){if("object"!=typeof t||null===t||Array.isArray(t))return t;const e={},s=Object.keys(t).sort((t,e)=>t.localeCompare(e,void 0,{sensitivity:"base"}));for(const n of s)e[n]=r(t[n]);return e}function a(t,e,n,o,a,
|
|
1
|
+
"use strict";var t=require("node:path"),e=require("glob"),s=require("../../utils/nested-object.js"),n=require("../../utils/file-utils.js");function o(t){const e=`^${t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`;return new RegExp(e)}function r(t){if("object"!=typeof t||null===t||Array.isArray(t))return t;const e={},s=Object.keys(t).sort((t,e)=>{const s=t.localeCompare(e,void 0,{sensitivity:"base"});return 0===s?t.localeCompare(e,void 0,{sensitivity:"case"}):s});for(const n of s)e[n]=r(t[n]);return e}function a(t,e,n,o,a,i){const{keySeparator:c=".",sort:u=!0,removeUnusedKeys:l=!0,primaryLanguage:f,defaultValue:p=""}=n.extract;let g=l?{}:JSON.parse(JSON.stringify(e));const y=s.getNestedKeys(e,c??".");for(const t of y)if(a.some(e=>e.test(t))){const n=s.getNestedValue(e,t,c??".");s.setNestedValue(g,t,n,c??".")}for(const{key:n,defaultValue:r}of t){const a=s.getNestedValue(e,n,c??"."),u=!t.some(t=>t.key.startsWith(`${n}${c}`)&&t.key!==n),l="object"==typeof a&&null!==a&&u&&!i.has(n),y=void 0===a||l?o===f?r:p:a;s.setNestedValue(g,n,y,c??".")}if(!0===u)return r(g);if("function"==typeof u){const e={},s=Object.keys(g),n=new Map;for(const e of t){const t=!1===c?e.key:e.key.split(c)[0];n.has(t)||n.set(t,e)}s.sort((t,e)=>{if("function"==typeof u){const s=n.get(t),o=n.get(e);if(s&&o)return u(s,o)}return t.localeCompare(e,void 0,{sensitivity:"base"})});for(const t of s)e[t]=g[t];g=e}return g}exports.getTranslations=async function(s,r,i){i.extract.primaryLanguage||=i.locales[0]||"en",i.extract.secondaryLanguages||=i.locales.filter(t=>t!==i?.extract?.primaryLanguage);const c=i.extract.defaultNS??"translation",u=[...i.extract.preservePatterns||[]],l=i.extract.indentation??2;for(const t of r)u.push(`${t}.*`);const f=u.map(o),p=new Map;for(const t of s.values()){const e=t.ns||c;p.has(e)||p.set(e,[]),p.get(e).push(t)}const g=[],y=Array.isArray(i.extract.ignore)?i.extract.ignore:i.extract.ignore?[i.extract.ignore]:[];for(const s of i.locales){if(i.extract.mergeNamespaces||!i.extract.output.includes("{{namespace}}")){const e={},o=n.getOutputPath(i.extract.output,s),c=t.resolve(process.cwd(),o),u=await n.loadTranslationFile(c)||{},y=new Set([...p.keys(),...Object.keys(u)]);for(const t of y){const n=p.get(t)||[],o=u[t]||{};e[t]=a(n,o,i,s,f,r)}const d=JSON.stringify(u,null,l),x=JSON.stringify(e,null,l);g.push({path:c,updated:x!==d,newTranslations:e,existingTranslations:u})}else{const o=new Set(p.keys()),c=n.getOutputPath(i.extract.output,s,"*"),u=await e.glob(c,{ignore:y});for(const e of u)o.add(t.basename(e,t.extname(e)));for(const e of o){const o=p.get(e)||[],c=n.getOutputPath(i.extract.output,s,e),u=t.resolve(process.cwd(),c),y=await n.loadTranslationFile(u)||{},d=a(o,y,i,s,f,r),x=JSON.stringify(y,null,l),m=JSON.stringify(d,null,l);g.push({path:u,updated:m!==x,newTranslations:d,existingTranslations:y})}}}return g};
|
package/dist/esm/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{Command as t}from"commander";import o from"chokidar";import{glob as e}from"glob";import n from"chalk";import{ensureConfig as i,loadConfig as a}from"./config.js";import{detectConfig as c}from"./heuristic-config.js";import{runExtractor as r}from"./extractor/core/extractor.js";import"node:path";import"node:fs/promises";import"jiti";import{runTypesGenerator as s}from"./types-generator.js";import{runSyncer as l}from"./syncer.js";import{runMigrator as m}from"./migrator.js";import{runInit as p}from"./init.js";import{runLinter as d}from"./linter.js";import{runStatus as g}from"./status.js";import{runLocizeSync as f,runLocizeDownload as u,runLocizeMigrate as h}from"./locize.js";const w=new t;w.name("i18next-cli").description("A unified, high-performance i18next CLI.").version("1.5.
|
|
2
|
+
import{Command as t}from"commander";import o from"chokidar";import{glob as e}from"glob";import n from"chalk";import{ensureConfig as i,loadConfig as a}from"./config.js";import{detectConfig as c}from"./heuristic-config.js";import{runExtractor as r}from"./extractor/core/extractor.js";import"node:path";import"node:fs/promises";import"jiti";import{runTypesGenerator as s}from"./types-generator.js";import{runSyncer as l}from"./syncer.js";import{runMigrator as m}from"./migrator.js";import{runInit as p}from"./init.js";import{runLinter as d}from"./linter.js";import{runStatus as g}from"./status.js";import{runLocizeSync as f,runLocizeDownload as u,runLocizeMigrate as h}from"./locize.js";const w=new t;w.name("i18next-cli").description("A unified, high-performance i18next CLI.").version("1.5.4"),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.").action(async t=>{const a=await i(),c=async()=>{const o=await r(a,{isWatchMode:t.watch,isDryRun:t.dryRun});t.ci&&o&&(console.error(n.red.bold("\n[CI Mode] Error: Translation files were updated. Please commit the changes.")),console.log(n.yellow("💡 Tip: Tired of committing JSON files? locize syncs your team automatically => https://www.locize.com/docs/getting-started")),console.log(` Learn more: ${n.cyan("npx i18next-cli locize-sync")}`),process.exit(1))};if(await c(),t.watch){console.log("\nWatching for changes...");o.watch(await e(a.extract.input),{ignored:/node_modules/,persistent:!0}).on("change",t=>{console.log(`\nFile changed: ${t}`),c()})}}),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,o)=>{let e=await a();if(!e){console.log(n.blue("No config file found. Attempting to detect project structure..."));const t=await c();t||(console.error(n.red("Could not automatically detect your project structure.")),console.log(`Please create a config file first by running: ${n.cyan("npx i18next-cli init")}`),process.exit(1)),console.log(n.green("Project structure detected successfully!")),e=t}await g(e,{detail:t,namespace:o.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 n=await i(),a=()=>s(n);if(await a(),t.watch){console.log("\nWatching for changes...");o.watch(await e(n.types?.input||[]),{persistent:!0}).on("change",t=>{console.log(`\nFile changed: ${t}`),a()})}}),w.command("sync").description("Synchronize secondary language files with the primary language file.").action(async()=>{const t=await i();await l(t)}),w.command("migrate-config").description("Migrate a legacy i18next-parser.config.js to the new format.").action(async()=>{await m()}),w.command("init").description("Create a new i18next.config.ts/js file with an interactive setup wizard.").action(p),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 i=async()=>{let t=await a();if(!t){console.log(n.blue("No config file found. Attempting to detect project structure..."));const o=await c();o||(console.error(n.red("Could not automatically detect your project structure.")),console.log(`Please create a config file first by running: ${n.cyan("npx i18next-cli init")}`),process.exit(1)),console.log(n.green("Project structure detected successfully!")),t=o}await d(t)};if(await i(),t.watch){console.log("\nWatching for changes...");const t=await a();if(t?.extract?.input){o.watch(await e(t.extract.input),{ignored:/node_modules/,persistent:!0}).on("change",t=>{console.log(`\nFile changed: ${t}`),i()})}}}),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 o=await i();await f(o,t)}),w.command("locize-download").description("Download all translations from your locize project.").action(async t=>{const o=await i();await u(o,t)}),w.command("locize-migrate").description("Migrate local translation files to a new locize project.").action(async t=>{const o=await i();await h(o,t)}),w.parse(process.argv);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolve as t,basename as e,extname as o}from"node:path";import{glob as s}from"glob";import{getNestedKeys as n,getNestedValue as r,setNestedValue as a}from"../../utils/nested-object.js";import{getOutputPath as c,loadTranslationFile as i}from"../../utils/file-utils.js";function f(t){const e=`^${t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`;return new RegExp(e)}function u(t){if("object"!=typeof t||null===t||Array.isArray(t))return t;const e={},o=Object.keys(t).sort((t,e)=>t.localeCompare(e,void 0,{sensitivity:"base"}));for(const s of o)e[s]=u(t[s]);return e}function l(t,e,o,s,c,i){const{keySeparator:f=".",sort:l=!0,removeUnusedKeys:p=!0,primaryLanguage:y,defaultValue:g=""}=o.extract;let d=p?{}:JSON.parse(JSON.stringify(e));const m=n(e,f??".");for(const t of m)if(c.some(e=>e.test(t))){const o=r(e,t,f??".");a(d,t,o,f??".")}for(const{key:o,defaultValue:n}of t){const c=r(e,o,f??"."),u=!t.some(t=>t.key.startsWith(`${o}${f}`)&&t.key!==o),l="object"==typeof c&&null!==c&&u&&!i.has(o);a(d,o,void 0===c||l?s===y?n:g:c,f??".")}if(!0===l)return u(d);if("function"==typeof l){const e={},o=Object.keys(d),s=new Map;for(const e of t){const t=!1===f?e.key:e.key.split(f)[0];s.has(t)||s.set(t,e)}o.sort((t,e)=>{if("function"==typeof l){const o=s.get(t),n=s.get(e);if(o&&n)return l(o,n)}return t.localeCompare(e,void 0,{sensitivity:"base"})});for(const t of o)e[t]=d[t];d=e}return d}async function p(n,r,a){a.extract.primaryLanguage||=a.locales[0]||"en",a.extract.secondaryLanguages||=a.locales.filter(t=>t!==a?.extract?.primaryLanguage);const u=a.extract.defaultNS??"translation",p=[...a.extract.preservePatterns||[]],y=a.extract.indentation??2;for(const t of r)p.push(`${t}.*`);const g=p.map(f),d=new Map;for(const t of n.values()){const e=t.ns||u;d.has(e)||d.set(e,[]),d.get(e).push(t)}const m=[],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={},o=c(a.extract.output,n),s=t(process.cwd(),o),f=await i(s)||{},u=new Set([...d.keys(),...Object.keys(f)]);for(const t of u){const o=d.get(t)||[],s=f[t]||{};e[t]=l(o,s,a,n,g,r)}const p=JSON.stringify(f,null,y),x=JSON.stringify(e,null,y);m.push({path:s,updated:x!==p,newTranslations:e,existingTranslations:f})}else{const f=new Set(d.keys()),u=c(a.extract.output,n,"*"),p=await s(u,{ignore:x});for(const t of p)f.add(e(t,o(t)));for(const e of f){const o=d.get(e)||[],s=c(a.extract.output,n,e),f=t(process.cwd(),s),u=await i(f)||{},p=l(o,u,a,n,g,r),x=JSON.stringify(u,null,y),w=JSON.stringify(p,null,y);m.push({path:f,updated:w!==x,newTranslations:p,existingTranslations:u})}}}return m}export{p as getTranslations};
|
|
1
|
+
import{resolve as t,basename as e,extname as o}from"node:path";import{glob as s}from"glob";import{getNestedKeys as n,getNestedValue as r,setNestedValue as a}from"../../utils/nested-object.js";import{getOutputPath as c,loadTranslationFile as i}from"../../utils/file-utils.js";function f(t){const e=`^${t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`;return new RegExp(e)}function u(t){if("object"!=typeof t||null===t||Array.isArray(t))return t;const e={},o=Object.keys(t).sort((t,e)=>{const o=t.localeCompare(e,void 0,{sensitivity:"base"});return 0===o?t.localeCompare(e,void 0,{sensitivity:"case"}):o});for(const s of o)e[s]=u(t[s]);return e}function l(t,e,o,s,c,i){const{keySeparator:f=".",sort:l=!0,removeUnusedKeys:p=!0,primaryLanguage:y,defaultValue:g=""}=o.extract;let d=p?{}:JSON.parse(JSON.stringify(e));const m=n(e,f??".");for(const t of m)if(c.some(e=>e.test(t))){const o=r(e,t,f??".");a(d,t,o,f??".")}for(const{key:o,defaultValue:n}of t){const c=r(e,o,f??"."),u=!t.some(t=>t.key.startsWith(`${o}${f}`)&&t.key!==o),l="object"==typeof c&&null!==c&&u&&!i.has(o);a(d,o,void 0===c||l?s===y?n:g:c,f??".")}if(!0===l)return u(d);if("function"==typeof l){const e={},o=Object.keys(d),s=new Map;for(const e of t){const t=!1===f?e.key:e.key.split(f)[0];s.has(t)||s.set(t,e)}o.sort((t,e)=>{if("function"==typeof l){const o=s.get(t),n=s.get(e);if(o&&n)return l(o,n)}return t.localeCompare(e,void 0,{sensitivity:"base"})});for(const t of o)e[t]=d[t];d=e}return d}async function p(n,r,a){a.extract.primaryLanguage||=a.locales[0]||"en",a.extract.secondaryLanguages||=a.locales.filter(t=>t!==a?.extract?.primaryLanguage);const u=a.extract.defaultNS??"translation",p=[...a.extract.preservePatterns||[]],y=a.extract.indentation??2;for(const t of r)p.push(`${t}.*`);const g=p.map(f),d=new Map;for(const t of n.values()){const e=t.ns||u;d.has(e)||d.set(e,[]),d.get(e).push(t)}const m=[],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={},o=c(a.extract.output,n),s=t(process.cwd(),o),f=await i(s)||{},u=new Set([...d.keys(),...Object.keys(f)]);for(const t of u){const o=d.get(t)||[],s=f[t]||{};e[t]=l(o,s,a,n,g,r)}const p=JSON.stringify(f,null,y),x=JSON.stringify(e,null,y);m.push({path:s,updated:x!==p,newTranslations:e,existingTranslations:f})}else{const f=new Set(d.keys()),u=c(a.extract.output,n,"*"),p=await s(u,{ignore:x});for(const t of p)f.add(e(t,o(t)));for(const e of f){const o=d.get(e)||[],s=c(a.extract.output,n,e),f=t(process.cwd(),s),u=await i(f)||{},p=l(o,u,a,n,g,r),x=JSON.stringify(u,null,y),w=JSON.stringify(p,null,y);m.push({path:f,updated:w!==x,newTranslations:p,existingTranslations:u})}}}return m}export{p as getTranslations};
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -24,7 +24,17 @@ function sortObject (obj: any): any {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
const sortedObj: Record<string, any> = {}
|
|
27
|
-
const keys = Object.keys(obj).sort((a, b) =>
|
|
27
|
+
const keys = Object.keys(obj).sort((a, b) => {
|
|
28
|
+
// First, compare case-insensitively
|
|
29
|
+
const caseInsensitiveComparison = a.localeCompare(b, undefined, { sensitivity: 'base' })
|
|
30
|
+
|
|
31
|
+
// If they're equal case-insensitively, sort by case (lowercase first)
|
|
32
|
+
if (caseInsensitiveComparison === 0) {
|
|
33
|
+
return a.localeCompare(b, undefined, { sensitivity: 'case' })
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return caseInsensitiveComparison
|
|
37
|
+
})
|
|
28
38
|
|
|
29
39
|
for (const key of keys) {
|
|
30
40
|
sortedObj[key] = sortObject(obj[key])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation-manager.d.ts","sourceRoot":"","sources":["../../../src/extractor/core/translation-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"translation-manager.d.ts","sourceRoot":"","sources":["../../../src/extractor/core/translation-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAwInF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,EAC/B,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,EACvB,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,iBAAiB,EAAE,CAAC,CA8E9B"}
|