AngularJS module for django i18n translations support. Work together with django module djangular-translate
-
Download it or install using bower install https://github.com/magnitronus/ng-django-translate.git
-
We need to do is add a dependency to ng-django-translate module which is called ngDjangoTranslate:
angular.module('your-app', ['ngDjangoTranslate']);
-
Configure provider:
YourApp.config(function(ngDjangoTranslateProvider) { ngDjangoTranslateProvider.config(<your_settings_dict>); });
-
urls: here is urls which you define when install django module djangular-translate. For example:
urls: { languages:'/i18n/languages/', catalog:'/i18n/catalog/' }
-
selector_template: Optional. Defines template for lang-selector directive.
This directive specifies content that should be translated. There is two ways for using it:
-
Attribute without value:
Hello world!
In this case text "Hello world!" should be translated.
-
Attribute with value:
In this case placeholder "Some Value" should be translated.
This directive transclude template of some languages dropdown list etc. You can use default template or define your own by selector_template option in provider settings.