angular.module('MyApp', ['l10n']);
en.js
angular.module('my-l10n-en', ['l10n']).config(['l10nProvider', function(l10n){
l10n.add('en-us', {
myPage: {
myString: 'This is my string in English'
}
});
}])
ru.js
angular.module('my-l10n-ru', ['l10n']).config(['l10nProvider', function(l10n){
l10n.add('ru-ru', {
myPage: {
myString: 'Моя строчка на русском'
}
});
}]
Then add it into your module requires:
angular.module('MyApp', ['l10n', 'my-l10n-en']);
angular.module('MyApp').controller('MyCtrl', function(l10n){ l10n.get('myPage.myString') })
First you need to add l10n-tools as you module requirment
angular.module('MyApp', ['l10n', 'l10n-tools']);
then you will get following attribute directives:
- l10n-html - set localized value as element HTML
- l10n-text - set localized value as element text content
- l10n-title, l10n-href, l10n-placeholder - set localized value as corresponding attribute value
See demo for more features and examples of usage.