Live data from Hacker News

Show HN: Localize React apps without rewriting code

github.com

41–50 of 75 posts

Re: Show HN: Localize React apps without rewriting code

#41
I worked on a project at Patreon to do something similar many years ago. We used a babel plugin to do the translation with as few changes to the code base as possible.

This application does not handle many important considerations for translation. Such as pluralization. In many languages there are multiple more ways to pluralize words. Russian has many different ways to pluralize. More problems will occur when you have words within words.

There is no way to do this without working on changing your codebase. I think what would work better is if you can create ICU compliant JSON.

How are you supposed to have this work in Japanese when it's RTL instead of LTR? That will require UI and localization challenges.

I think using AI to do translation will be fine for startups, but I'm not sure how well this will work on real production apps. I think significant work will be required to actually get this working:

https://stelejs.com

Re: Show HN: Localize React apps without rewriting code

#42
post #36
post #11

Earlier quoted context omitted.

> half-assed translation that was obviously made by a machine That's exactly what we want to solve. Here's the thing: It turned out, AI translates better than humans when provided with enough correct context. Both macro context, like what the product does, and micro context, like what the component represents on screen and how it relates to other components. As a result, algorithms extract the needed contextual hints…

> AI translates better than humans when provided with enough correct context This is definitionally untrue. Humans define human language; a "correct" translation is one that an experienced translator would write.

I assume that they mean that an LLM is better at translating than a high-rotation, contracted (i.e. not employed, no benefits, no stability) team of MTurk-like translators who are paid cents per translated token, are given little to no context of what they're translating beyond the individual sentence, and are dealing with 10 projects at once as quickly as possible because otherwise they wouldn't be able to make a decent wage.

But that doesn't mean that LLMs have become as good as human translators, but rather that corporations have set up a system that treats translators as if they were machines and then we act surprised when machines are better at acting machine-like than humans.

Re: Show HN: Localize React apps without rewriting code

#43

This needs to integrate with translation management formats/services instead of an LLM—it might work for some cases but will absolutely butcher jargon translations! In its current state it is worse than useless for sites managing content geared for technical/professional audiences.

Perhaps I could've communicated this better, but we've built Lingo.dev Compiler for web apps and user interfaces, not for technical/professional content.

And since we had to exclude certain terms like "Lingo.dev Compiler" itself from i18n, we've shipped support for data-lingo-skip and data-lingo-override- as well.

Regarding using LLMs for production content localization, I recommend checking out how Reddit translates their entire user-generated content base in 35 languages using AI:

https://techcrunch.com/2024/09/25/reddit-is-bringing-ai-powe...

If it already works great for Reddit today, I believe it's safe to assume it will become accessible to the wider audience soon as well.

Re: Show HN: Localize React apps without rewriting code

#44
Many moons ago, a small project called GNU Gettext did this. It worked by annotating the translatable string literals like this _("SomeLine"), then a separate compiler extracted all the strings into a `.po` file.

And then you just translated them. The English text, essentially, becomes your string ID.

It worked super well, with very low friction for programmers. You didn't have to invent an identifier when writing code, and then switch to a horrible JSON with indefinitely long lists of strings.

But somehow, the world chose the horribly bad "string IDs" method of translation. Sigh.

Re: Show HN: Localize React apps without rewriting code

#45

I worked on a project at Patreon to do something similar many years ago. We used a babel plugin to do the translation with as few changes to the code base as possible. This application does not handle many important considerations for translation. Such as pluralization. In many languages there are multiple more ways to pluralize words. Russian has many different ways to pluralize. More problems will occur when you ha…

I think modern Japanese is LTR, but besides that - I believe the project you worked in the past solves an important problem.

Besides pluralization (and e.g. Arabic having 6 forms zero/one/two/few/many/other), turned out number internationalization and currency conversion are big next challenges the community wants to address next.

> create ICU compliant JSON.

I think this is an excellent idea. I have a feeling in the future we will need ICU v2.0, sort of, but unfortunately it's an extremely hard problem and the probability to fail is pretty high (looks like project fluent is not actively maintained anymore: https://github.com/projectfluent/fluent)

Re: Show HN: Localize React apps without rewriting code

#46
post #40

> essentially rewriting your entire codebase before you can even start translating I’d say it just takes a few prompts in Cursor or a similar tool. Then, you simply ask it to translate into other languages. Here’s how I did it for one of my projects - a quantum optics simulator: https://p.migdal.pl/blog/2025/04/vibe-translating-quantum-fl... Doing it at runtime might make sense for a typical translation. But for scie…

Yep, Cursor indeed helps!

(Here's a battle tested prompt example we found working pretty nicely with claude o3 + claude 3.7: https://lingo.dev/cli/extract-keys)

> Then, you simply ask it to translate into other languages.

Yep! With Lingo.dev Compiler though, we were scratching our own itch, and particularly it was maintenance of the localized code. Turned out, extracting is fine, but then further down the road we found ourselves digging through the code and jumping back and forth between the code and i18n files.

I think it won't be a problem anymore after "Just In Time software" becomes a thing, and vibe coding tools seem to be getting us closer to that point.

Great example!

Re: Show HN: Localize React apps without rewriting code

#47
post #44

Many moons ago, a small project called GNU Gettext did this. It worked by annotating the translatable string literals like this _("SomeLine"), then a separate compiler extracted all the strings into a `.po` file. And then you just translated them. The English text, essentially, becomes your string ID. It worked super well, with very low friction for programmers. You didn't have to invent an identifier when writing co…

Good point. There are JavaScript tools that do that for js devs, but since oftentimes you end up having links and nested elements in the code, wrapping becomes problematic and hard to maintain at scale.

I think there's a chance compile-time, AST/CST solutions might be the ultimate, O(1) i18n approach that doesn't distract. Ideally it should come out of the box with the framework, but perhaps this future is a little bit too far away just yet.

Re: Show HN: Localize React apps without rewriting code

#48
post #14
post #8

Please, please, please, do not use auto translators to localize your pages. There's nothing worse than an half-assed translation that was obviously made by a machine. Auto-translated sentences are awkward and I feel extremely insulted every time someone chooses to impose this garbage watered-down version of their products on me. Hire a translator or don't localize your site.

And just say "sorry" to all the people asking you for translation of your great product ?

Hire a translator then, don't give us a garbage localization and call it a day.

It's like if someone requested a feature and you gave them the first thing an LLM spewed out when asked to code it, without review.

You should at least have someone on your team be able to understand the program's output and correct it when things inevitably sound off.

Re: Show HN: Localize React apps without rewriting code

#49
post #8

Please, please, please, do not use auto translators to localize your pages. There's nothing worse than an half-assed translation that was obviously made by a machine. Auto-translated sentences are awkward and I feel extremely insulted every time someone chooses to impose this garbage watered-down version of their products on me. Hire a translator or don't localize your site.

Would you literally rather have nothing than a poor translation?

Yes, very much so.

If you're bilingual you must know this feeling of reading an awful translation; of knowing someone wanted to offer their product to people speaking your language but couldn't be bothered to do it well, and so used google translate and called it a day, thinking those dumb users won't notice the slop they're feeding them. Fuck that.

Re: Show HN: Localize React apps without rewriting code

#50
post #11
post #8

Please, please, please, do not use auto translators to localize your pages. There's nothing worse than an half-assed translation that was obviously made by a machine. Auto-translated sentences are awkward and I feel extremely insulted every time someone chooses to impose this garbage watered-down version of their products on me. Hire a translator or don't localize your site.

> half-assed translation that was obviously made by a machine That's exactly what we want to solve. Here's the thing: It turned out, AI translates better than humans when provided with enough correct context. Both macro context, like what the product does, and micro context, like what the component represents on screen and how it relates to other components. As a result, algorithms extract the needed contextual hints…

Do you speak more than one language? Because claiming "AI translates better than human" is ludicrous. Anyone with a modicum of experience on browsing the internet can immediately tell when a page was auto-translated, based on how awkward or outright nonsensical some of the text can be.

Also, I doubt other translators work by localizing

elements one by one, without context. The entire HTML is localized, semantic and all. I fail to see how translating JSX instead of HTML can improve the situation much.

Post reply on HN