This repository has been archived by the owner on Jan 29, 2024. It is now read-only.
Finally invoke "clearNextLangAndPromise" when already loading a translation table #1813
Labels
Milestone
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: