Translate module for AngularJS

Added by: Sam Deering





Stars: 0

Watchers: 0

Forks: 1

Module Description


Translate you AngularJS applications. Original module and idea by Philipp Klose.


Configure the language you want:

app = angular.module('YourModuleName', ['ngTranslator']);

app.config(['translateConfigProvider', function(translateConfig) {

Load the translations:['$http', 'translateData', function(http, translateData) {
    http.get('translation.json').success(function(translations) {

Use it:

<!-- simple content -->
<p translate>first_paragraph</p>

<!-- overwrite the language setting -->
<p translate translate-lang="en">first_paragraph</p>

<!-- translate an attribute -->
<input type="text" translate-attribute="placeholder" placeholder="translationKey">

<!-- shortcut for placeholder attribute of input -->
<input type="text" translate-placeholder="translationKey">

<!-- shortcut for value attribute of input -->
<input type="text" translate-value="translationKey">


  • If a key or a language are not found an (configurable) error message will be displayed where the translation should be.
  • If translation data is misconfigured for a key and (configurable) error message will be displayed where the translation should be.

Translation data format

    "de": {
        "first_paragraph": "Erster Absatz",
        "user_count": {
            "":"Kein Benutzer online",
            "0":"Kein Benutzer online",
            "1": "Ein Benutzer online",
            "2": "Zwei Benutzer online",
            "defaultTranslation": "{{ count }} Benutzer online"
    "en": {
        "first_paragraph": "First paragraph",
        "user_count": {
            "":"No User online",
            "0":"No User online",
            "1": "One User online",
            "2": "Two User online",
            "defaultTranslation": "{{ count }} User online"


  • Translations could contain Angular expressions (e.g.: {{ count }}). These expression are watched and updated if they change on the scope
  • If you have a translation with multiple case it must have the field defaultTranslation. Only expressions from the defaultTranslation field are watched.

Module stats last updated: 2015-04-19 02:56:19

Disclaimer: Some data on this page may have been gathered from the authors GitHub respository. If you see any mistakes or outdated information please let us know. Thanks!