Skip to content

ConfuseIous/Xcode-Localizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iOS - Localiser

⚠️ NOTE

This script has been superseded by AutoLocalizer, a free GUI that translates your strings locally using an open Large Language Model rather than ChatGPT. Not only does this require less effort, it's also more private as your data doesn't leave your Mac at all. This script will still continue to work for the foreseeable future if you prefer to use ChatGPT.

A simple script to localize your Localizable.xcstrings file with ChatGPT

Usage

  1. Open your Localizable.xcstrings file with a text editor and copy it into data.json.
  2. The ChatGPT API costs money and isn't really necessary here, so instead, use extract.py to extract all strings from your project and translate them with ChatGPT. Example prompt:
Please help me translate all these words/phrases/sentences into German, maintain all casing unless inappropriate. This is all text used in an app.
Return only the translated text, don't include the original. Do not include surrounding quotation marks. Maintain line breaks and any added indentation.

For cases containing:
- incomplete sentences (unless they happen to be headings or sensible phrases)
- text that contains only symbols.
Return the original text only, since this would not be logical to translate.

Text:
  1. Copy the output into a new text file, eg: sentences.txt
  2. Run merge.py. This will update your data.json file. Example command:
python3 merge.py data.json sentences.txt de --no-trim

To add more languages, repeat steps 2-5.

  1. Finally, open your Localizable.xcstrings file with a text editor and replace its contents with the output of merge.py (which you will find in data.json)

Contributing

Pull requests are welcome. I did all this in like 30min so there are almost certainly edge cases I haven't thought of.

License

MIT

About

A simple script to localize your Localizable.xcstrings file with ChatGPT

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages