-
Notifications
You must be signed in to change notification settings - Fork 660
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
Intl Support #23
Comments
Intl is super important for us, and unfortunately, it's a blocker for my team. The Polyfills we tried before switching to jsc-intl weren't complete (they allowed compilation/basic testing, but didn't work in actual localized environments). Is there a plan for when Intl might be discussed again for the Hermes Engine? |
It will help us prioritize work on
I don't remember the exact conversation we had about @avp or @ridiculousfish have more context on this |
Enabling I18n for apps regarding:
https://github.com/formatjs/react-intl (> 10K Stars)
As pointed out by @fbartho, polyfilling doesn't work properly. Every other solution is incomplete at least regarding locale rules around the world.
If it is just about binary size, it could be done like JSC: a variant with Intl.
However, lots of functions that are part of the ECMAScript 2015, are dependent on Intl to function "properly", or at least need a locale aware implementation anyway. For example:
|
One thing to add: Intl works perfectly out of box on iOS as it has to use its |
That's a great point @TheTimeWalker -- this is a "platform compatibility issue" where iOS & Android's JavaScript engines differ. (Nit: iOS uses the JavaScriptCore engine rather than the V8 engine, but your point is the same). I guess the key question is: What is this project's driving mandate with regards to differences between iOS & Android? -- Presumably the expectation is that there shouldn't be significant framework-level differences? Especially not in things that can't be polyfilled-well. Unfortunately, the existing Polyfills in this case are insufficient. React-Native developers targeting more than one language will be stuck on jsc-intl unless this feature is provided by Hermes! |
As @danilobuerger clearly states, there is no complete and reliable JS-only solution to this. For I18n apps |
Strong +1 for including At the moment the lack of The lack of For our investment app, date/time and currency formatting are the primary drivers, though relative time rules, plural rules, and list formats would all undeniably help offer a more polished user experience. Needing to include a custom JSC build on Android is non-trivial and really shouldn't be necessary for such a fundamental piece of functionality! If Hermes is worried about size, some RN config to optionally exclude If Hermes did fully support I18n certainly is darn complicated, which is precisely why it's so important that the platform itself offers first-class support for |
This comment has been minimized.
This comment has been minimized.
Intl is a major concern for all the apps I have ever worked on. Today we're using I'd be curious if someone could tell us what Facebook uses to handle intl in their React Native apps? Specifically for number and date formatting. |
Summary: This is used by the generateReleaseBuildConfig, which is needed when fbjni is included as a submodule. Pull Request resolved: facebookincubator/fbjni#23 Test Plan: `./gradlew generateReleaseBuildConfig` (In PyTorch) `./gradlew assembleRelease` Reviewed By: passy Differential Revision: D18226540 Pulled By: dreiss fbshipit-source-id: c4ece2d1d8e7cbb095bc6991bbad53393e6f6ecb
@dulinriley is there any more information that you need in order to prioritise this issue? |
Big thanks to this thread, Hermes is great but we need support for |
This comment has been minimized.
This comment has been minimized.
Hey folks, Is that any workaround suggested for We broke our minds for some weeks with this bug because when we were using the debug mode in React Native, the |
@OtacilioN -- On my team we're still using And I ran into exactly the same debug-time issues with some other features including Proxy (also missing in Hermes, #33), before that was updated to be available on android-jsc. I feel your pain! |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
How does facebook handle Intl in their apps when using Hermes? |
This comment has been minimized.
This comment has been minimized.
Sorry about the delayed response here. Internally at Facebook we use See: The published version currently builds for Android but AFAIK there is nothing preventing porting to iOS. On the subject of Intl support: we would like to have it in Hermes, but it isn't our top priority, since, as described above, we don't use it internally. We welcome help from the community in implementing it. |
EDIT: I found that Chrome Status shares data publicly on the usage of these APIs. I have gathered and ordered that data for the Intl APIs in this comment. Additional anecdotal data is probably not as helpful now. We are revisiting Please help us understand the particular function calls that are blocking your ability to use Hermes. For example, I've seen Intl functions blocking usage of Hermes:
Also, I saw a mention of the react-intl project. Can someone go through that and identify what Thanks! |
I'm not entirely sure how to search In addition to react-intl, a super popular library is MomentJS -- https://momentjs.com & its sub library moment-timezone https://momentjs.com/timezone/ Moment has a CI testing various browsers/environments, so maybe you can add hermes to that list, and then get an enumeration of the methods that are missing / fail tests? |
@TheSavior
For react-intl it is probably better to start with intl-messageformat as it is most used one. @fbartho |
Our codebase also directly uses |
I'm currently using the following polyfills for Hermes:
I'm using https://lingui.js.org/ as a higher level abstraction over intl apis. I don't have anything blocking usage of hermes since it works fine with these polyfills. First thing would be to try and remove usage of the intl polyfill, this one actually implements a lot of apis, the list is available here https://github.com/andyearnshaw/Intl.js#implemented. Here are some Intl apis I use either directly or through lingui-js:
|
@dlebedynskyi thanks, from my quick searching it looks like IntlMessageFormat isn't part of a finalized spec. Am I looking in the wrong place? |
@janicduplessis, it looks like the Intl APIs you list are a collection of multiple functions. Do you know which functions in those APIs you use? The more specific the better here :) |
Is there a plan to support It is on iOS, but on Android poly fill is still required, if you try to those options |
It should be a fairly straightforward to add the support for dateStyle/timeStyle form Android platform 24+ .. Could you file an issue if one doesn't exist? A PR would be welcome as well ! |
@mganandraj created #926. |
Is it planned to add this anytime soon? |
Can anyone else confirm that only on iOS, All other TZs seem to work ( |
Any new news? |
Closing this, since Intl support has been added to Hermes. Please file separate issues for individual problems (of which there are many, since the implementation is not complete). |
In https://github.com/facebook/hermes/blob/master/doc/Features.md
Intl
is listed asExcluded From Support
. WithWhat are those considerations regarding
Intl
? (If its about size, why not have a variant like jsc does?)How should i18n look like with Hermes?
The text was updated successfully, but these errors were encountered: