ai-localize-cli 3.0.0 → 3.1.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # ai-localize-cli
2
2
 
3
+ ## 3.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - **`copyDefaultValues` config option** — `extract` command now passes `copyDefaultValues` from `ai-localize.config.json` to `LocaleExtractor`. When `true`, target language locale files are pre-populated with the default language's source text values instead of empty strings, ensuring the app always has a visible fallback while translators fill in proper translations.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - ai-localize-config@3.1.0
13
+ - ai-localize-locale-engine@3.1.0
14
+
3
15
  ## 3.0.0
4
16
 
5
17
  ### Major Changes
package/dist/cli.js CHANGED
@@ -298931,7 +298931,24 @@ var LocalizationConfigSchema = external_exports.object({
298931
298931
  * Example:
298932
298932
  * "ignoreTextPatterns": ["^MyBrand", "^theme-", "^data-"]
298933
298933
  */
298934
- ignoreTextPatterns: external_exports.array(external_exports.string()).default([])
298934
+ ignoreTextPatterns: external_exports.array(external_exports.string()).default([]),
298935
+ /**
298936
+ * When `true`, target language locale files are pre-populated with the same
298937
+ * source text values as the default language instead of empty strings.
298938
+ *
298939
+ * This ensures the app always has a visible fallback value while translators
298940
+ * work on proper translations. Empty-string values cause the UI to show
298941
+ * nothing at all for untranslated keys.
298942
+ *
298943
+ * Applies to both `extract` (new files) and `sync` (adding missing keys to
298944
+ * existing files).
298945
+ *
298946
+ * Defaults to `false`.
298947
+ *
298948
+ * Example:
298949
+ * "copyDefaultValues": true
298950
+ */
298951
+ copyDefaultValues: external_exports.boolean().default(false)
298935
298952
  });
298936
298953
  async function loadConfig(cwd = process.cwd(), overrides = {}) {
298937
298954
  dotenv.config({ path: path2.join(cwd, ".env") });
@@ -300274,7 +300291,8 @@ var LocaleExtractor = class {
300274
300291
  defaultLanguage: options.defaultLanguage || "en",
300275
300292
  targetLanguages: options.targetLanguages || [],
300276
300293
  namespaceSplitting: options.namespaceSplitting ?? true,
300277
- staticKeys: options.staticKeys ?? {}
300294
+ staticKeys: options.staticKeys ?? {},
300295
+ copyDefaultValues: options.copyDefaultValues ?? false
300278
300296
  };
300279
300297
  }
300280
300298
  extract(detectedTexts) {
@@ -300317,7 +300335,7 @@ var LocaleExtractor = class {
300317
300335
  for (const lang of allLanguages) {
300318
300336
  for (const [namespace, entries] of namespaceMap) {
300319
300337
  const isDefault = lang === this.options.defaultLanguage;
300320
- const langEntries = isDefault ? { ...entries } : Object.fromEntries(Object.keys(entries).map((k7) => [k7, ""]));
300338
+ const langEntries = isDefault || this.options.copyDefaultValues ? { ...entries } : Object.fromEntries(Object.keys(entries).map((k7) => [k7, ""]));
300321
300339
  localeFiles.push({ language: lang, namespace, entries: langEntries, filePath: "" });
300322
300340
  }
300323
300341
  }
@@ -300472,7 +300490,8 @@ function extractCommand() {
300472
300490
  targetLanguages: config2.targetLanguages,
300473
300491
  namespaceSplitting: structure === "nested",
300474
300492
  // flat mode does not need namespace splitting
300475
- staticKeys
300493
+ staticKeys,
300494
+ copyDefaultValues: config2.copyDefaultValues
300476
300495
  });
300477
300496
  const { localeFiles, keyCount, namespaces } = extractor.extract(uniqueTexts);
300478
300497
  logger.info(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-localize-cli",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "CLI for ai-localize-core: scan, extract, validate, codemod and migrate CDN",
5
5
  "author": "ai-localize-core contributors",
6
6
  "license": "MIT",
@@ -47,14 +47,14 @@
47
47
  "ora": "^8.0.1",
48
48
  "inquirer": "^9.2.12",
49
49
  "ai-localize-shared": "3.0.0",
50
- "ai-localize-config": "3.0.0",
51
- "ai-localize-framework-detectors": "3.0.0",
50
+ "ai-localize-config": "3.1.0",
52
51
  "ai-localize-codemods": "3.0.0",
53
- "ai-localize-locale-engine": "3.0.0",
54
- "ai-localize-reporting": "3.0.0",
55
- "ai-localize-validators": "3.0.0",
56
52
  "ai-localize-scanner": "3.0.0",
57
- "ai-localize-aws-cloudfront": "3.0.0"
53
+ "ai-localize-framework-detectors": "3.0.0",
54
+ "ai-localize-validators": "3.0.0",
55
+ "ai-localize-locale-engine": "3.1.0",
56
+ "ai-localize-aws-cloudfront": "3.0.0",
57
+ "ai-localize-reporting": "3.0.0"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@types/inquirer": "^9.0.7",