-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Making formatMessage / getIntlMessage crash-safe? #200
Comments
I can see mentions of fallbacks in #162 but those seem to be language fallbacks or default string fallbacks? I understand that we don't like silent errors. But say my translation key/value is "SUMMER_SALE": "Summer Sale". (The key comes from API, my scope is FE, I can not guarantee all the values that API will always return) Do we:
Any other suggestions or workarounds? |
React Intl v2 has been rewritten to include graceful translation fallbacks. You can see the algorithm here: |
Got it, will try the v2, thanks! |
…eLocale, getLocaleHierarchy fix(@formatjs/intl-utils): dont lowercase locale lookup since we canonicalize it feat(formatjs-extract-cldr-data): Change data format to match with [[LocaleData]] spec feat(@formatjs/intl-relativetimeformat): canonicalize locales, rework to be more spec-compliant, implement internal slot, remove locale negotation proxy, smaller bundle size fix(intl-locales-supported): remove type: modules, fix #200 feat(@formatjs/intl-listformat): canonicalize locales, rework to be more spec-compliant, implement internal slots, remove locale negotiation proxy, smaller bundle size feat(@formatjs/intl-pluralrules): canonicalize locales, rework to be more spec-compliant, implement internal slots, remove locale negotiation proxy, smaller bundle size feat(@formatjs/intl-relativetimeformat): canonicalize locales, rework to be more spec-compliant, implement internal slots, remove locale negotiation proxy, smaller bundle size feat(@formatjs/intl-unified-numberformat): canonicalize locales, rework to be more spec-compliant, implement internal slots, remove locale negotiation proxy, smaller bundle size
Hello,
In many FE systems we dynamically apply translation methods to API values. Which means we can not be totally sure if the translation is in our Yala files or not.
For example: Yahoo Local has different providers (Yelp, TripAdvisor, Yahoo). If some day there is a new partner on API side, it will totally crash the FE and this is not appropriate.
Instead of using wrapper functions with try/catch, is it possible that react-intl directly handles such case?
Essentially I would like to understand why those functions currently crash easily, as no FE system wants to show a big stacktrace to the user.
Thanks!
The text was updated successfully, but these errors were encountered: