Skip to content

Remove Globalize.js in favor of Intl (and MessageFormat) #250

Open
@mwistrand

Description

@mwistrand

Enhancement

Dojo currently uses Globalize.js for the bulk of its internationalization/localization functionality, but at this point Intl is well-supported and robust enough that it can handle most use cases. For supported browsers that lack Intl support, there are shims available (Intl and Intl.RelativeFormat). With that in mind, we can remove Globalize.js, use MessageFormat internally for managing ICU message formatting, and recommend the native Intl for anything else.

This would be a breaking change, and applications that use functions like formatCurrency would need to update to their native equivalents like Intl.NumberFormat. Perhaps @dojo/cli-upgrade-app could help mitigate any manual updates

With regard to the build, conditional polyfill loading should help reduce the bundle size, but it would also be possible to pre-compile any messages and therefore eliminate most of the bulk from the MessageFormat library as well. However, doing so will be difficult without a standard means of differentiating message bundles from other files. Just as Dojo uses m.css to distinguish CSS module files from other CSS files, perhaps a similar approach could be used for localized message files. The build would then pre-compile the messages in these files and MessageFormat could be ignored entirely. More discussion is needed here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking changeIndicates the issue/pull request would result in a breaking changediscussionThe issue is up for discussion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions