{"id":25246096,"url":"https://github.com/ocworld/pyxstr2swift","last_synced_at":"2025-09-16T12:38:52.717Z","repository":{"id":57458664,"uuid":"144813632","full_name":"ocworld/pyxstr2swift","owner":"ocworld","description":"Python package for a xcode strings file to a swift localized string file","archived":false,"fork":false,"pushed_at":"2019-03-01T14:52:32.000Z","size":59,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-06T13:51:42.620Z","etag":null,"topics":["codegenerator","ios","macos","python","strings","swift","xcode"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ocworld.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-15T06:19:39.000Z","updated_at":"2019-03-01T14:52:34.000Z","dependencies_parsed_at":"2022-09-10T04:04:02.214Z","dependency_job_id":null,"html_url":"https://github.com/ocworld/pyxstr2swift","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocworld%2Fpyxstr2swift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocworld%2Fpyxstr2swift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocworld%2Fpyxstr2swift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocworld%2Fpyxstr2swift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ocworld","download_url":"https://codeload.github.com/ocworld/pyxstr2swift/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238399604,"owners_count":19465490,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["codegenerator","ios","macos","python","strings","swift","xcode"],"created_at":"2025-02-12T02:12:32.507Z","updated_at":"2025-09-16T12:38:47.654Z","avatar_url":"https://github.com/ocworld.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pyxstr2swift\n\n[![PyPI version shields.io](https://img.shields.io/pypi/v/ansicolortags.svg)](https://pypi.org/project/pyxstr2swift/)\n[![PyPI pyversions](https://img.shields.io/pypi/pyversions/ansicolortags.svg)](https://pypi.org/project/pyxstr2swift/)\n[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://lbesson.mit-license.org/)\n\n## Description\n\nPython package for a Xcode strings file to a swift localized string file\n\nFor example,\n\n```\n/* \n  Localizable.strings\n\n  Created by Keunhyun Oh on 2018. 8. 15..\n  Copyright © 2018년 Keunhyun Oh. All rights reserved.\n*/\n\ntest = \"test_value\";\n\n```\n\nto\n\n```swift\nimport Foundation\n\nstruct Localizable {\n  static let test = NSLocalizedString(\"test\", tableName: \"Localizable\", comment: \"\") // test_value\n}\n\n```\n\nIt is available in python2.7, 3.4, 3.5, 3.6, and 3.7\n\n```bash\nfoo@bar:~$ pip install -U pyxstr2swift\n```\n\n```bash\nfoo@bar:~$ xstr2swift [-h] [--st STRUCTNAME] [-f] [-m] [-v] source target\nfoo@bar:~$ python -m pyxstr2swift.xstr2swift [-h] [--structname STRUCTNAME] [-f] [-m] source target\n```\n\n\nTo use it in Xcode build pharses,\n1. Install this module using python PIP.\nIf pip is not installed on your device, this command helps you. \n\n```bash\nfoo@bar:~$ brew install python\nfoo@bar:~$ pip3 install --upgrade pyxstr2swift\n```\n\nor\n\ninstall anaconda and set configures\nhttps://www.anaconda.com/download/\n\n2. Add a output swift file to your project\n3. Add a strings file to your project and write string keys and values\n4. Add Run Script to build pharses before Compile Sources\n5. Change Shell /bin/sh to /bin/bash (or /bin/zsh)\n6. Write shell command.\nFor example,\n```bash\n#If you use anaconda, anaconda3/bin should be added to path\n#export PATH=\"${HOME}/anaconda3/bin:$PATH\"\npip install --upgrade pyxstr2swift\nxstr2swift -f -m \"${SRCROOT}/Your project/en.lproj/Localizable.strings\" \"${SRCROOT}/Your project/Localizable.swift\"\n```\n\nMy project's shell command is that\n```bash\n# .bash_profile includes export PATH=\"${HOME}/anaconda3/bin:$PATH\"\nsource ~/.bash_profile\n\n# a conda env is already created that name is iosdev\nconda activate iosdev\npip install --upgrade pyxstr2swift\nxstr2swift -f -m \"${SRCROOT}/My Project/en.lproj/Localizable.strings\" \"${SRCROOT}/My Project/Localizable.swift\"\nconda deactivate\n```\n\n7. That' all! build Your project now!\n\n```bash\nusage: xstr2swift [-h] [-st STRUCTNAME] [-f] [-m] [-v] source target\n\npyxstr2swift needs arguments\n\npositional arguments:\n  source                source: a strings file\n  target                target: a swift file\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -st STRUCTNAME, --structname STRUCTNAME\n                        structname: a struct name in a target file\n  -f, --force           force to write a target file if already exist\n  -m, --comment         values are added as comment\n  -v, --verbose         Display console output\n```\n\n## Test\nunittest on python 2.7, 3.4, 3.5, 3.6, 3.7\n\n## References\n- https://medium.com/ios-forever/ios에서-localization하는-gorgeous-한-방법-f82ac29d2cfe\nThanks to an author of this post\n- https://github.com/ocworld/OHSwiftLocalizedString\nIt is help you to use localized strings\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Focworld%2Fpyxstr2swift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Focworld%2Fpyxstr2swift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Focworld%2Fpyxstr2swift/lists"}