|
837
|
1 |
IriSP.i18n_factory = function() { |
|
|
2 |
this.messages = {}; |
|
|
3 |
this.base_lang = 'en'; |
|
|
4 |
} |
|
|
5 |
|
|
|
6 |
IriSP.i18n_factory.prototype.getLanguage = function(lang) { |
|
|
7 |
var _lang = ( |
|
|
8 |
typeof lang != "undefined" |
|
|
9 |
? lang |
|
|
10 |
: ( |
|
|
11 |
typeof IriSP.language != "undefined" |
|
|
12 |
? IriSP.language |
|
|
13 |
: this.base_lang |
|
|
14 |
) |
|
|
15 |
); |
|
|
16 |
return ( |
|
|
17 |
typeof this.messages[_lang] == "object" |
|
|
18 |
? _lang |
|
|
19 |
: ( |
|
|
20 |
typeof this.messages[this.base_lang] == "object" |
|
|
21 |
? this.base_lang |
|
|
22 |
: null |
|
|
23 |
) |
|
|
24 |
) |
|
|
25 |
} |
|
|
26 |
|
|
|
27 |
IriSP.i18n_factory.prototype.getMessages = function(lang) { |
|
|
28 |
var _lang = this.getLanguage(lang); |
|
|
29 |
return ( |
|
|
30 |
_lang != null |
|
|
31 |
? this.messages[_lang] |
|
|
32 |
: {} |
|
|
33 |
); |
|
|
34 |
} |
|
|
35 |
|
|
|
36 |
IriSP.i18n_factory.prototype.getMessage = function(message, lang) { |
|
|
37 |
var _msgs = this.getMessages(lang); |
|
|
38 |
return ( |
|
|
39 |
typeof _msgs[message] != "undefined" |
|
|
40 |
? _msgs[message] |
|
|
41 |
: message |
|
|
42 |
) |
|
|
43 |
} |
|
|
44 |
|
|
|
45 |
IriSP.i18n_factory.prototype.addLanguage = function(lang, messages) { |
|
|
46 |
this.messages[lang] = messages; |
|
|
47 |
} |
|
|
48 |
|
|
|
49 |
IriSP.i18n_factory.prototype.addLanguages = function(messages) { |
|
|
50 |
var _this = this; |
|
|
51 |
IriSP.underscore(messages).each(function(_messages, _lang) { |
|
|
52 |
_this.addLanguage(_lang, _messages); |
|
|
53 |
}); |
|
|
54 |
} |
|
|
55 |
|
|
|
56 |
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 |
); |