";
IriSP.overlay_marker_template = "{{! the template for the small bars which is z-indexed over our segment widget }}";
-IriSP.player_template = "{{! template for the radio player }}
";
IriSP.search_template = "{{! template for the search container }}
";
-IriSP.share_template = "{{! social network sharing template }}";
+IriSP.share_template = "{{! social network sharing template }}";
IriSP.sliceWidget_template = "{{! template for the slice widget }}
{{! the whole bar }} {{! the zone which represents our slice }}
";
IriSP.sliderWidget_template = "{{! template for the slider widget - it's composed of two divs we one overlayed on top of the other }}";
IriSP.tooltip_template = "{{! template used by the jquery ui tooltip }}
{{title}}
{{begin}} : {{end}}
{{description}}
";
@@ -1216,7 +1216,11 @@
/* shortcut to have global variables in templates */
IriSP.templToHTML = function(template, values) {
- var params = IriSP.jQuery.extend(IriSP.default_templates_vars, values);
+ var params = IriSP.jQuery.extend(
+ { "defaults" : IriSP.default_templates_vars,
+ "l10n" : IriSP.i18n.getMessages()
+ },
+ values);
return Mustache.to_html(template, params);
};
@@ -1646,6 +1650,8 @@
IriSP.platform_url = "http://192.168.56.101/pf";
IriSP.default_templates_vars = { };
+IriSP.language = 'fr';
+
/** ugly ugly ugly ugly - returns an object defining
the paths to the libs
We need it that way cause it's called at runtime by
@@ -1771,13 +1777,12 @@
"imgs": "/metadataplayer/src/css/imgs"
};
+
IriSP.defaults.default_templates_vars = function() {
return {
"img_dir" : IriSP.paths.imgs
};
-}
-
-/* the widget classes and definitions */
+}/* the widget classes and definitions */
/**
* @class Widget is an "abstract" class. It's mostly used to define some properties common to every widget.
@@ -2244,7 +2249,114 @@
var widgets = IriSP.configureWidgets(pop, layoutManager, config.gui);
var modules = IriSP.configureModules(pop, config.modules);
});
-};/* To wrap a player the develop should create a new class derived from
+};IriSP.i18n_factory = function() {
+ this.messages = {};
+ this.base_lang = 'en';
+}
+
+IriSP.i18n_factory.prototype.getLanguage = function(lang) {
+ var _lang = (
+ typeof lang != "undefined"
+ ? lang
+ : (
+ typeof IriSP.language != "undefined"
+ ? IriSP.language
+ : this.base_lang
+ )
+ );
+ return (
+ typeof this.messages[_lang] == "object"
+ ? _lang
+ : (
+ typeof this.messages[this.base_lang] == "object"
+ ? this.base_lang
+ : null
+ )
+ )
+}
+
+IriSP.i18n_factory.prototype.getMessages = function(lang) {
+ var _lang = this.getLanguage(lang);
+ return (
+ _lang != null
+ ? this.messages[_lang]
+ : {}
+ );
+}
+
+IriSP.i18n_factory.prototype.getMessage = function(message, lang) {
+ var _msgs = this.getMessages(lang);
+ return (
+ typeof _msgs[message] != "undefined"
+ ? _msgs[message]
+ : message
+ )
+}
+
+IriSP.i18n_factory.prototype.addLanguage = function(lang, messages) {
+ this.messages[lang] = messages;
+}
+
+IriSP.i18n_factory.prototype.addLanguages = function(messages) {
+ var _this = this;
+ IriSP.underscore(messages).each(function(_messages, _lang) {
+ _this.addLanguage(_lang, _messages);
+ });
+}
+
+IriSP.i18n = new IriSP.i18n_factory();
+
+IriSP.i18n.addLanguages(
+ {
+ en: {
+ submit: "Submit",
+ add_keywords: "Add keywords",
+ add_polemic_keywords: "Add polemic keywords",
+ your_name: "Your name",
+ type_here: "Type your annotation here.",
+ wait_while_processed: "Please wait while your request is being processed...",
+ error_while_contacting: "An error happened while contacting the server. Your annotation has not been saved.",
+ empty_annotation: "Your annotation is empty. Please write something before submitting.",
+ annotation_saved: "Thank you, your annotation has been saved.",
+ share_annotation: "Would you like to share it on social networks ?",
+ share_on: "Share on",
+ play_pause: "Play/Pause",
+ mute_unmute: "Mute/Unmute",
+ play: "Play",
+ pause: "Pause",
+ mute: "Mute",
+ unmute: "Unmute",
+ annotate: "Annotate",
+ search: "Search",
+ elapsed_time: "Elapsed time",
+ total_time: "Total time"
+ },
+ fr: {
+ submit: "Envoyer",
+ add_keywords: "Ajouter des mots-clés",
+ add_polemic_keywords: "Ajouter des mots-clés polémiques",
+ your_name: "Votre nom",
+ type_here: "Rédigez votre annotation ici.",
+ wait_while_processed: "Veuillez patienter pendant le traitement de votre requête...",
+ error_while_contacting: "Une erreur s'est produite en contactant le serveur. Votre annotation n'a pas été enregistrée",
+ empty_annotation: "Votre annotation est vide. Merci de rédiger un texte avant de l'envoyer.",
+ annotation_saved: "Merci, votre annotation a été enregistrée.",
+ share_annotation: "Souhaitez-vous la partager sur les réseaux sociaux ?",
+ share_on: "Partager sur",
+ play_pause: "Lecture/Pause",
+ mute_unmute: "Couper/Activer le son",
+ play: "Lecture",
+ pause: "Pause",
+ mute: "Couper le son",
+ unmute: "Activer le son",
+ annotate: "Annoter",
+ search: "Rechercher",
+ elapsed_time: "Durée écoulée",
+ total_time: "Durée totale"
+ }
+ }
+);
+/* To wrap a player the develop should create a new class derived from
the IriSP.PopcornReplacement.player and defining the correct functions */
/** allocine player wrapper */
@@ -3304,9 +3416,9 @@
/* test if the browser supports the placeholder attribute */
if (!IriSP.null_or_undefined(jqTextfield.get(0).placeholder)) {
- jqTextfield.attr("placeholder", "Type your annotation here.");
+ jqTextfield.attr("placeholder", IriSP.i18n.getMessage('type_here'));
} else {
- jqTextfield.val("Type your annotation here.");
+ jqTextfield.val(IriSP.i18n.getMessage('type_here'));
jqTextfield.one("click", IriSP.wrap(this, function() { jqTextfield.val(""); }));
}
@@ -3603,10 +3715,10 @@
if ( status == true ){
/* the background sprite is changed by adding/removing the correct classes */
- this.selector.find(".Ldt-CtrlPlay").attr("title", "Play");
+ this.selector.find(".Ldt-CtrlPlay").attr("title", IriSP.i18n.getMessage('play'));
this.selector.find(".Ldt-CtrlPlay").removeClass("Ldt-CtrlPlay-PauseState").addClass("Ldt-CtrlPlay-PlayState");
} else {
- this.selector.find(".Ldt-CtrlPlay").attr("title", "Pause");
+ this.selector.find(".Ldt-CtrlPlay").attr("title", IriSP.i18n.getMessage('pause'));
this.selector.find(".Ldt-CtrlPlay").removeClass("Ldt-CtrlPlay-PlayState").addClass("Ldt-CtrlPlay-PauseState");
}
@@ -3636,10 +3748,10 @@
var status = this._Popcorn.media.muted;
if ( status == true ){
- this.selector.find(".Ldt-CtrlSound").attr("title", "Unmute");
+ this.selector.find(".Ldt-CtrlSound").attr("title", IriSP.i18n.getMessage('unmute'));
this.selector.find(".Ldt-CtrlSound").removeClass("Ldt-CtrlSound-MuteState").addClass("Ldt-CtrlSound-SoundState");
} else {
- this.selector.find(".Ldt-CtrlSound").attr("title", "Mute");
+ this.selector.find(".Ldt-CtrlSound").attr("title", IriSP.i18n.getMessage('mute'));
this.selector.find(".Ldt-CtrlSound").removeClass("Ldt-CtrlSound-SoundState").addClass("Ldt-CtrlSound-MuteState");
}