-
Notifications
You must be signed in to change notification settings - Fork 1k
translateCloak directive adds cloak class but does not remove it #658
Comments
Would you mind setting up an example? |
Here's a plunker that illustrates the issue: http://plnkr.co/edit/UJXvdW To reproduce the bug:
If we listen to '$translateChangeEnd' instead of '$translateLoadingSuccess' in translateCloak directive, it will works as well and 'Hello there!' will display at step 3. |
I've looked into it. As a side note:
But coming to your issue: I also do not get it. In addition, your test case 1.2 works for me. |
Under some circumstances, the cloak was not be removed: * the translations are already stored (not via custom loader) * no customer loader defined anyway This changes the listening event to the change-end phase, which will be invoked always. Fixes #658
Under some circumstances, the cloak was not be removed: * the translations are already stored (not via custom loader) * no customer loader defined anyway This changes the listening event to the change-end phase, which will be invoked always. Fixes #658
@knalli @tspaeth I think @chrisscholly explained pretty well what the issue is. Removing @chrisscholly If you're fancy making a pull request that makes that chance, just go for it. |
Have a look at https://github.com/angular-translate/angular-translate/tree/bugfix/658, especially 3397e1f Well, however, this would be invoked always. Also on error cases. |
@knalli that's perfect. I'll cherry pick it on top of latest |
Under some circumstances, the cloak was not be removed: * the translations are already stored (not via custom loader) * no customer loader defined anyway This changes the listening event to the change-end phase, which will be invoked always. Fixes #658
Landed as acab18a will land with the next release, thank you @chrisscholly for submitting and @knalli for implementing. You guys rock. |
Thank you @knalli for implementing :) Can't wait to use the next release of angular-translate ! :) |
Hi guys,
As you know, translateCloak directive adds cloak class and remove it when '$translateLoadingSuccess' event get fired.
But '$translateLoadingSuccess' is not always fired. In that case cloak class will never been removed.
Explanations
When translation tables have been loaded asynchronously (loadAsync function), '$translateLoadingSuccess' is fired and then useLanguage() is called with the right language key.
After the next use() call with the same language key, translation tables are no longer loaded async. because there is a translation table for the language we've requested. '$translateLoadingSuccess' has no chance to get fired in that case.
Solution
As in both cases useLanguage() is called and '$translateChangeEnd' is fired, we could listen to '$translateChangeEnd' rather than '$translateLoadingSuccess' in translateCloak directive to remove the cloak class.
If it makes sense sure I'll make a pull request.
Chris
The text was updated successfully, but these errors were encountered: