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 :) |
Hermes 0.10.0 finally fixes all outstanding Android Intl issues. (ref: 9238467) I've been able to use yarn
This allowed us to finally drop the polyfills and there's an amazing performance boost on Android as a result in our app. |
Until you need timezone conversion support though |
The commit I linked specifically fixes the bug in timezone conversion support that was present in 0.9.0. |
Thanks I was too quick with my comment sorry. Unfortunately polyfills are still necessary on iOS to be able to do the timezone conversion (when using Hermes). I read above that this is being worked on |
Question with hermes in v0.67.1 react-native enabled do I need this?
|
What is the progress on this? INTL support is the only release blocker for us to move to Hermes on iOS. The polyfills are way too slow and incorrect. |
Any update on IOS Intl support? |
Does this make this obsolete?
|
@pke: Most polyfills should no longer be required with the updated Hermes. So yes, those two should be obsolete. You should check however if things work properly after removing them. I think |
@andreialecu how do I know which Hermes engine is currently bundled with my RN project? |
You can check |
is iOS still needing polyfills with latest hermes? |
|
As of now, yes, although we are actively working on Intl support. Support for the upper/lowercase conversion functions, getCanonicalLocales, and Collator has already been merged in trunk. |
Same issue, Using will cause Error: RangeError: java.lang.ClassNotFoundException: Didn't find class "com.facebook.hermes.intl.DateTimeFormat" |
@zhiqingchen Make sure you're including the Hermes android artifacts on the classpath. If you're using Proguard, you may need to create a rule to avoid stripping Hermes classes. e.g. |
OK, with 0.68.1 which of these can I drop? |
@billnbell For me it's also unclear to what extent Intl is supported on both platforms. I would love to see some official support matrix of Hermes (sub)features for each platform per Hermes version. |
@mattijsf They have a Intl APIs page that covers what is supported/not yet supported and limitations of different versions of Android. But I believe there is still no iOS support for I'm using a time zone library for displaying a list of time zones and it has a reasonable usage of Thanks for all the hard work on Hermes so far, you folks rock. I'm looking forward to when (soon?) |
hi all. I'm one of the founders of the ICU4X project which is a Rust implementation of ICU targeting many programming environments and aiming for the ECMA-402 scope. One of the interesting features of ICU4X is that one can pull small modules that provide necessary components without paying for the whole monolithic codebase, and compile those components to WASM or JS. We are planning to release 1.0 quite soon and I'm wondering if Hermes would be interested in evaluating ICU4X for your needs. |
We just turned off Hermes in our iOS app after recently turning it on due to discovering lack of intl support for dates/times. Do we have any ETA on when this will be supported on the iOS side? |
Hi @jkester1986, The Hermes iOS Intl support (for date and time) is already implemented, but some wiring is needed on RN to surface it. We expect the next RN version (i.e., 0.70) to have that plumbing done, and full feature parity with Hermes on Android for RN 0.71 |
Hi @jpporto - what is status os IOS support for Intl ? |
Hi @billnbell, Hermes' iOS Intl support is defined here. It seems currently, Number, DateTime, and Collator are implemented. Other missing features are being actively implemented. |
Hi Team , we are facing the issue only on IOS after enabling Hermes : Version : "react-native": "0.68.2" Tried the below workaround in our index.ts - but doesn't seem to work. import { AppRegistry, Platform } from 'react-native'; //require('intl'); // import intl object import App from './src/App'; AppRegistry.registerComponent(appName, () => App); Any other Workaround or something which we are missing ? |
You are not putting it in right spot. Put in index.js:
|
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: