From a00bd44ca8b39de177c0d345c2a923b73af691ed Mon Sep 17 00:00:00 2001 From: Rodrigo Ferreira de Souza Date: Fri, 10 Jun 2016 15:51:26 -0300 Subject: [PATCH] Translate widget --- CHANGES.rst | 3 ++ .../browser/templates/texttospeech.pt | 17 +++++++- .../locales/collective.texttospeech.pot | 18 +++++++- .../es/LC_MESSAGES/collective.texttospeech.po | 37 ++++++++++++----- .../LC_MESSAGES/collective.texttospeech.po | 41 +++++++++++++------ src/collective/texttospeech/static/main.js | 2 +- 6 files changed, 92 insertions(+), 26 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 81727fa..3690baa 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,9 @@ Changelog 1.0b1 (unreleased) ------------------ +- Implement i18n on the widget and update translations. + [rodfersou, hvelarde] + - Simplify static files stack. [rodfersou] diff --git a/src/collective/texttospeech/browser/templates/texttospeech.pt b/src/collective/texttospeech/browser/templates/texttospeech.pt index 30e53d2..c6395c8 100644 --- a/src/collective/texttospeech/browser/templates/texttospeech.pt +++ b/src/collective/texttospeech/browser/templates/texttospeech.pt @@ -1,4 +1,17 @@ -
+ tal:attributes="data-voice view/voice" + i18n:attributes="data-label-stopped; + data-label-playing; + data-label-paused"> +
diff --git a/src/collective/texttospeech/locales/collective.texttospeech.pot b/src/collective/texttospeech/locales/collective.texttospeech.pot index dc673d4..ea2bc6b 100644 --- a/src/collective/texttospeech/locales/collective.texttospeech.pot +++ b/src/collective/texttospeech/locales/collective.texttospeech.pot @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2016-03-28 19:39+0000\n" +"POT-Creation-Date: 2016-06-10 20:11+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -34,10 +34,26 @@ msgstr "" msgid "If selected, Text-to-Speech feature will be enabled sitewide." msgstr "" +#: collective/texttospeech/browser/templates/texttospeech.pt:1 +msgid "Listen" +msgstr "" + #: collective/texttospeech/interfaces.py:26 msgid "Only objects of these content types will display a Text-to-Speech button." msgstr "" +#: collective/texttospeech/browser/templates/texttospeech.pt:1 +msgid "Pause" +msgstr "" + +#: collective/texttospeech/browser/templates/texttospeech.pt:1 +msgid "Resume" +msgstr "" + +#: collective/texttospeech/browser/templates/texttospeech.pt:11 +msgid "Speech synthesis control" +msgstr "" + #: collective/texttospeech/controlpanel.py:10 #: collective/texttospeech/profiles.zcml:14 #: collective/texttospeech/profiles/default/controlpanel.xml diff --git a/src/collective/texttospeech/locales/es/LC_MESSAGES/collective.texttospeech.po b/src/collective/texttospeech/locales/es/LC_MESSAGES/collective.texttospeech.po index df71e5c..26722ee 100644 --- a/src/collective/texttospeech/locales/es/LC_MESSAGES/collective.texttospeech.po +++ b/src/collective/texttospeech/locales/es/LC_MESSAGES/collective.texttospeech.po @@ -1,28 +1,29 @@ msgid "" msgstr "" "Project-Id-Version: \n" -"POT-Creation-Date: 2016-03-28 19:39+0000\n" -"PO-Revision-Date: 2016-03-28 16:40-0300\n" +"POT-Creation-Date: 2016-06-10 20:11+0000\n" +"PO-Revision-Date: 2016-06-10 17:16-0300\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Language-Code: en\n" "Language-Name: English\n" "Preferred-Encodings: utf-8 latin1\n" "Domain: DOMAIN\n" "Language: es\n" "X-Generator: Poedit 1.7.5\n" +"X-Poedit-SourceCharset: UTF-8\n" #: collective/texttospeech/profiles.zcml:14 msgid "Add Text-to-Speech feature to Plone." -msgstr "Adiciona la funcionalidad de Text-to-Speech a Plone." +msgstr "Adiciona la funcionalidad de síntesis de habla a Plone." #: collective/texttospeech/interfaces.py:19 msgid "Enable Text-to-Speech?" -msgstr "¿Habilitar Text-to-Speech?" +msgstr "¿Habilitar síntesis de habla?" #: collective/texttospeech/interfaces.py:25 msgid "Enabled Content Types" @@ -30,21 +31,37 @@ msgstr "Tipos de contenido habilitados" #: collective/texttospeech/controlpanel.py:11 msgid "Here you can modify the settings for collective.texttospeech." -msgstr "Aquí puede modificar las configuraciones de collective.texttospeech." +msgstr "Aquí puede modificar las configuraciones de síntesis de habla." #: collective/texttospeech/interfaces.py:20 msgid "If selected, Text-to-Speech feature will be enabled sitewide." -msgstr "Si está seleccionado, la funcionalidad de Text-to-Speech estará habilitada en el sitio." +msgstr "Si está seleccionado, la funcionalidad de síntesis de habla estará habilitada en el sitio." + +#: collective/texttospeech/browser/templates/texttospeech.pt:1 +msgid "Listen" +msgstr "Escuchar" #: collective/texttospeech/interfaces.py:26 msgid "Only objects of these content types will display a Text-to-Speech button." -msgstr "Sólo los objetos de estos tipos de contenido mostrarán el botón de Text-to-Speech." +msgstr "Sólo los objetos de estos tipos de contenido mostrarán el botón de síntesis de habla." + +#: collective/texttospeech/browser/templates/texttospeech.pt:1 +msgid "Pause" +msgstr "Pausar" + +#: collective/texttospeech/browser/templates/texttospeech.pt:1 +msgid "Resume" +msgstr "Continuar" + +#: collective/texttospeech/browser/templates/texttospeech.pt:11 +msgid "Speech synthesis control" +msgstr "Control de la síntesis de habla" #: collective/texttospeech/controlpanel.py:10 #: collective/texttospeech/profiles.zcml:14 #: collective/texttospeech/profiles/default/controlpanel.xml msgid "Text-to-Speech" -msgstr "Text-to-Speech" +msgstr "Síntesis de habla" #: collective/texttospeech/profiles.zcml:23 msgid "Uninstalls collective.texttospeech." diff --git a/src/collective/texttospeech/locales/pt_BR/LC_MESSAGES/collective.texttospeech.po b/src/collective/texttospeech/locales/pt_BR/LC_MESSAGES/collective.texttospeech.po index bb41788..7a8c352 100644 --- a/src/collective/texttospeech/locales/pt_BR/LC_MESSAGES/collective.texttospeech.po +++ b/src/collective/texttospeech/locales/pt_BR/LC_MESSAGES/collective.texttospeech.po @@ -1,28 +1,29 @@ msgid "" msgstr "" "Project-Id-Version: \n" -"POT-Creation-Date: 2016-03-28 19:39+0000\n" -"PO-Revision-Date: 2016-03-28 16:44-0300\n" +"POT-Creation-Date: 2016-06-10 20:11+0000\n" +"PO-Revision-Date: 2016-06-10 17:15-0300\n" +"Last-Translator: \n" +"Language-Team: \n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" "Language-Code: en\n" "Language-Name: English\n" "Preferred-Encodings: utf-8 latin1\n" "Domain: DOMAIN\n" -"Last-Translator: \n" -"Language-Team: \n" "Language: pt_BR\n" "X-Generator: Poedit 1.7.5\n" +"X-Poedit-SourceCharset: UTF-8\n" #: collective/texttospeech/profiles.zcml:14 msgid "Add Text-to-Speech feature to Plone." -msgstr "Adiciona a funcionalidade de Text-to-Speech ao Plone." +msgstr "Adiciona a funcionalidade de síntese de voz ao Plone." #: collective/texttospeech/interfaces.py:19 msgid "Enable Text-to-Speech?" -msgstr "Habilitar Text-to-Speech?" +msgstr "Habilitar síntese de voz?" #: collective/texttospeech/interfaces.py:25 msgid "Enabled Content Types" @@ -30,21 +31,37 @@ msgstr "Tipos de conteúdo habilitados" #: collective/texttospeech/controlpanel.py:11 msgid "Here you can modify the settings for collective.texttospeech." -msgstr "Aqui pode modificar as configurações do collective.texttospeech." +msgstr "Aqui pode modificar as configurações de síntese de voz." #: collective/texttospeech/interfaces.py:20 msgid "If selected, Text-to-Speech feature will be enabled sitewide." -msgstr "Se estiver selecionado, a funcionalidade de Text-to-Speech estará habilitada no site." +msgstr "Se estiver selecionado, a funcionalidade de síntese de voz estará habilitada no site." + +#: collective/texttospeech/browser/templates/texttospeech.pt:1 +msgid "Listen" +msgstr "Ouvir" #: collective/texttospeech/interfaces.py:26 msgid "Only objects of these content types will display a Text-to-Speech button." -msgstr "Só objetos de esses tipos de conteúdo mostrarão o botão de Text-to-Speech." +msgstr "Só objetos de esses tipos de conteúdo mostrarão o botão de síntese de voz." + +#: collective/texttospeech/browser/templates/texttospeech.pt:1 +msgid "Pause" +msgstr "Pausar" + +#: collective/texttospeech/browser/templates/texttospeech.pt:1 +msgid "Resume" +msgstr "Continuar" + +#: collective/texttospeech/browser/templates/texttospeech.pt:11 +msgid "Speech synthesis control" +msgstr "Controle da síntese de voz" #: collective/texttospeech/controlpanel.py:10 #: collective/texttospeech/profiles.zcml:14 #: collective/texttospeech/profiles/default/controlpanel.xml msgid "Text-to-Speech" -msgstr "Text-to-Speech" +msgstr "Síntese de voz" #: collective/texttospeech/profiles.zcml:23 msgid "Uninstalls collective.texttospeech." diff --git a/src/collective/texttospeech/static/main.js b/src/collective/texttospeech/static/main.js index 8abb823..6b2c6bf 100644 --- a/src/collective/texttospeech/static/main.js +++ b/src/collective/texttospeech/static/main.js @@ -1 +1 @@ -var MainView = (function() { function MainView() { var self = this; self.$el = $('#viewlet-texttospeech'); self.$el.data('main', self); self.template = ""; self.playing = false; self.paused = true; self.render(); self.$button.on('click', self.play_pause); } MainView.prototype.render = function() { var self = this; self.$el.html(self.template); self.$button = $('#texttospeech-button', self.$el); }; MainView.prototype.onstart = function() { var self = $('#viewlet-texttospeech').data('main'); self.playing = true; self.paused = false; self.$button.attr('value', 'Pause'); }; MainView.prototype.onend = function() { var self = $('#viewlet-texttospeech').data('main'); self.playing = false; self.paused = true; self.$button.attr('value', 'Play'); }; MainView.prototype.play_pause = function(e) { e.preventDefault(); var self = $('#viewlet-texttospeech').data('main'); if (self.playing) { if (self.paused) { self.paused = false; self.$button.attr('value', 'Pause'); responsiveVoice.resume(); } else { self.paused = true; self.$button.attr('value', 'Play'); responsiveVoice.pause(); } } else { responsiveVoice.speak( $('#content').text(), self.$el.attr('data-voice'), { onstart: self.onstart, onend: self.onend } ); } }; return MainView; })(); var ControlPanelView = (function() { function ControlPanelView() { var self = this; self.template = ""; self.actual_voice = $('#form-widgets-voice').val(); self.render(); } ControlPanelView.prototype.render = function() { var self = this; $('#form-widgets-voice').replaceWith(self.template); var voicelist = responsiveVoice.getVoices(); var vselect = $('#form-widgets-voice'); var i, len, voice; for (i = 0, len = voicelist.length; i < len; i++) { voice = voicelist[i]; if (voice.name === self.actual_voice) { vselect.append($('