Show HN: ChatGPT-i18n – Translate websites' locale json files with AI assistance (github.com)
I build this app because I was tired of using Google Translate to translate my locale files (i18n). I wanted to use a more efficient and accurate translation tool. ChatGPT, however, always break my json and cannot translate large contents. So I build this app to solve these problems. Hope it can save your time.
github: https://github.com/ObservedObserver/chatgpt-i18n
online app: https://chatgpt-i18n.vercel.app/
42 comments
[ 2.8 ms ] story [ 83.0 ms ] threadI would browse our sites in french, spanish, and english, and then we just had a fluent expert flip through the generated yml files and make any tweaks they felt were necessary. The translation wasn't perfect, but it was pretty good, and they were table to do a whole site translation in less than an hour and feel confident they got everything.
It died from config rot, but it worked great until google changed some APIs. Ah, I just looked it up - 13 years ago!!
It worked most of the time, but the lack of context around what the strings were for did result in bad translations.
Doing it directly with ChatGPT was pretty straight forward.
```
The following is a piece of JSON where the values are strings in the English language.
Please translate the values into Spanish without altering the keys of the JSON object.```
Responded with:
```
```EDIT: Looks like this is the prompt being used:
`Translate a i18n locale json content to ${targetLang}.`
Just my opinion, that prompt needs improvement.
The request and response that I replied to would be a fine starting point. It already gets across keys aren’t translated but values are. I’d add a few more entries to show other things like “match the punctuation/capitalization level” and “use the source text for untranslatable names”.
I ended up writing a small GitHub Action to automate this for hobby apps. https://github.com/ashishb/android-auto-translate
ChatGPT more accurate than Google Translate? I find that hard to believe. The obvious solution to make the process more efficient would be to use the Translate API. Seems like something you could script in a couple of hours, tops.
Chatgpt and DeepL are both better. They understand context much better and more likely use real expressions over literal translations.
Like take a "Submit" button - it can mean anything from "send this request in" to "grovel in front of me" depending on context. Human localizers struggle with this, especially when the source files they're provided with do not have sufficient context (and they cannot see the GUI in-context) to infer meaning. Existing translation engines are worse.
And sometimes the lack of context is self-inflicted. My company just started evaluating translation services and as part of that process, we sent some of our strings to the candidate companies. Many of our strings are in Java properties files, which we've annotated with comments to give context.
Yesterday I got a request back from one of them: please convert the strings to a JSON file. Which is on some level the equivalent of, please strip out all the comments you added for our benefit.
Yes, I get that our strings will be fed into translation software. But still, we made the effort to give them context and they told us to get rid of it.
I'm surprised you haven't run into problems with community verified translations. They're so predictably poor that I'd stop using GTranslate just to avoid that.
I've used json-translator in the past.
It supports Google Translate, Bing Microsoft Translate, Libre Translate, and Argos Translate.
https://github.com/mololab/json-translator
It's a pity Vercel has a cli login wall to even run the app. I tried the Github option and it didn't work. My first impression of Vercel is not good. Unfortunately the demo app threw some errors in the console on file I tested with.
We’ll try to debug by running the demo ourselves in the mean time!
I suspect that the AI tools are going to continue to split that into low-end mass market where businesses don’t care about quality as much as price and a rarified high-end market where a few people hang on to the skilled work.
One would think TM and glossaries are the very basic requirements when requesting translation to update already existing translation, but I agree some companies don't provide these, which can cause inconsistencies when changing translator/company.
https://translate.i18next.com