Skip to main content

A CLI tool for translating Xcode string catalogs.

Project description

string-catalog

PyPI Changelog License

A CLI tool for translating Xcode string catalogs.

Apps using this tool:

  • ByePhotos: Find similar photos and compress large videos to free up space on your iPhone and iCloud.
  • ParkClock: Parking Timer & Reminder.
  • OptiClean: Removes unwanted objects from photos using AI, run model fully on device.

Installation

Install this tool using pip:

pip install string-catalog

Usage

For help, run:

string-catalog --help

Translate a single xcstrings file or all xcstrings files in a directory

export OPENROUTER_API_KEY=sk-or-v1-xxxxx
string-catalog xcstrings translate /path_or_dir/to/xcstrings_file \
--model anthropic/claude-3.5-sonnet \
--lang ru \
--lang zh-Hant

Translate a single xcstrings file and all supported languages using deepseek-v3 API

string-catalog xcstrings translate /path_or_dir/to/xcstrings_file \
--base-url https://api.deepseek.com \
--api-key sk-xxxx --model deepseek-chat --lang all
  • All API call results are cached in the .translation_cache/ directory and will be used first for subsequent calls.

The translation results have a default state of needs_review. If you need to update them to translated (for example, after reviewing all translations in Xcode and wanting to avoid manually clicking "Mark as Reviewed" for each one), you can use the following command:

string-catalog xcstrings update-state /path_or_dir/to/xcstrings_file \
--old needs_review \
--new translated

App Store Connect Automation

Generate What's New JSON file from xcstrings file:

string-catalog xcstrings generate-whats-new /path_to/WhatsNewLocalizable.xcstrings \
--key v1.1_feature1 \
--key v1.1_feature2

Here is the generated JSON file:

{
  "it": "Nuova funzione 1: Titolo\nNuova funzione 2: Titolo",
  "pt": "Nova funcionalidade 1: Título\nNova funcionalidade 2: Título",
  "ja": "新機能1: タイトル\n新機能2: タイトル",
  "zh-Hans": "新功能1: 标题\n新功能2: 标题"
}

Creating ISSUER_ID, KEY_ID, and KEY_FILE for App Store Connect API, then update Whats New using the following command:

export ASC_ISSUER_ID=xxxx
export ASC_KEY_ID=xxxx
export ASC_KEY_FILE=xxxx.p8

string-catalog appstore update-whats-new \
--bundle-id com.xxx.xxx \
--version 1.0.0 \
--json-path whats_new.json \
--platform IOS

Development

To contribute to this tool, first checkout the code. Then create a new virtual environment:

uv run string-catalog --help

Test:

uv run pytest

Acknowledgments

This project is inspired by swift-translate.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

string_catalog-0.6.0.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

string_catalog-0.6.0-py3-none-any.whl (22.7 kB view details)

Uploaded Python 3

File details

Details for the file string_catalog-0.6.0.tar.gz.

File metadata

  • Download URL: string_catalog-0.6.0.tar.gz
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for string_catalog-0.6.0.tar.gz
Algorithm Hash digest
SHA256 c98ae6af93d11ee89e7efea28f10b727866b0e4b7c933b06a4dc8b2bc82f7804
MD5 07b9a9d2460edce14b362b030a8a7598
BLAKE2b-256 896a59282dcd2e766b4e43d540bdbdd9a34c29349bb2377487d1f6ff99f570d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for string_catalog-0.6.0.tar.gz:

Publisher: publish.yml on Sanster/string-catalog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file string_catalog-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: string_catalog-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 22.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for string_catalog-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9a42b0836782068025891198829300a9cd51e2939a909db89e703f0ced018dea
MD5 84a2cf83e6372d4c23e3beaefa31d5fa
BLAKE2b-256 9fd7634e5cd423d22b20335d2dba2bc5d0e794f98e906df9c7e8c399f6eed9fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for string_catalog-0.6.0-py3-none-any.whl:

Publisher: publish.yml on Sanster/string-catalog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page