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.

Translation async provider fallback

See original GitHub issue

I’m using the module into a project, loading the JSON files asynchronously from an external web API.

It would be nice having a fallback when the API doesn’t respond for any reason. At this moment, the LocalizationService just prints an error to the console on the getTranslation() method, but the method itself returns void so there’s no way of telling whether the async load was successful or not.

Maybe returning an Observable<boolean> would allow to define a fallback static object on loading error?

What do you think? Would you find this useful? What would be your preferred way of implementing this? I can try to put together a PR if you want me to.

Thanks and regards.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
robisim74commented, Feb 25, 2017

I made a commit https://github.com/robisim74/angular-l10n/commit/823e0091de562a7e8d6c917f1a7a2b39d939f8e5 to add a translationError event and to add a new AddWebAPIProvider method to the configuration.

I’m going to release a new version by Monday.

Greetings,

Roberto

1reaction
davguijcommented, Feb 21, 2017

@robisim74 Sounds good. Either way, the point is being able to notify subscribers of a possible HTTP error. I’ll fork and try to come up with something later today / tomorrow and will let you know.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Async Loading and fallback languages · Issue #245
After that, when angular-translate needs a fallback language, it starts to request the languages one by one by one. But as soon as...
Read more >
Set a fallback language
Set a fallback language to be used when user interface text is not translated in the user's preferred language to accommodate the language...
Read more >
javascript - Angular Translate async timing issue with $ ...
useStaticFilesLoader works asynchronous while I would really need it to be synchronous because by the time the plunker runs, the JSON files are ......
Read more >
Configuration Options - i18next documentation
fallbackLng. 'dev'. language to use if translations in user language are not available. Setting it explicitly to false will not trigger to load...
Read more >
Internationalization (i18n) - Spartacus Documentation - SAP
To provide better a better user experience if a translation is missing, you can specify a fallback language. Setting the fallbackLang option ensures...
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