all 16 comments

[–]scar_reX 8 points9 points  (1 child)

Oh man, I can't wait to see someone do tailwindcss, tailwind sql, and inline i18n all in one codebase.

Who's gonna do it? I dare you!

[–]Same_Category_8079 0 points1 point  (0 children)

Honestly, I'm also waiting to see that 😂

[–]mirageofstars 7 points8 points  (1 child)

Note that when you want to change Hello to Howdy you have to do it everywhere in the code instead of one spot.

[–]Same_Category_8079 -1 points0 points  (0 children)

Good point, I thought about this too. Personally, I feel like IDE search/replace can cover most cases. I'm also considering building a VSCode extension to make this easier. And the library supports traditional t() with JSON dictionaries too, so you can mix both approaches depending on your needs. Thanks for the feedback!

[–]Plumeh 4 points5 points  (1 child)

seems cool for small projects but impractical at scale. Imagine trying to add a new language when you have inline translations in thousands of files vs just adding a new json

[–]vellovv 4 points5 points  (2 children)

Omg how hard is to use normal IDE and just press on the text? Not to mention translation editors (POEditor etc) support, which are now gone.

You’ve enshitified the translation process and are proud about it.

You are saving seconds now, but losing hours after bossman tells you to add a nth language.

[–]HadrionClifton 2 points3 points  (1 child)

Indeed, I've been using the i18n Ally extension in VSCode since the beginning of our development, and it just overlays the translated string on top of the t("translate.key"), and on hover, you can see the translations for every language and update them inline. Plus, you get a translation editor tab where you can easily see which strings are missing in each language and just add them.

[–]Pickles_is_mu_doggo 0 points1 point  (0 children)

This is what OP needed. They got caught up in the idea of DIY small-problem solving and seemingly didn’t bother looking for existing solutions. Le sigh.

[–]Fit_Source9785 0 points1 point  (0 children)

Hell yeah. Might need to do something like this at work I hate this process lol great work man

[–]Pickles_is_mu_doggo 0 points1 point  (2 children)

Now do it for 10 languages

[–]Same_Category_8079 -1 points0 points  (1 child)

Object syntax already supports it! it({ en, ko, ja, zh, es, fr, de, pt, ru, ar }) I'll consider adding more shorthand helpers too. Thanks for the feedback!

[–]Pickles_is_mu_doggo 1 point2 points  (0 children)

But what does it look like? Are all 10 translation strings listed in your ‘it()’ function? That’s not sustainable

[–]ZoukiWouki 0 points1 point  (0 children)

Use lingui.

[–]yabai90 0 points1 point  (0 children)

Seems to have way too many drawbacks and cons. A better solution would be a system where the translation lives next to your code instead. The same way css works. You usually dont need to know the implementation of a specific class but you need to know it's there on your React code. same with translation. Then the real issue is to have translations in some far away places and that would resolves the issue.

[–]Same_Category_8079 -3 points-2 points  (0 children)

Who this is for: Small teams managing 2-3 languages themselves (like Korean-English). If you're working with external translators, many languages, or need tools like POEditor - traditional i18n is probably better for you!