Angular: Empty Fiddle
http://angularjs.org/
HTML
<script src="http://code.angularjs.org/angular-1.0.0rc9.js"></script>
<script src="http://code.angularjs.org/1.0.0rc9/i18n-1.0.0rc9/angular-locale_da-dk.js"></script>
<div ng-controller="MyCtrl">
see JSFiddle External Resources!: {{locale}} </br>
{{'+ Category' |i18n}} </br>
{{'edit Carte' |i18n}} </br>
{{'no translated text for this' |i18n}}
</div>
JavaScript
var myApp = angular.module('myApp',['localization']);
function MyCtrl($scope, $locale) {
$scope.locale= $locale.id;
}
angular.module('localization', [])
.filter('i18n', ['localizedTexts', function (localizedTexts) {
return function (text) {
if (localizedTexts.hasOwnProperty(text)) {
return localizedTexts[text];
}
return text;
};
}])
// this can be in a seperate file, but should load after the filter is loaded
angular.module('localization')
.value('localizedTexts', {
'+ Category': '+ Kategorie',
'edit Carte': 'Karte bearbeiten',
});