poly-lexis 0.9.3 → 0.11.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/README.md CHANGED
@@ -71,6 +71,37 @@ poly-lexis --auto-fill --dry-run
71
71
  poly-lexis --skip-types
72
72
  ```
73
73
 
74
+ ### Re-translating Changed Source Strings
75
+
76
+ When you edit a source string (e.g. in `en/`) after it has already been translated, the
77
+ existing translations in other languages become stale. poly-lexis detects this by recording
78
+ a hash of the source value each translation was generated from (in a `.translations-meta.json`
79
+ sidecar file inside your translations directory — commit it alongside your translation files).
80
+
81
+ ```bash
82
+ # Validation warns about translations whose source string has changed
83
+ poly-lexis
84
+
85
+ # Re-translate only the keys whose source value changed
86
+ poly-lexis --auto-fill --retranslate-changed
87
+
88
+ # Re-translate everything from scratch (ignores existing values)
89
+ poly-lexis --auto-fill --force
90
+ ```
91
+
92
+ Notes:
93
+
94
+ - Plain `--auto-fill` only fills missing/empty keys; it never overwrites an existing
95
+ translation. Use `--retranslate-changed` to refresh stale ones.
96
+ - **Existing codebases are handled automatically.** Any normal run (e.g. `poly-lexis`, the
97
+ "Full check" menu option, or validation) records a baseline hash for every key that is
98
+ already translated but not yet tracked, then creates/updates `.translations-meta.json`.
99
+ From that point on, source changes to those keys are detected. The baseline treats whatever
100
+ is in your repo at that moment as up to date, so a translation that is *already* stale when
101
+ you first adopt the feature is accepted as current. A dry run (`--dry-run`) never writes the
102
+ baseline.
103
+ - Stale translations are reported as a warning and do **not** fail validation on their own.
104
+
74
105
  ### Add Translation Keys
75
106
 
76
107
  ```bash
@@ -131,6 +162,8 @@ jobs:
131
162
  - `--api-key <key>` - Translation API key (or set DEEPL_API_KEY/GOOGLE_TRANSLATE_API_KEY env var)
132
163
  - `-l, --language <lang>` - Process only this language
133
164
  - `--limit <number>` - Max translations to process (default: 1000)
165
+ - `--retranslate-changed` - Re-translate keys whose source value changed since last run (implies `--auto-fill`)
166
+ - `--force` - Re-translate every key, even ones already translated (implies `--auto-fill`)
134
167
  - `--skip-types` - Skip TypeScript type generation
135
168
  - `-d, --dry-run` - Preview changes without saving
136
169