xcstrings-cli 1.5.0 → 1.6.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 +12 -2
- package/dist/index.js +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,7 +35,17 @@ This will ask you some questions and create an `xcstrings-cli.json` file in the
|
|
|
35
35
|
# Add with key, comment, and default language string
|
|
36
36
|
xcstrings add --key greeting --comment "A greeting message." --string "Hello, World."
|
|
37
37
|
|
|
38
|
-
# Add with key, comment, and translations
|
|
38
|
+
# Add with key, comment, and translations YAML via heredoc
|
|
39
|
+
xcstrings add \
|
|
40
|
+
--key greeting \
|
|
41
|
+
--comment "A greeting message." \
|
|
42
|
+
--strings << EOF
|
|
43
|
+
en: Hello, World.
|
|
44
|
+
ja: こんにちは、世界。
|
|
45
|
+
zh-Hans: 你好,世界。
|
|
46
|
+
EOF
|
|
47
|
+
|
|
48
|
+
# Or add translations JSON
|
|
39
49
|
xcstrings add \
|
|
40
50
|
--key greeting \
|
|
41
51
|
--comment "A greeting message." \
|
|
@@ -103,8 +113,8 @@ You can use `xcstrings --help` or `xcstrings <sub-command> --help` to see the li
|
|
|
103
113
|
* `--strings-format`: `string` (Optional, default: `auto`)
|
|
104
114
|
* The format of the data provided with `--strings`. Options are:
|
|
105
115
|
* `auto`: Auto-detect format based on content.
|
|
106
|
-
* `json`: JSON format. (It uses `json5` internally.)
|
|
107
116
|
* `yaml`: YAML format. (It uses `js-yaml` internally.)
|
|
117
|
+
* `json`: JSON format. (It uses `json5` internally.)
|
|
108
118
|
* `--comment`: `string` (Optional)
|
|
109
119
|
* The comment for the string to add, intended for translators.
|
|
110
120
|
|
package/dist/index.js
CHANGED
|
@@ -1963,16 +1963,16 @@ const ue = (e, n) => {
|
|
|
1963
1963
|
}
|
|
1964
1964
|
const r = [];
|
|
1965
1965
|
try {
|
|
1966
|
-
return ue(
|
|
1966
|
+
return ue(mn.load(i), "yaml");
|
|
1967
1967
|
} catch (o) {
|
|
1968
|
-
r.push(`
|
|
1968
|
+
r.push(`yaml error: ${fe(o)}`);
|
|
1969
1969
|
}
|
|
1970
1970
|
try {
|
|
1971
|
-
return ue(
|
|
1971
|
+
return ue(Le.parse(i), "json");
|
|
1972
1972
|
} catch (o) {
|
|
1973
|
-
r.push(`
|
|
1973
|
+
r.push(`json error: ${fe(o)}`);
|
|
1974
1974
|
}
|
|
1975
|
-
throw new Error(`Failed to parse --strings input. Provide valid
|
|
1975
|
+
throw new Error(`Failed to parse --strings input. Provide valid YAML or JSON, or specify --strings-format. ${r.join(" | ")}`);
|
|
1976
1976
|
};
|
|
1977
1977
|
async function si() {
|
|
1978
1978
|
return new Promise((e) => {
|