@coffeeandfun/extension-translator
v1.0.3
Published
A module for translating i18n JSON files using OpenAI's ChatGPT, specifically designed for browser extensions.
Downloads
13
Maintainers
Readme
@coffeeandfun/extension-translator
Welcome to @coffeeandfun/extension-translator! This project helps you translate JSON files using OpenAI. It's easy to install and use. Follow the steps below to get started.
Table of Contents
Installation
First, you need to install the project globally on your system. Open your terminal and run the following command:
npm install -g @coffeeandfun/extension-translator
This will install the project globally, making it available to use from any directory on your system.
Usage
To use the project, you can run the translate command directly from your terminal:
extension-translator <YOUR_API_KEY> <startDir> <sourceLang> <targetLang1,targetLang2,..>
Replace <YOUR_API_KEY>, , , and <targetLang1,targetLang2,..> with your actual API key, start directory, source language, and target languages.
Examples
Here are some examples to help you understand how to use the project:
Basic Usage:
If you have a JSON file in the examples/en directory and you want to translate it to Dutch (nl) and German (de), you can run the following command:
My il8n is located at demo/_locales/.
extension-translator YOUR_API_KEY demo/_locales en es,et
This will translate the files in the demo/_locales/en directory to the demo/_locales/nl and demo/_locales/de directories.
Including HTML Entries:
If you want to include HTML entries in the translation, you can add the --includeHtml flag:
extension-translator YOUR_API_KEY demo/_locales en nl,de --includeHtml
Formatting Code
To keep your code clean and consistent, you can use Prettier. We've included scripts to help you format your code easily.
Format Code:
To format your code, run the following command:
npm run format
This will automatically format all your code files.
Check Code Formatting:
To check if your code is formatted correctly without making any changes, run:
npm run format:check
This will check the formatting and report any issues.
Contributing
We welcome contributions! If you'd like to contribute, please follow these steps:
- Fork the repository.
- Create a new branch.
- Make your changes.
- Submit a pull request.
Check Out Helperbird and Coffee & Fun
If you found this project useful, be sure to check out our other projects at Helperbird and Coffee & Fun:
Helperbird
Helperbird is a browser extension that gives you the features to make the web more accessible and productive. Whether you need help with reading, writing, or accessibility, Helperbird has got you covered. Learn more at Helperbird.
Coffee & Fun
Coffee & Fun is dedicated to creating useful and fun tools for everyone. From accessibility enhancements to productivity boosters, we aim to make your online experience better. Discover more about our projects and what we do at Coffee & Fun.
License
This project is licensed under the MIT License. See the LICENSE file for more details.
Thank you for using @coffeeandfun/extension-translator! If you have any questions or need further assistance, feel free to open an issue or contact us.