string-catalog


Namestring-catalog JSON
Version 0.3.0 PyPI version JSON
download
home_pageNone
SummaryA CLI tool for translating Xcode string catalogs.
upload_time2024-12-25 05:53:40
maintainerNone
docs_urlNone
authorPanicByte
requires_python>=3.8
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # string-catalog

[![PyPI](https://img.shields.io/pypi/v/string-catalog.svg)](https://pypi.org/project/string-catalog/)
[![Changelog](https://img.shields.io/github/v/release/Sanster/string-catalog?include_prereleases&label=changelog)](https://github.com/Sanster/string-catalog/releases)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/Sanster/string-catalog/blob/master/LICENSE)

A CLI tool for translating Xcode string catalogs.

My apps using this tool:

- [ByePhotos](https://apps.apple.com/us/app/byephotos-storage-cleanup/id6737446757): Find similar photos and compress large videos to free up space on your iPhone and iCloud.
- [OptiClean](https://apps.apple.com/ca/app/opticlean-ai-object-remover/id6452387177): Removes unwanted objects from photos using AI, run model fully on device.

## Installation

Install this tool using `pip`:

```bash
pip install string-catalog
```

## Usage

For help, run:

```bash
string-catalog --help
```

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

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

- 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:

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

## Development

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

```bash
cd string-catalog
python -m venv venv
source venv/bin/activate
```

Now install the dependencies and test dependencies:

```bash
pip install -e '.[test]'
```

To run the tests:

```bash
python -m pytest
```

# Acknowledgments

This project is inspired by [swift-translate](https://github.com/hidden-spectrum/swift-translate).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "string-catalog",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "PanicByte",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/f5/1c/26c60c6d75cee1896274c1ee010882d7e39c595b1a97c10ac46b26816da7/string_catalog-0.3.0.tar.gz",
    "platform": null,
    "description": "# string-catalog\n\n[![PyPI](https://img.shields.io/pypi/v/string-catalog.svg)](https://pypi.org/project/string-catalog/)\n[![Changelog](https://img.shields.io/github/v/release/Sanster/string-catalog?include_prereleases&label=changelog)](https://github.com/Sanster/string-catalog/releases)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/Sanster/string-catalog/blob/master/LICENSE)\n\nA CLI tool for translating Xcode string catalogs.\n\nMy apps using this tool:\n\n- [ByePhotos](https://apps.apple.com/us/app/byephotos-storage-cleanup/id6737446757): Find similar photos and compress large videos to free up space on your iPhone and iCloud.\n- [OptiClean](https://apps.apple.com/ca/app/opticlean-ai-object-remover/id6452387177): Removes unwanted objects from photos using AI, run model fully on device.\n\n## Installation\n\nInstall this tool using `pip`:\n\n```bash\npip install string-catalog\n```\n\n## Usage\n\nFor help, run:\n\n```bash\nstring-catalog --help\n```\n\nTranslate a single xcstrings file or all xcstrings files in a directory\n\n```bash\nexport OPENROUTER_API_KEY=sk-or-v1-xxxxx\nstring-catalog translate /path_or_dir/to/xcstrings_file --model anthropic/claude-3.5-sonnet \\\n--lang ru \\\n--lang zh-Hant\n```\n\n- All API call results are cached in the `.translation_cache/` directory and will be used first for subsequent calls.\n\nThe 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:\n\n```bash\nstring-catalog update-state /path_or_dir/to/xcstrings_file \\\n--old needs_review \\\n--new translated\n```\n\n## Development\n\nTo contribute to this tool, first checkout the code. Then create a new virtual environment:\n\n```bash\ncd string-catalog\npython -m venv venv\nsource venv/bin/activate\n```\n\nNow install the dependencies and test dependencies:\n\n```bash\npip install -e '.[test]'\n```\n\nTo run the tests:\n\n```bash\npython -m pytest\n```\n\n# Acknowledgments\n\nThis project is inspired by [swift-translate](https://github.com/hidden-spectrum/swift-translate).\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "A CLI tool for translating Xcode string catalogs.",
    "version": "0.3.0",
    "project_urls": {
        "CI": "https://github.com/Sanster/string-catalog/actions",
        "Changelog": "https://github.com/Sanster/string-catalog/releases",
        "Homepage": "https://github.com/Sanster/string-catalog",
        "Issues": "https://github.com/Sanster/string-catalog/issues"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "10cf00959c3e99332e9b5088c7acaec513ea4cc67cb38591b11902e18930f3b3",
                "md5": "cb61a5ed131d73ff2588500e216a3d41",
                "sha256": "0ccb993be18e85ccaa5e826111d5a04803db29d521da05448e90fb9a8be69dde"
            },
            "downloads": -1,
            "filename": "string_catalog-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cb61a5ed131d73ff2588500e216a3d41",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 14041,
            "upload_time": "2024-12-25T05:53:39",
            "upload_time_iso_8601": "2024-12-25T05:53:39.017514Z",
            "url": "https://files.pythonhosted.org/packages/10/cf/00959c3e99332e9b5088c7acaec513ea4cc67cb38591b11902e18930f3b3/string_catalog-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f51c26c60c6d75cee1896274c1ee010882d7e39c595b1a97c10ac46b26816da7",
                "md5": "5bb1cd7162d2b92760be219bb26b0e83",
                "sha256": "c256ee013a4660b330354abc68bdecc9c3c6b855a52d0dff6583415ef18454be"
            },
            "downloads": -1,
            "filename": "string_catalog-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "5bb1cd7162d2b92760be219bb26b0e83",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 14575,
            "upload_time": "2024-12-25T05:53:40",
            "upload_time_iso_8601": "2024-12-25T05:53:40.418953Z",
            "url": "https://files.pythonhosted.org/packages/f5/1c/26c60c6d75cee1896274c1ee010882d7e39c595b1a97c10ac46b26816da7/string_catalog-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-25 05:53:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Sanster",
    "github_project": "string-catalog",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "string-catalog"
}
        
Elapsed time: 1.54910s