Giter Club home page Giter Club logo

gpt-i18n-translator's Introduction

gpt-i18n-translator

gpt-i18n-translator is a Node.js script that compares two language files and adds missing translations. It uses the OpenAI API to generate the missing translations.

Installation

Install Globally

To install the script globally, use the following command:

npm install -g gpt-i18n-translator

Setup

  1. Create the .env File:

    Create a .env file in the current directory by copying the provided .env.example file:

    cp $(npm root -g)/gpt-i18n-translator/.env.example .env
  2. Edit the .env File:

    Open the .env file in a text editor and add your OpenAI API key and model information:

    OPENAI_API_KEY=your_actual_openai_api_key
    OPENAI_MODEL=your_actual_openai_model (e.g. gpt-4o)

Usage

Run the script with the following parameters: target language, path to the original language file, and path to the foreign language file to be updated.

gpt-i18n-translator <target_language> <original_file_path> <foreign_file_path>

Example

Suppose you want to add missing translations from German to English:

gpt-i18n-translator en ./path/to/de/translation.json ./path/to/en/translation.json

Parameter Explanation

  • <target_language>: The target language for translation (e.g., en for English).
  • <original_file_path>: Path to the original language file (e.g., ./path/to/de/translation.json).
  • <foreign_file_path>: Path to the foreign language file to be updated (e.g., ./path/to/en/translation.json).

Development

Local Installation

If you want to develop or customize the script locally, you can install it in your project directory:

yarn install

DEV-Mode

Use

yarn dev

To test local installation.

License

This project is licensed under the MIT License.

Author

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.