Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Intl with standalone Hermes app #1350

Open
manuelpuyol opened this issue Mar 13, 2024 · 2 comments
Open

Using Intl with standalone Hermes app #1350

manuelpuyol opened this issue Mar 13, 2024 · 2 comments

Comments

@manuelpuyol
Copy link
Contributor

馃憢 I've been experimenting running JS using Hermes as a standalone binary in Linux and wanted to use Intl.DateTimeFormat, but looks like Intl support is tied to Android/iOS runtimes.

Is there any way to use Intl in a Linux runtime without having to use polyfills?

I created this simple gist to reproduce the current Intl behavior https://gist.github.com/manuelpuyol/dbb1e41c748dbaf80da3ca3556648611

@neildhar
Copy link
Contributor

Hey @manuelpuyol, we're aware of this limitation, and have a plan to address Intl support more comprehensively in the future by migrating to ICU (see #1211). Once we do that, we will be able to support Intl across platforms, including in a standalone linux application.

In the interim, if you're up for getting your hands dirty, Microsoft maintains an implementation for Windows that is also based on ICU (see here). It should be possible to pull in that implementation and port it to work on Linux. We would also welcome a PR to make this change in Hermes, since migrating to ICU is part of our plan for Intl support.

@manuelpuyol
Copy link
Contributor Author

great! thanks for pointing that windows implementation, I'll take a look and see if that's something I can PR!

facebook-github-bot pushed a commit that referenced this issue Mar 29, 2024
)

Summary:
Related to #1350 and #1211

As an initial step for `Intl` backed by ICU, I'm implementing the `getCanonicalLocales` function using BCP47Parser. The implementation is exactly the same as Apple's implementation

Pull Request resolved: #1361

Test Plan: This change should be covered by the `get-canonical-locales.js` test.

Reviewed By: tmikov

Differential Revision: D55456992

Pulled By: neildhar

fbshipit-source-id: 7f0c9b59cfcfb79a0b6f128a02357f52342ab4d3
facebook-github-bot pushed a commit that referenced this issue Apr 11, 2024
Summary:
Related to #1350 and #1211
Follow up of #1361

I'd like to expand non iOS/android support of `Intl`. In this case, I'm implementing both `DateTimeFormat.prototype.resolvedOptions` and `DateTimeFormat.prototype.format`. The implementation is a mix from the Apple and hermes-windows' implementations.

- created `PlatformIntlShared` with helper functions that are exactly the same between Apple and ICU
- Implemented `DateTimeFormatICU` based on `DateTimeFormatApple`
    - Used an ICU equivalent whenever NS was used for Apple

Pull Request resolved: #1362

Test Plan: Testing against `test262/test/intl402/DateTimeFormat`

Reviewed By: tmikov

Differential Revision: D55893825

Pulled By: neildhar

fbshipit-source-id: 03eef39721915ef03ebf6859980c374e10d337e9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants