-
Notifications
You must be signed in to change notification settings - Fork 77
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
Access resources as objects instead of strings #49
Comments
Yes I think this is possible, however, you will still need to wrap the getString in a ready promise block, will that be fine? |
Perhaps that wouldn't be needed. I intend to declare the variable in my controller initialization, and use locale.getString only on error messages and other stuff, which should give enough time to load all resources. Me and a team member, @thiagoalves, were looking at promises and thread locking as a solution to another issue. Does that make sense? |
@renatoch if you want to prevent the page from loading, you can utilize The only caveat is that you will have to manually maintain the list of all possible resource files that must be loaded for any route. For example: resolve: {
langs: function (locale) {
return locale.ready([
'hello',
'world'
]);
}
} will block route changes until both So if you introduce even a single localization key from say Does that make sense? |
Thanks for the info! We'll try it out and let you know.
|
I've implemented a To use, you need to call -: ready("bundle").then(function() {
localised_bundle = locale.getBundle("bundle");
}) |
You can now listen on |
Is there a way to access resource strings using object properties / keys instead of passing strings?
I've tried to get access to the resource bundle, but the variable is private, so I cannot even iterate to obtain list of keys.
This would make the code more readable, better syntax, and color coding in my text editor would be able to differentiate from regular strings in the code.
How I use today:
How I would like to use:
The text was updated successfully, but these errors were encountered: