<!DOCTYPE html>
<html ng-app="translate">

  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script>
    <script src="https://code.angularjs.org/1.4.7/angular-sanitize.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/i18next/1.10.3/i18next.min.js"></script>
    <script src="https://cdn.rawgit.com/i18next/ng-i18next/master/dist/ng-i18next.min.js"></script>
    <script src="app.js"></script>
  </head>

  <body ng-controller="appCtrl">
    <h1>{{'hello' | i18next}} Plunker!</h1>
    <select ng-change="changeLang()" ng-model="lang">
      <option value="es">{{'spanish' | i18next}}</option>
      <option value="en">{{'english' | i18next}}</option>
      <option value="de">{{'german' | i18next}}</option>
    </select>
    <a href="https://github.com/i18next/ng-i18next">{{'more info' | i18next}}</a>
    <hr>
    <h3>$scope.example</h3>
    <p>{{example | i18next}}</p>
    <hr>
    <h3>example</h3>
    <p>{{'example' | i18next}}</p>
  </body>

</html>
angular.module('translate', ['ngSanitize', 'jm.i18next'])
.config(function($i18nextProvider){
  $i18nextProvider.options = {
      lng: 'es',
      useCookie: false,
      useLocalStorage: false,
      fallbackLng: 'dev',
      resGetPath: 'locale/es.json',
      defaultLoadingValue: '' // ng-i18next option, *NOT* directly supported by i18next
    };
})
  .controller('appCtrl', appCtrl);

function appCtrl($scope, $i18next) {
  $scope.lang = 'es';
  $scope.example = 'example';
  
  $scope.changeLang = function() {
    $i18next.options.lng = $scope.lang;
    $i18next.options.resGetPath = 'locale/' + $scope.lang + '.json';
  }
}
{
  "hello": "Hola",
  "more info" : "Más información",
  "example" : "Don Quijote de la Mancha1 es una novela escrita por el español Miguel de Cervantes Saavedra. Publicada su primera parte con el título de El ingenioso hidalgo don Quijote de la Mancha a comienzos de 1605, es la obra más destacada de la literatura española y universal, además de ser la más publicada y traducida de la historia después de la Biblia.",
  "spanish" : "Español",
  "english" : "Inglés",
  "german" : "Alemán"
}
{
  "hello": "Hello",
  "more info" : "More info",
  "example": "Don Quixote (/ˌdɒn ˈkwɪksət/[1] or /ˌdɒn kiːˈhoʊtiː/; Spanish: [ˈdoŋ kiˈxote] ( listen)), fully titled The Ingenious Gentleman Don Quixote of La Mancha (Spanish: El ingenioso hidalgo don Quijote de la Mancha), is a Spanish novel by Miguel de Cervantes Saavedra. Published in two volumes, in 1605 and 1615, Don Quixote is considered one of the most influential works of literature from the Spanish Golden Age and the entire Spanish literary canon. As a founding work of modern Western literature and one of the earliest canonical novels, it regularly appears high on lists of the greatest works of fiction ever published, such as the Bokklubben World Library collection that cites Don Quixote as authors' choice for the '  best literary work ever written '.[2] It follows the adventures of a nameless hidalgo who reads so many chivalric romances that he loses his sanity and decides to set out to revive chivalry, undo wrongs, and bring justice to the world, under the name Don Quixote.",
  "spanish" : "Spanish",
  "english" : "English",
  "german" : "German"
}
{
  "hello": "Hallo",
  "more info": "Mehr Informationen",
  "example": "Don Quijote [doŋkiˈxote] (Don Quixote in alter Schreibweise; Don Quichotte [kiˈʃɔt] in französischer Orthografie, teilweise auch im deutschen Sprachraum üblich) ist die allgemeinsprachliche Bezeichnung für den Roman El ingenioso hidalgo Don Quixote de la Mancha von Miguel de Cervantes, übersetzt Der sinnreiche Junker Don Quijote von der Mancha, und gleichzeitig der Name des Protagonisten.",
  "spanish": "Spanisch",
  "english": "Englisch",
  "german": "Deutsche"
}