A generator of Swift literal files and Apple String Catalogs (.xcstrings) from a POEditor project.
3.0 is a rewrite around Apple String Catalogs. Breaking changes:
- Only the
.xcstringsformat is supported. The old.stringsoutput has been removed. - The single monolithic command is replaced by explicit subcommands:
download,generate,distribute,filter,remove. - The
--onlygenerate,--stringsfile,--formatand--exportalloptions are gone.
POEditor-Parser is available through Mint.
Add the following line to your Mintfile:
hyperdevs-team/poeditor-parser-swift@3.0.0Download a String Catalog (all languages) from POEditor. Placeholders like {1{var}} are normalized to {{var}}.
poe download --apitoken $TOKEN --projectid $ID --language es --out Localizable.xcstrings
| Option | Default | Description |
|---|---|---|
--apitoken |
– | The POEditor API token (required) |
--projectid |
– | The POEditor project id (required) |
--language |
en |
Preferred language code |
--out |
Localizable.xcstrings |
Output .xcstrings file path |
Generate the Swift literals file from a local .xcstrings.
poe generate --in Localizable.xcstrings --swiftfile Sources/Literals.swift --outputformat enum --typename Literals --keysformat lowerCamelCase
| Option | Default | Description |
|---|---|---|
--in |
Localizable.xcstrings |
Input .xcstrings file path |
--swiftfile |
Sources/Literals.swift |
Output Swift file path |
--typename |
Literals |
Type name that stores all localized vars |
--tablename |
– | The tableName value for NSLocalizedString |
--outputformat |
struct |
Swift output format (enum or struct) |
--keysformat |
upperCamelCase |
Key format (lowerCamelCase or upperCamelCase) |
--language |
– | Preferred language to source values from |
Split a multi-variant .xcstrings into a single-variant one. Keys may carry a suffix key[variantA|variantB]; a variant-specific key wins over the plain (common) key of the same base name, and keys targeting other variants are dropped.
poe distribute --in Localizable.xcstrings --out Variants/Yoigo/Localizable.xcstrings --variant yoigo
| Option | Default | Description |
|---|---|---|
--in |
Localizable.xcstrings |
Input multi-variant .xcstrings file path |
--out |
Localizable.xcstrings |
Output single-variant .xcstrings file path |
--variant |
– | The variant to extract (key[variant] suffix) |
Keep only the changes of keys matching --keys between a baseline and a working .xcstrings; every other key falls back to the baseline. The command is git-agnostic: provide the baseline (e.g. the HEAD contents) as a file.
poe filter --baseline head.xcstrings --working Localizable.xcstrings --out Localizable.xcstrings --keys "about*,*profile*"
| Option | Default | Description |
|---|---|---|
--baseline |
– | Baseline .xcstrings (e.g. HEAD contents; may be absent/empty) |
--working |
– | Working-tree .xcstrings |
--out |
--working |
Output .xcstrings file path |
--keys |
– | Comma-separated key patterns (* and ? wildcards) |
Remove every key matching the given patterns.
poe remove --in Localizable.xcstrings --keys "about*,legacy_key" [--dryrun]
| Option | Default | Description |
|---|---|---|
--in |
Localizable.xcstrings |
Input .xcstrings file path |
--out |
--in |
Output .xcstrings file path |
--keys |
– | Comma-separated key patterns (* and ? wildcards) |
--dryrun |
off | Only print the keys that would be removed |
--keys (in filter and remove) accepts comma-separated patterns matched against the whole key:
*matches any run of characters (e.g.about*,*profile*).?matches a single character (e.g.user?info).
- Edilberto Lopez Torregrosa
- Raúl Pedraza León
- Jorge Revuelta
- Sebastián Varela
- David Martínez García
- Adrián Ruiz Lafuente
POEditor-Parser is available under the Apache 2.0. See the LICENSE file for more info.
If you want a similar solution for your Android projects, check this out: poeditor-android-gradle-plugin