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
Thanks for the great library. It made providing i18n support to my app very easy.
One feature I suggest is letting the service fall back to the default resource file if a given key/value combination is not in a localized resource file.
I'm developing a desktop app using node-webkit. I'm foreseeing the possibility of some tech-savvy users creating their own localized resource files. It would be great if even if they happened to leave out a key/value combination, the app would still output something other than the missing key or nothing.
The text was updated successfully, but these errors were encountered:
What I would suggest doing is to actually change from a dictionary to an object and by default populate it with the default values and then over write the values with the language file.
I'll try to create a branch showing how to do this over the weekend when I have more time.
// checks the dictionary for a localized resource string
getLocalizedString: function(value) {
// default the result to an empty string
var result = '';
// make sure the dictionary has valid data
if ((localize.dictionary !== []) && (localize.dictionary.length > 0)) {
// use the filter service to only return those entries which match the value
// and only take the first result
var entry = $filter('filter')(localize.dictionary, function(element) {
return element.key === value;
}
)[0];
// set the result
if(entry) {
result = entry.value;
} else {
result = '[i18n: '+value+']';
}
}
// return the value to the call
return result;
}
Thanks for the great library. It made providing i18n support to my app very easy.
One feature I suggest is letting the service fall back to the default resource file if a given key/value combination is not in a localized resource file.
I'm developing a desktop app using node-webkit. I'm foreseeing the possibility of some tech-savvy users creating their own localized resource files. It would be great if even if they happened to leave out a key/value combination, the app would still output something other than the missing key or nothing.
The text was updated successfully, but these errors were encountered: