请帮我处理 - 当我运行应用程序并单击“德语”按钮时翻译不起作用,所以我没有将这个短语翻译成德语,这里是代码:
<html ng-app="">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js"></script>
<script src="http://rawgithub.com/PascalPrecht/bower-angular-translate/master/angular-translate.min.js"></script>
</head>
<body>
<div class="span4">
<div class="well">
<h2 translate="TITLE">Hello</h2>
<p translate="FOO">This is a paragraph</p>
</div>
<div ng-controller="Ctrl">
<button class="btn" ng-click="changeLanguage('en')" translate="BUTTON_LANG_EN">english</button>
<button class="btn" ng-click="changeLanguage('de')" translate="BUTTON_LANG_DE">german</button>
</div>
</div>
<script>
var app = angular.module('at', ['pascalprecht.translate']);
app.config(function ($translateProvider) {
$translateProvider.translations('en', {
TITLE: 'Hello',
FOO: 'This is a paragraph.',
BUTTON_LANG_EN: 'english',
BUTTON_LANG_DE: 'german'
});
$translateProvider.translations('de', {
TITLE: 'Hallo',
FOO: 'Dies ist ein Paragraph.',
BUTTON_LANG_EN: 'englisch',
BUTTON_LANG_DE: 'deutsch'
});
$translateProvider.preferredLanguage('en');
});
app.controller('Ctrl', function ($scope, $translate) {
$scope.changeLanguage = function (key) {
$translate.uses(key);
};
});
</script>
</body>
</html>