Giter VIP home page Giter VIP logo

geepeetto's Introduction

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

Installation

  1. Clone the repository:
git clone [email protected]:snowzurfer/geepeetto.git
  1. Install the OpenAI Python library:
pip install openai

Demo

Geepeetto.demo.2-mp4.mp4

Usage

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:

"Key" = "Value";

Example:

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

* 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

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 - Alberto Taiuti

License

See LICENSE.

geepeetto's People

Contributors

p3d-dev avatar snowzurfer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.