xcstrings-cli 2.4.0 → 2.5.1

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.
Files changed (3) hide show
  1. package/README.md +47 -0
  2. package/dist/index.js +360 -351
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -266,6 +266,53 @@ These are the settings you can specify in the config file:
266
266
  * `skip`: Only add translations for languages included in the `xcs languages` output. (Default)
267
267
  * `include`: Add translations even when they are not recognized by the Xcode project or xcs language list.
268
268
 
269
+ ## Practical use cases
270
+
271
+ ### Case 1: Translate all missing strings using LLM
272
+
273
+ Suppose you have a xcstrings file and want to add Japanese and Simplified Chinese translations generated by LLM.
274
+
275
+ Firstly, list the strings missing those languages:
276
+
277
+ ```bash
278
+ xcs strings --languages en --missing-languages ja zh-Hans
279
+ # closeAction:
280
+ # en: "Close"
281
+ # detailsAction:
282
+ # en: "Details"
283
+ ```
284
+
285
+ Then, copy the output and use it as a prompt for the LLM to generate translations. We offer [xcstrings-cli Helper](https://chatgpt.com/g/g-69365945f8bc8191be3146f880238957-xcstrings-cli-helper), a Custom GPT that can help you generate translations in the form of an `xcs add` command. The prompt could be like this:
286
+
287
+ ```
288
+ closeAction:
289
+ en: "Close"
290
+ detailsAction:
291
+ en: "Details"
292
+
293
+ Languages: ja, zh-Hans
294
+ No comments needed.
295
+ ```
296
+
297
+ Then the Custom GPT will generate an `xcs add` command like this:
298
+
299
+ ```bash
300
+ xcs add --strings << EOF
301
+ closeAction:
302
+ translations:
303
+ en: Close
304
+ ja: 閉じる
305
+ zh-Hans: 关闭
306
+ detailsAction:
307
+ translations:
308
+ en: Details
309
+ ja: 詳細
310
+ zh-Hans: 详情
311
+ EOF
312
+ ```
313
+
314
+ Finally, copy the generated command and run it in your terminal to add the translations to your xcstrings file.
315
+
269
316
  ## Q&A
270
317
 
271
318
  **Q: Strings are not being added for some languages. Why?**