xcstrings-cli 2.2.0 → 2.4.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 +48 -19
- package/dist/index.js +938 -896
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,13 +64,20 @@ xcs add --strings << EOF
|
|
|
64
64
|
greeting:
|
|
65
65
|
translations:
|
|
66
66
|
en: Hello, World.
|
|
67
|
-
ja:
|
|
67
|
+
ja:
|
|
68
|
+
state: needs_review
|
|
69
|
+
value: こんにちは、世界。
|
|
68
70
|
zh-Hans: 你好,世界。
|
|
69
71
|
comment: A greeting message.
|
|
70
72
|
farewell:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
translations:
|
|
74
|
+
en: Goodbye, World.
|
|
75
|
+
ja:
|
|
76
|
+
state: needs_review
|
|
77
|
+
value: さよなら、世界。
|
|
78
|
+
zh-Hans:
|
|
79
|
+
state: stale
|
|
80
|
+
value: さようなら、世界。
|
|
74
81
|
comment: A farewell message.
|
|
75
82
|
EOF
|
|
76
83
|
|
|
@@ -103,7 +110,7 @@ xcs languages
|
|
|
103
110
|
|
|
104
111
|
```bash
|
|
105
112
|
# List all strings
|
|
106
|
-
xcs
|
|
113
|
+
xcs strings
|
|
107
114
|
# helloWorld:
|
|
108
115
|
# en: "Hello, World."
|
|
109
116
|
# ja: "こんにちは、世界。"
|
|
@@ -117,14 +124,14 @@ xcs list
|
|
|
117
124
|
# ... etc.
|
|
118
125
|
|
|
119
126
|
# List strings filtered by key
|
|
120
|
-
xcs
|
|
127
|
+
xcs strings --key good*
|
|
121
128
|
# goodbyeWorld:
|
|
122
129
|
# ...
|
|
123
130
|
# goodMorning:
|
|
124
131
|
# ...
|
|
125
132
|
|
|
126
133
|
# List strings filtered by language
|
|
127
|
-
xcs
|
|
134
|
+
xcs strings --languages en
|
|
128
135
|
# helloWorld:
|
|
129
136
|
# en: "Hello, World."
|
|
130
137
|
# goodbyeWorld:
|
|
@@ -134,7 +141,7 @@ xcs list --languages en
|
|
|
134
141
|
# ... etc.
|
|
135
142
|
|
|
136
143
|
# List strings with custom format
|
|
137
|
-
xcs
|
|
144
|
+
xcs strings --format "[{{language}}] {{key}} => {{text}}"
|
|
138
145
|
# [en] helloWorld => "Hello, World."
|
|
139
146
|
# [ja] helloWorld => "こんにちは、世界。"
|
|
140
147
|
# [en] goodbyeWorld => "Goodbye, World."
|
|
@@ -143,7 +150,10 @@ xcs list --format "[{{language}}] {{key}} => {{text}}"
|
|
|
143
150
|
```
|
|
144
151
|
|
|
145
152
|
You can use `xcs --help` or `xcs <sub-command> --help` to see the list of commands and options.
|
|
146
|
-
|
|
153
|
+
|
|
154
|
+
## Commands
|
|
155
|
+
|
|
156
|
+
### Global options
|
|
147
157
|
|
|
148
158
|
* `--help, -h`: `boolean` (Optional)
|
|
149
159
|
* Show help.
|
|
@@ -155,9 +165,11 @@ You can use `xcs --help` or `xcs <sub-command> --help` to see the list of comman
|
|
|
155
165
|
* The xcstrings file path. Defaults to `Localizable.xcstrings` in the current directory, or to the first `xcstringsPaths` entry in the config when present.
|
|
156
166
|
* You can also specify the alias you set in the config file. (`xcstringsPaths` entry with `alias` field)
|
|
157
167
|
|
|
158
|
-
### `add` command
|
|
168
|
+
### `add` command
|
|
159
169
|
|
|
160
|
-
|
|
170
|
+
Adds/updates one or more strings to the xcstrings file.
|
|
171
|
+
|
|
172
|
+
* `--key, -k`: `string` (Required unless `--strings` contains one or more keys)
|
|
161
173
|
* The key of the string to add.
|
|
162
174
|
* `--language, -l`: `string` (Optional)
|
|
163
175
|
* The language of the string provided with `--text`.
|
|
@@ -166,6 +178,14 @@ You can use `xcs --help` or `xcs <sub-command> --help` to see the list of comman
|
|
|
166
178
|
* Validation follows `missingLanguagePolicy`: `skip` requires the language to be supported; `include` allows any language.
|
|
167
179
|
* `--text`: `string` (Optional)
|
|
168
180
|
* The string value for the language. If omitted, the key is created without a localization for the default language.
|
|
181
|
+
* `--state`: `string` (Optional, default: `translated`)
|
|
182
|
+
* Values applied to single-key and multi-key adds: `translated`, `needs_review`, `new`, `stale`. If omitted, strings default to `translated`.
|
|
183
|
+
* Multi-key payloads can also set per-language states with `{ state, value }`; string shorthand is treated as `translated`.
|
|
184
|
+
* State meanings:
|
|
185
|
+
* `translated`: The string is translated and ready to use.
|
|
186
|
+
* `needs_review`: The string needs review by a translator.
|
|
187
|
+
* `new`: The string is newly added and not yet translated.
|
|
188
|
+
* `stale`: The string is outdated and may need re-translation.
|
|
169
189
|
* `--strings`: `string` (Optional)
|
|
170
190
|
* Translation-including JSON or YAML for the key. Pass inline JSON, or provide the flag without a value to read it from stdin (heredoc/pipe).
|
|
171
191
|
* The format is determined by `--strings-format`.
|
|
@@ -177,7 +197,9 @@ You can use `xcs --help` or `xcs <sub-command> --help` to see the list of comman
|
|
|
177
197
|
* `--comment`: `string` (Optional)
|
|
178
198
|
* The comment for the string to add, intended for translators.
|
|
179
199
|
|
|
180
|
-
### `remove` command
|
|
200
|
+
### `remove` command
|
|
201
|
+
|
|
202
|
+
Removes strings from the xcstrings file based on the specified filter options.
|
|
181
203
|
|
|
182
204
|
* `--key, -k`: `string` (Optional if `languages` is specified)
|
|
183
205
|
* The key of the string to remove. If not specified, xcstrings-cli will remove all strings for the specified languages.
|
|
@@ -186,7 +208,9 @@ You can use `xcs --help` or `xcs <sub-command> --help` to see the list of comman
|
|
|
186
208
|
* `--dry-run, -n`: `boolean` (Optional, default: `false`)
|
|
187
209
|
* If set to `true`, `xcs` will only show what would be removed without actually removing anything.
|
|
188
210
|
|
|
189
|
-
### `
|
|
211
|
+
### `strings` command
|
|
212
|
+
|
|
213
|
+
Lists strings in the xcstrings file, with optional filtering and formatting.
|
|
190
214
|
|
|
191
215
|
* `--languages, -l`: `string[]` (Optional)
|
|
192
216
|
* Include only the specified languages.
|
|
@@ -208,7 +232,10 @@ You can use `xcs --help` or `xcs <sub-command> --help` to see the list of comman
|
|
|
208
232
|
## Config file
|
|
209
233
|
|
|
210
234
|
Put an `xcstrings-cli.json5` or `xcstrings-cli.json` file in the project root, and xcs will use it as the config file.
|
|
211
|
-
|
|
235
|
+
|
|
236
|
+
Here is an example config file in JSON format:
|
|
237
|
+
|
|
238
|
+
```json
|
|
212
239
|
{
|
|
213
240
|
"xcstringsPaths": [
|
|
214
241
|
"Shared/L10n/Localizable.xcstrings",
|
|
@@ -219,19 +246,21 @@ Put an `xcstrings-cli.json5` or `xcstrings-cli.json` file in the project root, a
|
|
|
219
246
|
],
|
|
220
247
|
"xcodeprojPaths": [
|
|
221
248
|
"path/to/your/Project.xcodeproj"
|
|
222
|
-
]
|
|
249
|
+
],
|
|
250
|
+
"missingLanguagePolicy": "include"
|
|
223
251
|
}
|
|
224
252
|
```
|
|
225
253
|
|
|
226
|
-
These are the
|
|
254
|
+
These are the settings you can specify in the config file:
|
|
227
255
|
|
|
228
256
|
* **xcstringsPaths**: `string[] | { alias: string, path: string }[]` (Optional)
|
|
229
257
|
* Paths to xcstrings files used by `xcs`.
|
|
230
258
|
* If only one path is provided, `xcs` will use it as the default xcstrings file.
|
|
231
|
-
* If multiple paths are provided, `xcs` will ask you to select an xcstrings file.
|
|
259
|
+
* If multiple paths are provided, `xcs` will ask you to select an xcstrings file.
|
|
260
|
+
* You can also specify an alias, and use it with the `--path` option.
|
|
232
261
|
* **xcodeprojPaths**: `string[]` (Optional)
|
|
233
|
-
* Paths to Xcode project files used to detect supported languages.
|
|
234
|
-
* If not specified, `xcs` will
|
|
262
|
+
* Paths to Xcode project files (`.xcodeproj`) used to detect supported languages.
|
|
263
|
+
* If not specified, `xcs` will only check the xcstrings file to detect supported languages.
|
|
235
264
|
* **missingLanguagePolicy**: `string` (Optional, default: `skip`)
|
|
236
265
|
* How to handle translations for languages that are not included in the `xcs languages` output when adding strings. Options are:
|
|
237
266
|
* `skip`: Only add translations for languages included in the `xcs languages` output. (Default)
|