Re:Yagni Exceptions (2021)
by iLoveOncall on Monday October 17, 2022 @01:06PM
(#33236539)
It does the same in one of the two that I mentioned (Angular I believe), but you still need to mark plurals and other stuff like that.
Here is an example about a basic case that you will encounter multiple times per page:
<span i18n="Pretty update timestamp|Update timestamp prettyfied accompanied by user gender@@prettyUpdateTimestamp">Updated: {minutes, plural,
=0 {just now}
=1 {one minute ago}
other {{{minutes}} minutes ago by {gender, select, male {male} female {female} other {other}}}}
</span>
Re:Yagni Exceptions (2021)
by SebastianKra on Monday October 17, 2022 @07:03PM
(#33240659)
Does this work well?
What happens when you need to make a change in the english version? Do you just search/replace through all the translations?
Does django do anything to make this easier, or does it work with any i18n library?
There's also "translate to English", so you can instead treat it directly as a key and use that, or treat the English text as a key and change/add to the file if it's just something like a typo.
Don't recall about the second, we only had translations on one site and it's been a few years.
In django (python), the key is just the English text (with optional extra context), and if it doesn't find a translation for the target language it dumps that text back out. You don't need to go anywhere else until actually doing the translating.