-
-
Notifications
You must be signed in to change notification settings - Fork 631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed intl parsing bug when trying to parse non-string entries #1153
Conversation
@sepehr500 please consult with @vcarel regarding #1129. After that is done, I can assess this. |
lib/react_on_rails/locales_to_js.rb
Outdated
@@ -107,7 +107,7 @@ def flatten(translations) | |||
translations.each_with_object({}) do |(k, v), h| | |||
if v.is_a? Hash | |||
flatten(v).map { |hk, hv| h["#{k}.#{hk}".to_sym] = hv } | |||
elsif !v.is_a? Array # Arrays are not supported by react-intl | |||
elsif v.is_a? String # Arrays are not supported by react-intl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment does not seem appropriate anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vcarel Do you think we should support int and bools as well as strings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like int and bools are not supported -> https://formatjs.io/guides/message-syntax/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...I mean by react-intl.
I don't know, see my comment to @justin808 below. I don't feel this is going in the right direction, although my last PR is part of the problem.
The decision is up to both of you.
@sepehr500 What issue does it address? I confess I'm concerned about not exporting empty keys, because react-intl would then output the name of the missing keys instead of just blank strings. @justin808 The root cause of those issues is that we attempt to pass translations to react-intl which will never be used on React's end. Instead, shouldn't we encouraging users to cleanup their translations files and pass only what React will really use? |
@vcarel There are people who use part of their yml for react and the other part for rails. So forcing people to clean up their yml will not work because the libraries support different data types. This PR is to stop the build from failing when you have a type that can not have |
Nice job @sepehr500. @vcarel please give this a try asap. I'm pushing 11.0.7 ASAP. |
Fixed intl parsing bug when trying to parse non-string entries.
This change is