ibitcy / eo-locale

🌏Internationalize React apps 👔Elegant lightweight library based on Internationalization API
https://eo-locale.netlify.com/
MIT License
348 stars 12 forks source link

Does not handle ICU offset #69

Open Flydiverny opened 3 years ago

Flydiverny commented 3 years ago

ICU format specifies offset:N which eo-locale currently doesn't handle parsing, neither ignoring or using.

Example from ICU user guide http://userguide.icu-project.org/formatparse/messages

{num_guests, plural, offset:1 "
      "=0 {{host} does not give a party.}"
      "=1 {{host} invites {guest} to her party.}"
      "=2 {{host} invites {guest} and one other person to her party.}

eo-locale will just print the entire translation text in this case. image

This makes eo-locale hard to use with pluralisation or tools like Phrase which seem to add offset:0 by default 😅

pret-a-porter commented 3 years ago

Hi @Flydiverny thank you for the issue! Do you think this property makes sense for real use cases?

Flydiverny commented 3 years ago

I haven't seen anyone actually use it, and to be fair I don't really know why one would. I suppose there might be use for it in some localisation but with the plural syntax what I see most translations end up with just one and other regardless of being able to add more forms.

For our usage now I just made this dirty fix using patch-package since it was blocking our release 😄 image