src/js/i18n.js
branchpopcorn-port
changeset 838 03b03865eb9b
parent 837 353a78021ebc
child 840 ac66e2240e1e
equal deleted inserted replaced
837:353a78021ebc 838:03b03865eb9b
    40         ? _msgs[message]
    40         ? _msgs[message]
    41         : message
    41         : message
    42     )
    42     )
    43 }
    43 }
    44 
    44 
    45 IriSP.i18n_factory.prototype.addLanguage = function(lang, messages) {
    45 IriSP.i18n_factory.prototype.addMessage = function(lang, messagekey, messagevalue) {
    46     this.messages[lang] = messages;
    46     if (typeof this.messages[lang] == "undefined") {
       
    47         this.messages[lang] = {};
       
    48     }
       
    49     this.messages[lang][messagekey] = messagevalue;
    47 }
    50 }
    48 
    51 
    49 IriSP.i18n_factory.prototype.addLanguages = function(messages) {
    52 IriSP.i18n_factory.prototype.addMessages = function(messagesObj) {
    50     var _this = this;
    53     var _this = this;
    51     IriSP.underscore(messages).each(function(_messages, _lang) {
    54     IriSP.underscore(messagesObj).each(function(_messages, _lang) {
    52         _this.addLanguage(_lang, _messages);
    55         IriSP.underscore(_messages).each(function(_value, _key) {
       
    56             _this.addMessage(_lang, _key, _value);
       
    57         })
    53     });
    58     });
    54 }
    59 }
    55 
    60 
    56 IriSP.i18n = new IriSP.i18n_factory();
    61 IriSP.i18n = new IriSP.i18n_factory();
    57 
       
    58 IriSP.i18n.addLanguages(
       
    59     {
       
    60         en: {
       
    61             submit: "Submit",
       
    62             add_keywords: "Add keywords",
       
    63             add_polemic_keywords: "Add polemic keywords",
       
    64             your_name: "Your name",
       
    65             type_here: "Type your annotation here.",
       
    66             wait_while_processed: "Please wait while your request is being processed...",
       
    67             error_while_contacting: "An error happened while contacting the server. Your annotation has not been saved.",
       
    68             empty_annotation: "Your annotation is empty. Please write something before submitting.",
       
    69             annotation_saved: "Thank you, your annotation has been saved.",
       
    70             share_annotation: "Would you like to share it on social networks ?",
       
    71             share_on: "Share on",
       
    72             play_pause: "Play/Pause",
       
    73             mute_unmute: "Mute/Unmute",
       
    74             play: "Play",
       
    75             pause: "Pause",
       
    76             mute: "Mute",
       
    77             unmute: "Unmute",
       
    78             annotate: "Annotate",
       
    79             search: "Search",
       
    80             elapsed_time: "Elapsed time",
       
    81             total_time: "Total time"
       
    82         },
       
    83         fr: {
       
    84             submit: "Envoyer",
       
    85             add_keywords: "Ajouter des mots-clés",
       
    86             add_polemic_keywords: "Ajouter des mots-clés polémiques",
       
    87             your_name: "Votre nom",
       
    88             type_here: "Rédigez votre annotation ici.",
       
    89             wait_while_processed: "Veuillez patienter pendant le traitement de votre requête...",
       
    90             error_while_contacting: "Une erreur s'est produite en contactant le serveur. Votre annotation n'a pas été enregistrée",
       
    91             empty_annotation: "Votre annotation est vide. Merci de rédiger un texte avant de l'envoyer.",
       
    92             annotation_saved: "Merci, votre annotation a été enregistrée.",
       
    93             share_annotation: "Souhaitez-vous la partager sur les réseaux sociaux ?",
       
    94             share_on: "Partager sur",
       
    95             play_pause: "Lecture/Pause",
       
    96             mute_unmute: "Couper/Activer le son",
       
    97             play: "Lecture",
       
    98             pause: "Pause",
       
    99             mute: "Couper le son",
       
   100             unmute: "Activer le son",
       
   101             annotate: "Annoter",
       
   102             search: "Rechercher",
       
   103             elapsed_time: "Durée écoulée",
       
   104             total_time: "Durée totale"
       
   105         }
       
   106     }
       
   107 );