Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/snowzurfer/geepeetto
Localize your iOS App strings automatically using ChatGPT 🤖 🤥!
https://github.com/snowzurfer/geepeetto
Last synced: about 2 months ago
JSON representation
Localize your iOS App strings automatically using ChatGPT 🤖 🤥!
- Host: GitHub
- URL: https://github.com/snowzurfer/geepeetto
- Owner: snowzurfer
- License: mit
- Created: 2023-04-12T04:30:20.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-04T01:47:21.000Z (over 1 year ago)
- Last Synced: 2023-10-04T13:52:25.438Z (over 1 year ago)
- Language: Python
- Size: 11.7 KB
- Stars: 16
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Geepeetto
Geepeetto is a Python script that automates the process of localizing iOS apps. It uses OpenAI ChatGPT to generate translations of given strings into a list of languages, and then copies the localized strings into the appropriate .lproj folders of your Xcode project.
## Requirements
* Python 3.6 or higher
* OpenAI Python library ()
* An OpenAI API Key## Installation
1. Clone the repository:
```bash
git clone [email protected]:snowzurfer/geepeetto.git
```2. Install the OpenAI Python library:
```bash
pip install openai
```## Demo
https://user-images.githubusercontent.com/6337894/231356028-9d04da22-263f-464b-867f-1f393e9a4d5a.mp4
## Usage
```bash
python geepeetto.py input_file assets_folder [optional arguments]
```The first time you run the script, **provide the OpenAI API key via the `--openai-key` argument**. This will be written on disk to `.key` and used in subsequent calls, so you only need to provide it once.
### Positional Arguments
* `input_file`: Path to the input file containing the strings to localize, in English (US).
* `assets_folder`: Path to the assets folder in the Xcode project.
### Optional Arguments* `--openai-key`: API key for OpenAI. If not provided, the script will use the key you provided before.
* `--languages-file`: Path to the file containing the list of languages to translate to. Defaults to `./languages_list.txt`.
* `--extra-information`: Extra information to include in the instructions.
* `--template-file`: Path to the template file. Defaults to `./chatgpt_template.txt`.
* `--model`: The OpenAI model to use. Defaults to `gpt-4`.## Input Files
### Input Strings File
The input_file should contain the strings to localize in English (US). Each string should be in the format:
```bash
"Key" = "Value";
```Example:
```bash
"AccountView.SubscriptionSection.RedeemCode" = "Redeem code";
```The recommended usage is to localize strings while you develop your app, as you go, rather than translating them
all in one chunk, but it should work in that case too.### Languages List File
The `languages_file` should be a plain text file containing one language per line, without empty lines. Each line should consist of the language name, followed by a space, a hyphen, another space, and the corresponding language code.
Example:
```bash
* French - fr
* Canadian French - fr-CA
* German - de
* Italian - it
* Malay - ms
* Brazilian Portuguese - pt-BR
* Portugal Portuguese - pt-PT
* Spanish - es
* Latin American Spanish - es-419
* Chinese (Simplified) - zh-Hans
```Make sure to use the language code for each language the way that Apple expects them.
## Example
```bash
python geepeetto.py input_strings.txt MyProject/Assets --openai-key your_openai_api_key --languages-file languages_list.txt --extra-information "When translating, don't translate the words Superstar, Maccio, or Catapult since they are the App's main words."
```After running the script, the generated translations will be written to `translations.txt`, and the localized strings will be copied to the appropriate `.lproj` folders in the specified Xcode project's assets folder.
## Authors
[@snowzurfer](https://github.com/snowzurfer) - Alberto Taiuti
## License
See LICENSE.