Skip to content
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

Better behavior for getText when locale isn't loaded. #93

Open
SeanMcMillan opened this issue May 16, 2016 · 0 comments
Open

Better behavior for getText when locale isn't loaded. #93

SeanMcMillan opened this issue May 16, 2016 · 0 comments

Comments

@SeanMcMillan
Copy link

https://github.com/doshprompt/angular-localization/blob/master/src/localization.js#L248-L267

getLocalizedString may release Zalgo.

I've got a big mess of an app. You don't care about that. It uses the i18n filter, which calls locale.getString, which is getLocalizedString. This returns an empty string because the bundle is not loaded, and triggers the bundle load. My app then goes on to do the wrong thing, assuming the empty string is the correct translation.

I feel like maybe there should be a stronger indicator that the bundle isn't loaded yet. Maybe throw an exception, or, if that's too harsh, return '%%BUNDLE_NOT_LOADED%%', (with analogy to '%%KEY_NOT_FOUND%%') I guess you could make the i18n filer return a promise that will be fulfilled once the bundle is loaded, (I hear that's supposed to work.)

Also, I want a pony. Er, I mean, this is basically wishing, but it might help others too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant