|
3 | 3 | Universal CLI for converting, inspecting, merging, and editing localization files. |
4 | 4 |
|
5 | 5 | - Formats: Apple `.strings`, `.xcstrings`, Android `strings.xml`, CSV, TSV |
6 | | -- Commands: convert, diff, merge, sync, view, stats, debug, edit |
| 6 | +- Commands: convert, diff, merge, sync, view, stats, debug, edit, normalize |
7 | 7 |
|
8 | 8 | ## Install |
9 | 9 |
|
@@ -121,6 +121,39 @@ Options: |
121 | 121 |
|
122 | 122 | Supported formats: .strings, .xml (Android), .xcstrings, .csv, .tsv. Custom JSON/YAML/.langcodec edit is currently not enabled. |
123 | 123 |
|
| 124 | +### normalize |
| 125 | + |
| 126 | +Normalize localization files in-place (or to `--output` in single-input mode). |
| 127 | + |
| 128 | +```sh |
| 129 | +# Normalize in-place |
| 130 | +langcodec normalize -i en.lproj/Localizable.strings |
| 131 | + |
| 132 | +# CI drift check (non-zero if any file would change) |
| 133 | +langcodec normalize -i 'locales/**/*.{strings,xml,csv,tsv,xcstrings}' --check |
| 134 | + |
| 135 | +# Preview without writing |
| 136 | +langcodec normalize -i values/strings.xml --dry-run |
| 137 | + |
| 138 | +# Disable placeholder normalization and rename keys to snake_case |
| 139 | +langcodec normalize -i Localizable.xcstrings --no-placeholders --key-style snake |
| 140 | + |
| 141 | +# Keep processing remaining files and summarize failures at the end |
| 142 | +langcodec normalize -i a.strings -i b.csv -i c.tsv --continue-on-error |
| 143 | +``` |
| 144 | + |
| 145 | +Options and behavior: |
| 146 | + |
| 147 | +- --check: Detects normalization drift and exits non-zero when a file would change. |
| 148 | +- --dry-run: Prints what would change and exits without writing files. |
| 149 | +- --no-placeholders: Skips placeholder canonicalization (for example `%@` → `%s`). |
| 150 | +- --key-style: Renames keys during normalization. Values: `none` (default), `snake`, `kebab`, `camel`. |
| 151 | +- --output/-o: Single-input mode only. If multiple inputs are provided, `--output` is rejected. |
| 152 | +- --continue-on-error: Continues processing all matched inputs, prints a summary, and exits non-zero if any file failed. |
| 153 | +- --inputs/-i: One or more files, including quoted glob patterns. |
| 154 | + |
| 155 | +Supported normalize formats: `.strings`, Android `strings.xml`, `.csv`, `.tsv`, `.xcstrings`. |
| 156 | + |
124 | 157 | ## Notes |
125 | 158 |
|
126 | 159 | - Android plurals `<plurals>` are supported. |
|
0 commit comments