eugene-manuilov / react-gettext

Tiny React library for implementing gettext localization in your application.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example in README is non-i18n

yarons opened this issue · comments

Line 237:

this.context.ngettext('day ago', 'days ago', numberOfDays);

This is a bad example of i18n string because in Hebrew (and in several other languages) we don't use the same word order so unless there's a placeholder in there I can't translate it so that Hebrew native speaker will understand.

A better approach would be (assuming I'm not messing up the parameters):

this.context.ngettext('{numberOfDays} day ago', '{numberOfDays} days ago', numberOfDays);

Another solution can be changing the example :)

Hi @yarons

thanks for reporting this, but the purpose of that example is not to teach you how to property internationalize your project. It just demonstrates how to use this library by showcasing its features.

If you still think it should be fixed and want to help, feel free to send a PR with the required changes and I'll accept it.

Hey @eugene-manuilov,
I understand yet I believe that an i18n oriented project should set a good example to its users 😄

How about adding the parameter? Or at least explaining this is not a good practice?
BTW did I add the parameter correctly? Because I can make a PR out of that.