-
Notifications
You must be signed in to change notification settings - Fork 153
$state.reload instead of broadcastUpdate? #242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm not sure why changes to angular-gettext are needed for this? Can't you just add this to your application: $rootScope.$on("gettextLanguageChanged", function () {
$state.reload();
}); ? |
Also note that there isn't currently a dependency on ui-router in angular-gettext (and we won't add one, not every project needs ui-router). |
Good idea, I didn't think about overwriting the gettextLanguageChanged signal! I'm still having some issues with
in angular-material. This is first hit by the angular-material compiler, which rewrites it to
and then angular-gettext can't extract the msgid. It should run first so it can access the untransformed "Text". And then it must not terminate so that angular-material can do its thing. I'm currently playing around with changing
in the translate directive. Should this be configurable? I read #147 but I still don't know why it sets terminal=true right now. |
As for the state switching, that seems solved, so I'll be closing this issue (feel free to reopen if needed). |
Background: I'm having some interop issues with angular-material, e.g. #214 or angular/material#1742. In both cases the initial render is ok, but subsequent changes of the language via
setCurrentLanguage(...)
don't produce the desired effect.My current workaround is to just flip the language variable and reload the current state:
I realize that this uses ui-router and loses content of
<input>
fields, on the other hand it is more robust since you only have to be able to render once. Another advantage is that you can use one-time bindings{{::"Text"|translate}}
. Is there any other issue that I haven't thought about? Would there be interest to "bless" this workaround by adding a special settersetCurrentLanguageAndReload
, say?The text was updated successfully, but these errors were encountered: