xcstrings-cli 2.0.0 → 2.2.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 +86 -1
- package/dist/index.js +1901 -1395
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ We also provide a Custom GPT that can help you generate translations and output
|
|
|
15
15
|
|
|
16
16
|
This will install the `xcs` command globally.
|
|
17
17
|
|
|
18
|
-
2.
|
|
18
|
+
2. Create a configuration file for your project by running:
|
|
19
19
|
```bash
|
|
20
20
|
xcs init
|
|
21
21
|
```
|
|
@@ -59,6 +59,21 @@ xcs add \
|
|
|
59
59
|
--strings-format yaml \
|
|
60
60
|
--strings < translations.yaml
|
|
61
61
|
|
|
62
|
+
# Add multiple strings via heredoc
|
|
63
|
+
xcs add --strings << EOF
|
|
64
|
+
greeting:
|
|
65
|
+
translations:
|
|
66
|
+
en: Hello, World.
|
|
67
|
+
ja: こんにちは、世界。
|
|
68
|
+
zh-Hans: 你好,世界。
|
|
69
|
+
comment: A greeting message.
|
|
70
|
+
farewell:
|
|
71
|
+
en: Goodbye, World.
|
|
72
|
+
ja: さようなら、世界。
|
|
73
|
+
zh-Hans: 再见,世界。
|
|
74
|
+
comment: A farewell message.
|
|
75
|
+
EOF
|
|
76
|
+
|
|
62
77
|
# Add with only key and comment
|
|
63
78
|
xcs add --key greeting --comment "A greeting message."
|
|
64
79
|
```
|
|
@@ -84,6 +99,49 @@ xcs languages
|
|
|
84
99
|
# en ja zh-Hans
|
|
85
100
|
```
|
|
86
101
|
|
|
102
|
+
**List strings in the xcstrings file:**
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# List all strings
|
|
106
|
+
xcs list
|
|
107
|
+
# helloWorld:
|
|
108
|
+
# en: "Hello, World."
|
|
109
|
+
# ja: "こんにちは、世界。"
|
|
110
|
+
# zh-Hans: "你好,世界。"
|
|
111
|
+
# goodbyeWorld:
|
|
112
|
+
# en: "Goodbye, World."
|
|
113
|
+
# ja: "さようなら、世界。"
|
|
114
|
+
# goodMorning:
|
|
115
|
+
# en: "Good morning."
|
|
116
|
+
# ja: "おはようございます。"
|
|
117
|
+
# ... etc.
|
|
118
|
+
|
|
119
|
+
# List strings filtered by key
|
|
120
|
+
xcs list --key good*
|
|
121
|
+
# goodbyeWorld:
|
|
122
|
+
# ...
|
|
123
|
+
# goodMorning:
|
|
124
|
+
# ...
|
|
125
|
+
|
|
126
|
+
# List strings filtered by language
|
|
127
|
+
xcs list --languages en
|
|
128
|
+
# helloWorld:
|
|
129
|
+
# en: "Hello, World."
|
|
130
|
+
# goodbyeWorld:
|
|
131
|
+
# en: "Goodbye, World."
|
|
132
|
+
# goodMorning:
|
|
133
|
+
# en: "Good morning."
|
|
134
|
+
# ... etc.
|
|
135
|
+
|
|
136
|
+
# List strings with custom format
|
|
137
|
+
xcs list --format "[{{language}}] {{key}} => {{text}}"
|
|
138
|
+
# [en] helloWorld => "Hello, World."
|
|
139
|
+
# [ja] helloWorld => "こんにちは、世界。"
|
|
140
|
+
# [en] goodbyeWorld => "Goodbye, World."
|
|
141
|
+
# [ja] goodbyeWorld => "さようなら、世界。"
|
|
142
|
+
# ... etc.
|
|
143
|
+
```
|
|
144
|
+
|
|
87
145
|
You can use `xcs --help` or `xcs <sub-command> --help` to see the list of commands and options.
|
|
88
146
|
## Command options
|
|
89
147
|
|
|
@@ -128,6 +186,25 @@ You can use `xcs --help` or `xcs <sub-command> --help` to see the list of comman
|
|
|
128
186
|
* `--dry-run, -n`: `boolean` (Optional, default: `false`)
|
|
129
187
|
* If set to `true`, `xcs` will only show what would be removed without actually removing anything.
|
|
130
188
|
|
|
189
|
+
### `list` command options
|
|
190
|
+
|
|
191
|
+
* `--languages, -l`: `string[]` (Optional)
|
|
192
|
+
* Include only the specified languages.
|
|
193
|
+
* `--key`, `--key-glob`: `string` (Optional)
|
|
194
|
+
* Filter keys by glob pattern. This is the default key filter mode.
|
|
195
|
+
* `--key-regex`: `string` (Optional)
|
|
196
|
+
* Filter keys by regular expression.
|
|
197
|
+
* `--key-substring`: `string` (Optional)
|
|
198
|
+
* Filter keys by substring match.
|
|
199
|
+
* `--text`, `--text-glob`: `string` (Optional)
|
|
200
|
+
* Filter translations by glob pattern. This is the default text filter mode.
|
|
201
|
+
* `--text-regex`: `string` (Optional)
|
|
202
|
+
* Filter translations by regular expression.
|
|
203
|
+
* `--text-substring`: `string` (Optional)
|
|
204
|
+
* Filter translations by substring match.
|
|
205
|
+
* `--format`: `string` (Optional)
|
|
206
|
+
* Mustache template for per-localization output. Available variables: `{{language}}`, `{{key}}`, `{{text}}`.
|
|
207
|
+
|
|
131
208
|
## Config file
|
|
132
209
|
|
|
133
210
|
Put an `xcstrings-cli.json5` or `xcstrings-cli.json` file in the project root, and xcs will use it as the config file.
|
|
@@ -160,6 +237,14 @@ These are the options for the config file:
|
|
|
160
237
|
* `skip`: Only add translations for languages included in the `xcs languages` output. (Default)
|
|
161
238
|
* `include`: Add translations even when they are not recognized by the Xcode project or xcs language list.
|
|
162
239
|
|
|
240
|
+
## Q&A
|
|
241
|
+
|
|
242
|
+
**Q: Strings are not being added for some languages. Why?**
|
|
243
|
+
|
|
244
|
+
A: By default, `xcs` only adds translations for languages that are recognized in your Xcode project (knownRegions) or the xcstrings file. You can check which languages are recognized by running `xcs languages`.
|
|
245
|
+
|
|
246
|
+
If you want to add translations for languages not included in your Xcode project, you can change the `missingLanguagePolicy` in your config file to `include`.
|
|
247
|
+
|
|
163
248
|
## LICENSE
|
|
164
249
|
|
|
165
250
|
MIT
|