6 ms·
Show HN: ChatGPT-i18n – Translate websites' locale json files with AI assistance
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 https://github.com/ObservedObserver/chatgpt-i18n
online app: https://chatgpt-i18n.vercel.app/ https://chatgpt-i18n.vercel.app/
- jancizmar 4y agoHey, we just working in ChatGPT or other openAI models integration to Tolgee localization platform. Cool thing about this is that we have lot of context about the strings, since our integrations (including in-context localization). That way we can provide super accurate results. Stay tuned. https://tolgee.io https://tolgee.io
- knodi123 4y agoI wrote a JS plugin over a decade ago that would scan your page for strings, use google's free translate API to translate it to the target language, and save the translations to a local xx.yml file in the locales directory. It was designed for rails, since I needed to pick something for the backend local file caching, but I could rewrite it for other backends in an hour. I 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!!
- loa_observer 4y agowow, that sounds great. I love the idea that it can generate locale files direct from a webpage. It's a pity that it is not available now.
- leros 4y agoI did something similar. New strings would get Google Translate translations when we merged changes in. Then it would kick off a translation job through a human translation service. We'd have to periodically poll that service to pull translations in. Then once we pushed to QA, our in-house teams could look at the app and tweak the translations. It worked most of the time, but the lack of context around what the strings were for did result in bad translations.
- gl-prod 4y agoMissed the opportunity on having your webpage translated.
- gl-prod 4y agoWhen I tried to translate this { "title":"hello" } I got { "título": "hola" } Why did it change the key?
- deleted 4y ago[deleted]
- ravenstine 4y agoDepends on how they engineered the prompt. 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. { "title":"hello" } Please translate the values into Spanish without altering the keys of the JSON object. ``` Responded with: ``` { "title":"hola" } ``` EDIT: Looks like this is the prompt being used: `Translate a i18n locale json content to ${targetLang}.` Just my opinion, that prompt needs improvement.
- travisjungroth 4y agoEven one example in the prompt would go a long way.
- DANmode 4y agoJust ask for what you want :]
- travisjungroth 4y agoI’m not sure what you mean. I’m saying that adding one example to the prompt given to ChatGPT would improve accuracy. In my experience, examples work better than instructions. 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”.
- basic_banana 4y ago
- ashishb 4y agoSometimes back I looked into and compared Google translate and chat GPT for this. Seems like Google translate is superior for the translating English into languages that I knew (Spanish and Hindi). I ended up writing a small GitHub Action to automate this for hobby apps. https://github.com/ashishb/android-auto-translate https://github.com/ashishb/android-auto-translate
- SrslyJosh 4y ago> I wanted to use a more efficient and accurate translation tool 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.
- letmevoteplease 4y agoFor Japanese, at least, ChatGPT is better than Google Translate because it considers the context of each sentence, while Google Translate translates each sentence independently. DeepL is still the best, though.
- hombre_fatal 4y agoGoogle Translate is surprisingly bad when you try to do real work with it, especially its community verified corrections which are guaranteed to be worse. In Spanish, community verified translations never have accents. Chatgpt and DeepL are both better. They understand context much better and more likely use real expressions over literal translations.
- potatolicious 4y ago+1, especially when it comes to localizing UI text. The trick with UI text is that in many languages it's not grammatically correct to begin with (GUI labels are rarely expressed in full sentences), and the terseness introduces vast amounts of ambiguity in meaning. 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.
- koreth1 4y ago> 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. 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.
- gorbypark 4y agoWhile it's a pretty cool use of ChatGPT, there are lots of options for translating json locale files. I recently wrote a post about doing it in React Native projects, but the same concept could be applied to any framework, really. The npm package "json-autotranslate" can be installed as a CLI tool, and can hook into a fair few different translation services. I generally find using the DeepL-free provider works extremely well. https://dev.to/mikehamilton00/react-native-expo-automatic-machine-translation-5ao https://dev.to/mikehamilton00/react-native-expo-automatic-ma...
- EMM_386 4y agoInteresting. 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 https://github.com/mololab/json-translator
- basic_banana 4y agoThis is not a self promotion post, I just want my experience working on i18n better. It is welcome to share your favorite tools that you like!
- berjin 4y agoCool idea. I've used Github Copilot to do a lot of translations but this looks much easier. 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.
- deleted 4y ago[deleted]
- Rauchg 4y agoSorry about the bad experience, can you share what errors you ran into? Feel free to email: rauchg@vercel.com We’ll try to debug by running the demo ourselves in the mean time!
- layer8 4y agoI’m always wary of automated translation, because in the general case you need a native speaker who understands the specific application context, in order to end up with a truly fitting and idiomatic translation. However, with ChatGPT there is at least some room for improvement over traditional automated translation, in that you could explain the application context to ChatGPT, which presumably would increase the likelihood of it producing a fitting translation. Of course, a translation tool using that approach would have to be based on an input format that, in addition to the text to be translated, provides a description of the application context in which it occurs. This is something a human translator typically needs as well when they don’t have access to the application itself.
- Gigachad 4y agoEven human written outsourced translations are pretty unreliable as the translators don't understand the software and end up translating key terms differently across the app while the English version is careful to always refer to the same thing with the same terminology.
- layer8 4y agoTranslation is a high-skill job and isn’t payed appropriately anymore nowadays. So getting subpar results when outsourcing to a random translator probably isn’t surprising.
- acdha 4y agoYou get what you pay for. I’ve worked with great translators — the kind who came up with new terms for subjects not previously discussed in the target languages – but they’re not cheap since you’re talking a human with multiple non-trivial skills. 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.
- petodo 4y agoTo be fair even the greatest translator can't make miracles, if he is not provided with reference/documentation, I am often translating completely in blind, just guessing because client doesn't bother to provide any reference.
- rcarr 4y agoThe official sponsor of i18next actually offer json translation for free here: https://translate.i18next.com https://translate.i18next.com