baslocalize
v1.0.13
Published
Module for localize content in AngularJS project.
Downloads
32
Maintainers
Readme
How use: Include this module in your application module:
var app = angular.module('appModule', [
'basLocalize'
]);
For get current language:
var language = localStorage.getItem("language");
We have variable for each languages with content:
window.translations.cn = {
"eth": {
"collected": "筹募的ETH "
}
};
For set default language:
basLocalizeService.setDefaultLanguage(defaultLanguage);
Use your variable in:
basLocalizeService.changeLanguage(currentLanguage);
in controller for change language:
app.controller('homeController', [ '$scope', 'basLocalizeService', function ($scope, basLocalizeService) {
$scope.changeLanguage = function(currentLanguage) { //currentLanguage = cn
basLocalizeService.changeLanguage(currentLanguage, defaultLanguage);
};
}])
Use in file.html:
<span ng-localize="eth.collected">template text</span>
GOOD LUCK!