https://github.com/offirmo/i18n
XXX IN PROGRESS A powerful, standard-compliant i18n lib for your JS / TS app. (convenient wrapper around yahoo FormatJS lib)
https://github.com/offirmo/i18n
Last synced: 11 months ago
JSON representation
XXX IN PROGRESS A powerful, standard-compliant i18n lib for your JS / TS app. (convenient wrapper around yahoo FormatJS lib)
- Host: GitHub
- URL: https://github.com/offirmo/i18n
- Owner: Offirmo
- License: unlicense
- Created: 2016-09-20T10:08:38.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-08-11T07:02:52.000Z (almost 9 years ago)
- Last Synced: 2024-08-10T10:18:44.108Z (almost 2 years ago)
- Language: TypeScript
- Homepage:
- Size: 78.1 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Offirmo's internationalize
Based on yahoo i18n libs (http://formatjs.io/), but offering more:
- integrated Intl API polyfill (taken from yahoo doc itself)
- simpler API (keeping all features,
- safer failover
While message resolution may fail, we try to not aggressively fail with a throw,
but instead return the "best possible message":
- **never throw**, always return a displayable string
- fallback to "en" if possible
- display a raw key to the user (in UI) rather than nothing, to ease pinpointing
- allow passing a custom debug id to more easily identify components with broken i18n
TODO add a customizable error handler
Interesting reads:
* http://userguide.icu-project.org/formatparse
* http://userguide.icu-project.org/formatparse/messages
* http://formatjs.io/