3 ms·
> I have used the Angular one and the Laravel one, and both are a chore to use, because they interrupt your flow. If I'm writing the view of my component, I don
by Izkata 4y ago
> I have used the Angular one and the Laravel one, and both are a chore to use, because they interrupt your flow. If I'm writing the view of my component, I don't want to have to switch to another file, think of a key that identifies that text well enough and then translate the text, thinking of potential plurals and others. I just want to write my damn text.
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.
- SebastianKra 4y agoDoes 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?
- Izkata 4y agoThere'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.
- iLoveOncall 4y agoIt 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>