In addition to the answers above you can also do this :
typically internationalization involves abstracting out the static strings and rendering them dynamically in the language of choice.
you can put the mappings in a JSON file and load it later according to the language choice. In the below example I have used a custom service localeService which injects the object according to the choice in the view.
app.service('localeService',['$injector',function($injector){
return {
getLocale : function(locale){
return $injector.get(locale);
}
}
}]);
This service returns the objects that I have defined as constants in the module. the objects contain the mapping for different languages :
app.constant('english',{
"greeting":"hello",
"dropDownHeader":"Clickable Dropdown",
"clickDesc" : "Click on the button to open the dropdown menu."
});
app.constant('spanish',{
"greeting":"ola",
"dropDownHeader":"desplegable se puede hacer clic",
"clickDesc" : "Haga clic en el botón para abrir el menú desplegable."
});
and finnaly I have used the object returned in the controller in the following way :
app.controller('mainCtrl',['localeService','$scope',function(localeService,$scope){
$scope.lang = {};
$scope.lang.locale = 'english';
//$scope.template = localService.getLocale();
$scope.$watch(function(scope){
return scope.lang.locale;
},function(newVal,oldVal){
$scope.template = localeService.getLocale($scope.lang.locale);
});
}]);
and here is the view :
<body ng-app="test" >
<div ng-controller="mainCtrl">
<h2>{{template.dropDownHeader}}</h2>
<p>{{template.clickDesc}}</p>
<label>Language</label>
<select ng-model="lang.locale">
<option value="">Select langauage</option>
<option value="english">English</option>
<option value="spanish">Spanish</option>
</select>
<p>{{template.greeting}}</p>
</div>
</body>
Here is the complete working example :