ump-plugin-intl
v0.0.1
Published
UMP Intl Plugin — FormatJS-backed Intl polyfill, auto-installs on import (globalThis.Intl + ES export). No-op on H5.
Readme
ump-plugin-intl
FormatJS-backed Intl polyfill for UMP. Pure JS — no native bridge.
Usage
Add the dependency and import it once at app startup. The polyfill installs itself as an import side effect — there is no function to call:
import 'ump-plugin-intl';
// globalThis.Intl is now complete; or use the named export:
import { Intl } from 'ump-plugin-intl';On hosts with a healthy Intl (browsers, JSC, V8, Hermes-with-Intl) every
per-class probe passes and nothing from FormatJS is loaded — zero cost. On
hosts with a missing/broken class (e.g. Hermes 0.82 raising
ClassNotFoundException), the matching @formatjs/intl-*/polyfill-force is
loaded and installed onto globalThis.Intl, non-overwriting.
en + zh locale data is built in. To add more locales, install the
matching FormatJS locale-data package(s) in your app — the plugin picks
them up automatically at install time.
On H5 builds the dev-server resolves index.h5.ts, a no-op that re-exports
the browser's native Intl.
