question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Request] Replace `app/utils/intl/missing-message.js` with hook

See original GitHub issue

How about replacing the magic file at app/utils/intl/missing-message.js with a hook on the service?

Something like this:

// ember-intl service
// …
missingTranslation(locale, key, options = {}) {
  return `Missing translation for ${key} in ${locale}`;
}

// …

That hook could be used both to modify the returned message, e.g. by hooking up a fallback message in a specific locale, or used to notify some backend system about the missing translation.


The missing-message magic file works, but it’s an unorthodox way of doing it, and it causes some confusion, for example https://github.com/ember-intl/ember-intl/issues/627

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
sandstromcommented, May 16, 2020

@jasonmit I don’t mean to rush you!

I just wanted to connect the issues @jacobq mentioned in the issue he opened back to this one, since I think the hooks discussed here could give him adjustability around how errors are handled, and instead of having to choose between fail-hard vs. soft-fail, a hook would let the user choose whether to return a value or raise depending on preference/environment/etc.

2reactions
sandstromcommented, May 15, 2020

Let’s continue the discussion in https://github.com/ember-intl/ember-intl/issues/1299#issuecomment-629107847 here.

I think having hooks that could throw errors, return a custom string, or do any work really, would very useful.

The default behaviour could be to raise exceptions, for example for missing translations, missing args, etc. But hook would allow customization. That way one can choose to alter behaviour depending on environment, return a string + notify Sentry/TrackJS/Bugsnag, send notification to backend, etc.

Our upgrade to ember-intl has been smooth overall, but one issue that has cropped up several times is production crashes on missing translations or arguments (e.g. unresolved promise). Obviously those are bugs in our code, but with the old lib we’d just render fallback strings or error messages and our app would still be useful (+ send notification behind the scenes). Now everything just crashes.

Hooks where we could customize behaviour upon failure would be very useful!

Thanks again for all your awesome work on this addon! 🏅

@jasonmit let me know what you think!

cc @jacobq

Read more comments on GitHub >

github_iconTop Results From Across the Web

How handle "missing message" error in react-intl?
I'm using react-intl version 2.4.0 and for some translations I receive "missing message" error in console. Is there any way to handle them ......
Read more >
Pengumuman Lama - GnuCash
[price-quotes.scm] ensure missing-alphavantage message can show on console ... Bug 797787 - Feature request: preference setting to open new tabs adjacent to ...
Read more >
QCe - Symantec clicktime protection
Ins4neg4mer, L'esilio per ugo foscolo, Art design international, Hdd2d90 hard ... Paris van java bandung restaurant, Ward 65 adhb, Apputil user.replace?
Read more >
Framework7 Release Notes
use .lazy prefix for browser loaded JS lazy components (d419269) ... svelte messages: fix missing .instance() component prop (e156acc), closes #3905 ...
Read more >
Customer Portal - Oracle Help Center
In your customer portal pages, you can reference different message bases to change page attributes. Procedure. Log in to Oracle Service Cloud. Click ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found