🔥 Auto-translate via Google (free) or OpenAI (needs API key)
- Collects and translates the
translatefunctions - Default source translation JSON files from
public/locales/endirectory - Must to have
OPENAI_API_KEYin ENV if theTRANSLATOR_SERVICEis set toopenai - Alternative translation using Google translate (doesn't need any API Key)
- If there is no namespace provided in the
translatefunction then uses thecommonas default - Possible translation methods: chat, text
- Possible translation services: google, openai
- Create a separated directory in the
public/locales/named "translation" to avoid overwrite or delete already existing translations - Has 3 modes: Collect and Translate, Only Collect, Only Translate
- Accept parameters and automatically parse them if they are provided
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| docs | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | May 16, 2023 9:38pm |
@Cs4K1Sr4C is attempting to deploy a commit to the reworkd Team on Vercel.
A member of the Team first needs to authorize it.
This is awesome @Cs4K1Sr4C!
@asim-shrestha @awtkns
So if we have a new static text to translate just easily use the translate("{key}", "{default text in English}", "{?namespace?}") syntax.
If you run the translator script (npm run translate) it will find and process the mentioned formula in every .ts and .tsx file;
It will extract key/text/namespace combinations into an array then translates the text to the selected target language.
So you can use en as source and en as target and it will create the complete English translation and its json files; After overwrite the old files - and move the new ones if they are - in the public/locales/en/ directory just easily run again the translator script with an other target language to create the desired complete translation.
When the extraction is done it will change the source code of the file - where from the translatable part has been extracted - to the single translate("{key}", "{?namespace?}") syntax.
Doesn't really belong in the main repo. Closing as a result, you can find this project here: https://github.com/Cs4K1Sr4C/ATi18n