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.
It uses localeStorage to remember user's chosen language. A preferred language is set to German, a fallback one to English. Polish language is not provided for a static loader.
When we first enter plunker we can see that everything is written in German except one button which uses a fallback language. So far, so good.
If we switch language to Polish, since no translations are provided for Polish, it will use fallback language as expected.
Now local storage remembers that user has chosen Polish as a chosen language and if we refresh page angular-translate will try to load Polish translation and of course it will fail. However, no fallback language is going to be used, which for me is an expected behaviour.
It happens because angular-translate has never set $uses value and we will fail on if statement below:
I am aware that is unlikely to run to this issue on a production unless someone decides to remove support for a language that users' locale storages may already remember. I am not sure if you will consider it as a bug but for me it is a bit inconsistent behaviour.
Best regards
The text was updated successfully, but these errors were encountered:
The "using non-existing" fallback-languages has already been discussed somewhere - I just can't find the ticket actually.
But yes, until now, the standard loader does not check the $http - response states for validity an puts it into the hands of the developer to provide consistent language setup.
If you want - feel free to provide a nice PR :-).
greckin
pushed a commit
to greckin/angular-translate
that referenced
this issue
Sep 28, 2014
Hi,
Please consider following plunker: http://plnkr.co/edit/cQM7dQmfSWJGMGJsjQ6N
It uses localeStorage to remember user's chosen language. A preferred language is set to German, a fallback one to English. Polish language is not provided for a static loader.
When we first enter plunker we can see that everything is written in German except one button which uses a fallback language. So far, so good.
If we switch language to Polish, since no translations are provided for Polish, it will use fallback language as expected.
Now local storage remembers that user has chosen Polish as a chosen language and if we refresh page angular-translate will try to load Polish translation and of course it will fail. However, no fallback language is going to be used, which for me is an expected behaviour.
It happens because angular-translate has never set $uses value and we will fail on if statement below:
So table will be resolved to a table with objects per language keys, not a map of key into translations and we fail on hasOwnProperty check.
For the same reason ($uses not being set) we fail on a statement to check for a fallback language:
I am aware that is unlikely to run to this issue on a production unless someone decides to remove support for a language that users' locale storages may already remember. I am not sure if you will consider it as a bug but for me it is a bit inconsistent behaviour.
Best regards
The text was updated successfully, but these errors were encountered: