You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
first of all: thanx for your awesome work on this 🙏 - really helpful tool!
I came across a tiny "incompatibility" issue with Rails' conventions when using i18n with react-intl: the special role of the count variable working as both, a variable for interpolation and as a key to pick up the right pluralization is not taken into account by react_on_rails (see the "pluralization" section in the Rails i18n docs for details on this).
A short example
With an exemplary locales file like this:
Depending on the count variable, Rails automatically picks up the right pluralization plus the value of count can also be interpolated into the message.
This would end up in the generated defaults.js file in approximately this format:
☝️ this means I have to explicitly append the one and other bits in order to match a valid translation ID, otherwise react-intl won't find it.
My current workaround for this would look like this:
This works but is a) a bit verbose and b) sadly not using the rich possibilities Format.js would offer for solving all these problems.
I would ❤️ react_on_rails to be able to stay consisted with the way Rails deals with pluralization here and e.g. transparently parse it accordingly under the hood.
Do you have any thoughts on this?
The text was updated successfully, but these errors were encountered:
Hi 👋
first of all: thanx for your awesome work on this 🙏 - really helpful tool!
I came across a tiny "incompatibility" issue with Rails' conventions when using i18n with
react-intl
: the special role of thecount
variable working as both, a variable for interpolation and as a key to pick up the right pluralization is not taken into account byreact_on_rails
(see the "pluralization" section in the Rails i18n docs for details on this).A short example
With an exemplary locales file like this:
I can do this in Rails:
Depending on the
count
variable, Rails automatically picks up the right pluralization plus the value ofcount
can also be interpolated into the message.This would end up in the generated
defaults.js
file in approximately this format:☝️ this means I have to explicitly append the
one
andother
bits in order to match a valid translation ID, otherwisereact-intl
won't find it.My current workaround for this would look like this:
This works but is a) a bit verbose and b) sadly not using the rich possibilities
Format.js
would offer for solving all these problems.I would ❤️
react_on_rails
to be able to stay consisted with the way Rails deals with pluralization here and e.g. transparently parse it accordingly under the hood.Do you have any thoughts on this?
The text was updated successfully, but these errors were encountered: