Skip to content

Add xcstrings format support and export-all option#4

Open
adrianrl wants to merge 6 commits into
masterfrom
feature/xcstrings-support
Open

Add xcstrings format support and export-all option#4
adrianrl wants to merge 6 commits into
masterfrom
feature/xcstrings-support

Conversation

@adrianrl

Copy link
Copy Markdown

Adds Apple String Catalog (.xcstrings) support to the parser while keeping the existing .strings flow and the same generated .swift output.

Key points

  • Added --format strings|xcstrings to choose the download/output translation format (maps to POEditor's type). The generated .swift file is identical for both.
  • Added XCStringsTranslationParser to parse the downloaded catalog JSON into Translation, taking values from the preferred → source → any language.
  • Added --exportall flag to download all languages at once (options=[{"export_all": 1}]); combined with xcstrings it produces a single multi-language catalog.
  • Normalized placeholder-marked variables ({1{var}}{{var}}) in the dumped .xcstrings so they match the iOS format, matching what .strings already did.
  • The normalization uses a single linear pass, so it stays fast and normalizes every language in the file in well under a second.
  • Updated README and added tests for the new parser and normalization.

How to review

  1. --format strings (default) → unchanged behavior, .strings + .swift.
  2. --format xcstrings --exportall → single .xcstrings with all languages, variables normalized to {{var}}, valid JSON.
  3. Confirm the generated .swift is the same regardless of --format.

@adrianrl adrianrl self-assigned this Jul 10, 2026
@adrianrl adrianrl added the enhancement New feature or request label Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants