You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.
I'm experiencing a bug in Lazy loading at runtime with partial loaders.
After invoking $translate.use with a new language, the page is not being translated and so the translation keys are shown. This error occurs sometimes and I think it's due to some timing related aspect (race conditions?).
After having debugged quite a bit, it occurred me a workaround: $translate.use($lankKey).then(function () { $translate.refresh(); });
But I think that this is pretty ugly because of poor performances.
After having debugged quite a bit and having read the code, this fix occurred me:
Put the code below (already present in the first if branch in the $translate.use method) also in the second branch (see the link below for the line):
langPromises[key]['finally'](function () {
clearNextLangAndPromise(key);
})['catch'](angular.noop); // we don't care about errors (clearing)
This way, when the language is being changed by the use method, the code enters in the first branch (thanks to the langPromise of the new language key being set undefined by the code above, even when the translation table is already being loaded).
Hi,
I'm experiencing a bug in Lazy loading at runtime with partial loaders.
After invoking $translate.use with a new language, the page is not being translated and so the translation keys are shown. This error occurs sometimes and I think it's due to some timing related aspect (race conditions?).
After having debugged quite a bit, it occurred me a workaround:
$translate.use($lankKey).then(function () { $translate.refresh(); });
But I think that this is pretty ugly because of poor performances.
After having debugged quite a bit and having read the code, this fix occurred me:
Put the code below (already present in the first
if
branch in the$translate.use
method) also in the second branch (see the link below for the line):This way, when the language is being changed by the
use
method, the code enters in the first branch (thanks to the langPromise of the new language key being setundefined
by the code above, even when the translation table is already being loaded).angular-translate/src/service/translate.js
Line 1942 in 8309494
The text was updated successfully, but these errors were encountered: