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.

Fallback language translations failing to be processed.

See original GitHub issue

I have angular translate configured using the following code.

        $translateProvider.useStaticFilesLoader({
            files: [{
                prefix: 'i18n/sys-captions.',
                suffix: '.json'
            }]
        }).fallbackLanguage('en_US')
        .determinePreferredLanguage();

In this instance determinePreferredLanguage correctly sets my preferred language as en_GB (I’m currently experimenting with how reliable it is). I only have the US translation file available and the fallbackLanguage file is correctly loaded from the server.

However, when I try and translate an item via the $translate service, it will fail to find the item. The problem seems to reside inside the determineTranslation function.

if ($uses && $fallbackLanguage && $fallbackLanguage.length) {
   fallbackTranslation(translationId, interpolateParams, Interpolator, defaultTranslationText)

In my cases the $uses variable appears as undefined and so it does not make an attempt to process the fallback translation. Removing the $uses variable from the if statement corrects the issue for me.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
ux-engineercommented, Mar 18, 2016

Sure do @tspaeth – I have now verified this fix worked for me, thanks a lot! Fallback language’s translation string is now loaded if target language doesn’t have it translated.

0reactions
knallicommented, Mar 20, 2016

#1433 is landed in canary. @envision Thank you for verifying.

Available in the next 2.11

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sort out and fix language fallback inconsistencies - Drupal
This makes "Entity does not have a fallback" indistinguishable from "Entity fallback is the passed-in entity translation. Also: In the absence ...
Read more >
Fallback language | EY
Fallback language refers to the contractual provisions that lay out the process through which a replacement rate can be identified if a benchmark...
Read more >
Translation and Fallback Language Options for SAP Enable ...
The default fallback language is English (US): en-US. It is also used after searching the fallback language chain. For example, if no content...
Read more >
Fallback Contract Language - Alternative Reference Rates ...
These consultations outline draft language to be voluntarily incorporated in new contracts that reference USD LIBOR to ensure these contracts will continue to ......
Read more >
Double Language Fallback Behavior in Episerver
In cases when you assume that translations provider in code are ... translation is not being found, and built-in fallback also failed -...
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