-
Notifications
You must be signed in to change notification settings - Fork 107
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
ECMAScript Proposal: Optional ICU Compatibility for Intl API #913
Comments
could potentially solve #891 |
Expanding the It's also not clear from the proposal what the extent of the ask here is; what new options and such would be included? Do I gather right that the set of options enabled by |
Speaking as a proponent of expansion, I have to say that some icu api/implementation has roots going back over 30 years (not a typo). I don't think it's appropriate to just expose everything. As to the version, there are pros and big cons in "leaking" this level of detail. I'd be more in favor of a way to get at the cldr version-or-equivalent something such as |
ECMA-402 is designed from the ground up to express what Web and client-side developers need as opposed to what ICU4C happens to provide. There is a lot of functionality in ICU4C that is simply not relevant to the Web platform. Additionally, ICU4C APIs carry cruft and do not always represent modern i18n best practices. I agree with @srl295 that if we want to work toward a lower-level abstraction than ECMA-402, I'd look into CLDR. One of my first issues on this repo is #210 for exactly this type of functionality. @ptu14, if you can identify specific gaps that you need in the Web platform, those can be individual proposals. For example, you mention date skeleton strings and "high demand for advanced date formatting capabilities." We could discuss specific date formatting proposals on their own merits. If you would like to discuss this, please join [email protected] and we can schedule this for an upcoming call. If you are able to travel, many of us will also be here for the Unicode Technology Workshop on October 22-23 and an ECMA-402 Face-to-Face on October 24. |
ECMA-402 Proposal: Enhanced ICU Integration for Intl API
Champion(s)
[Names of champions]
Stage
Stage 0
Motivation
The Intl API currently provides a standardized way for JavaScript applications to handle internationalization. However, it doesn't fully expose the capabilities of the International Components for Unicode (ICU) library, which is already included in most JavaScript environments. This proposal aims to bridge that gap, providing developers with more powerful and flexible internationalization tools while leveraging existing resources.
Key Points
Browsers already include full ICU objects: Major browsers like Chrome, Firefox, and Safari already ship with complete ICU implementations. This proposal seeks to expose these existing capabilities more directly.
Node.js supports configurable ICU data: Node.js allows specifying ICU data files using the
NODE_ICU_DATA
environment variable. This demonstrates the flexibility and existing support for comprehensive ICU functionality in server-side environments.Underutilized resources: Despite the presence of full ICU capabilities in most JavaScript environments, developers cannot fully leverage these resources through the current Intl API.
Potential for performance improvements: Direct access to ICU functions could reduce the overhead of the current abstraction layer in the Intl API.
Prior Art
This proposal builds directly on the International Components for Unicode (ICU) library, which is already integrated into:
NODE_ICU_DATA
)Description
We propose introducing an enhanced mode for the Intl API that provides more direct access to the existing ICU capabilities:
Expensive to Implement in Userland
Implementing ICU-level functionality in pure JavaScript would be prohibitively expensive:
Broad Appeal
Detailed Design
enhancedICU
option to all Intl constructors.enhancedICU
is true, allow the use of ICU patterns and options directly.Intl.getICUVersion()
method to check the underlying ICU version.Payload Mitigation
This proposal does not increase implementation size because:
Compatibility
This proposal is fully backwards-compatible. All existing Intl functionality remains unchanged when
enhancedICU
is not used.Implementation
The implementation would primarily involve creating new bindings between the existing ICU implementations in JavaScript engines and the Intl API surface. Most of the heavy lifting is already done by the included ICU libraries.
Summary
By providing enhanced ICU integration, this proposal significantly improves ECMA-402's internationalization capabilities, aligns closely with existing implementations, and meets the criteria for addition to the specification. It leverages resources already present in JavaScript environments, provides powerful tools that are expensive to implement in userland, has broad appeal, and does not increase payload size.
The text was updated successfully, but these errors were encountered: