Last active
February 17, 2016 07:01
-
-
Save kikill95/2f22b3eafbb1db20e7af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.filter('l10n', function() { | |
| // In the return function, we must pass in a single parameter which will be the data we will work on. | |
| // We have the ability to support multiple other parameters that can be passed into the filter optionally | |
| return function(input, key) { | |
| // imagine that we have some variables with parsed JSONs | |
| /* var JSONS = { | |
| 'ru': ruJSON, | |
| 'ua': uaJSON, | |
| 'en': enJSON, | |
| ... | |
| }; | |
| */ | |
| // p.s. you can use $http.get() - for getting json is you can not get it, but I think that you can | |
| // and global variable with key of language | |
| // var language = 'ua'; | |
| return JSONS[language][key]; | |
| } | |
| }); | |
| /* | |
| --USAGE-- | |
| {{ 'Design' | l10n : 'aside.header.notifications'}} | |
| //so, the 'Design' is only for developers | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment