npm.io
1.0.13 • Published 8 years ago

baslocalize

Licence
ISC
Version
1.0.13
Deps
0
Size
20 kB
Vulns
0
Weekly
0

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!

Keywords