« Previous | 1 | 2 | 3 | Next »
angular-translator

Angularjs Language Translator

<!DOCTYPE html>
<html ng-app="APP">
<head>
<meta charset="UTF-8">
<title>angular-translator</title>
<style>
button {
width:125px;
display:block;
}
body{
}
</style>
</head>
<body>
<h2 translate="TITLE">Angularjs Language Translator</h2>
<div ng-controller="ExampleController">
<button ng-click="changeLanguage('en')" translate="BUTTON_LANG_EN">English</button>
<button ng-click="changeLanguage('de')" translate="BUTTON_LANG_DE">German</button>
<button ng-click="changeLanguage('es')" translate="BUTTON_LANG_ES">spanish</button>
</div>
<script>
var app = angular.module('APP', ['pascalprecht.translate'])
.config(function ($translateProvider) {
$translateProvider.translations('en', {
TITLE: 'Angularjs Language Translator',
BUTTON_LANG_EN: 'English',
BUTTON_LANG_DE: 'German',
BUTTON_LANG_ES: 'Spanish',
});
$translateProvider.translations('de', {
TITLE: 'AngularJS Language Translator',
BUTTON_LANG_EN: 'Englisch',
BUTTON_LANG_DE: 'Deutsch',
BUTTON_LANG_ES: 'Spanisch',
});
$translateProvider.translations('es', {
TITLE: 'Idioma AngularJS Traductor',
BUTTON_LANG_EN: 'Ingl�s',
BUTTON_LANG_DE: 'Alem�n',
BUTTON_LANG_ES: 'Espa�ol',
});
$translateProvider.preferredLanguage('en');
})
.controller('ExampleController', ['$scope', '$translate', function ($scope, $translate) {
$scope.changeLanguage = function (key) {
$translate.use(key);
};
}]);
</script>
</body>
</html>
« Previous | 1 | 2 | 3 | Next »


copyright © 2014 - all rights riserved by javatechnologycenter.com