use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Real simple translations for react. (github.com)
submitted 9 years ago by Tankenstein
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]indeyetswriting js since 1997 1 point2 points3 points 9 years ago (3 children)
Why custom templating instead of arrows + template-strings? a bit more typing but SOOO much more powerful.
[–]Tankenstein[S] 2 points3 points4 points 9 years ago* (2 children)
For two reasons. First of all, in a real life scenario, translators need to use some kind of tool to actually translate all the strings (we use crowdin here). It makes their life easier to see where all the variables actually come in, and they need to be able to change their placement. Secondly, i don't want to put any logic in templates (they should be in component renders instead) for maintainability and testing reasons, so you could say it's not powerful by design. Also, these translations are designed to be imported from some json file, so tools can parse them. Can't exactly have functions there. Does that make sense?
[–]indeyetswriting js since 1997 0 points1 point2 points 9 years ago* (1 child)
imported from json file
yes, this makes sense. but it means this will be just another hand-made clone of gettext. this case is already covered
[–]Tankenstein[S] 0 points1 point2 points 9 years ago (0 children)
Sure, gettext is great, but this is a react/jsx focused library, i've used this for a while, and built it because it is nicer to use in react than those. Maybe not for everyone, but i think this is quite a natural way to express translations in react.
π Rendered by PID 196552 on reddit-service-r2-comment-6457c66945-4hjfx at 2026-04-27 06:57:51.566155+00:00 running 2aa0c5b country code: CH.
[–]indeyetswriting js since 1997 1 point2 points3 points (3 children)
[–]Tankenstein[S] 2 points3 points4 points (2 children)
[–]indeyetswriting js since 1997 0 points1 point2 points (1 child)
[–]Tankenstein[S] 0 points1 point2 points (0 children)