Browse Source

Merge pull request #387 from Tecnativa/9.0-web_translate_dialog

[9.0][MIG] web_translate_dialog
pull/400/head
Pedro M. Baeza 8 years ago
committed by GitHub
parent
commit
b394ba3c91
  1. 53
      web_translate_dialog/README.rst
  2. 50
      web_translate_dialog/__openerp__.py
  3. 54
      web_translate_dialog/i18n/ar.po
  4. 54
      web_translate_dialog/i18n/de.po
  5. 49
      web_translate_dialog/i18n/es.po
  6. 54
      web_translate_dialog/i18n/fi.po
  7. 49
      web_translate_dialog/i18n/fr.po
  8. 53
      web_translate_dialog/i18n/hr.po
  9. 54
      web_translate_dialog/i18n/it.po
  10. 54
      web_translate_dialog/i18n/pt_BR.po
  11. 54
      web_translate_dialog/i18n/sl.po
  12. 56
      web_translate_dialog/i18n/tr.po
  13. 3
      web_translate_dialog/static/src/css/base.css
  14. 197
      web_translate_dialog/static/src/js/web_translate_dialog.js
  15. 37
      web_translate_dialog/static/src/xml/base.xml
  16. 11
      web_translate_dialog/view/web_translate.xml

53
web_translate_dialog/README.rst

@ -1,35 +1,72 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
====================
Web Translate Dialog Web Translate Dialog
==================== ====================
This module replaces the standard translation view by an easy-to-use pop-up view where you can translate all the fields of the object in all the installed languages (for the ancient users, it may remind them the translation pop-up of OpenERP 6.1).
This module replaces the standard translation view by an easy-to-use pop-up
view where you can translate all the fields of the object in all the installed
languages (for long-time users, it may remind them the translation pop-up of
OpenERP 6.1).
This module also features: This module also features:
* Adds a *Translate* button item in the *More* menu
* Support HTML fields
* A *Translate* button item in the *More* menu
* Support for HTML fields
* Autosize the textareas to the size of the content * Autosize the textareas to the size of the content
Usage Usage
===== =====
Go to an object that has translatable fields (*Products* for example) and select *More > Translate* (or click on *Edit* and then click on the flag at the top-right of one of the translatable fields): the translation view will pop-up on your screen. This translation view contains all the translatable fields of the object.
Go to an object that has translatable fields (*Products* for example) and
select *More > Translate* (or click on *Edit* and then click on the flag at
the top-right of one of the translatable fields): the translation view will
pop-up on your screen. This translation view contains all the translatable
fields of the object.
If you click in the standard translate icon then the translation view will
pop-up with this field only.
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/162/9.0
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/web/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.
Credits Credits
======= =======
Images
------
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors Contributors
------------ ------------
* Guewen Baconnier (Camptocamp) * Guewen Baconnier (Camptocamp)
* Antonio Espinosa <antonio.espinosa@tecnativa.com>
Maintainer Maintainer
---------- ----------
.. image:: http://odoo-community.org/logo.png
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association :alt: Odoo Community Association
:target: http://odoo-community.org
:target: https://odoo-community.org
This module is maintained by the OCA. This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit http://odoo-community.org.
To contribute to this module, please visit https://odoo-community.org.

50
web_translate_dialog/__openerp__.py

@ -1,32 +1,26 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{"name": "Web Translate Dialog",
"category": "Web",
# Copyright 2012 Guewen Baconnier (Camptocamp SA)
# Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Web Translate Dialog",
"summary": "Easy-to-use pop-up to translate fields in several languages", "summary": "Easy-to-use pop-up to translate fields in several languages",
"version": "9.0.1.0.0",
"category": "Web",
"website": "https://odoo-community.org/",
"author": "Camptocamp, "
"Tecnativa, "
"Odoo Community Association (OCA)",
"license": "AGPL-3", "license": "AGPL-3",
"author": "Camptocamp,Odoo Community Association (OCA)",
"version": "8.0.1.0.0",
"depends": ['web'],
'data': ['view/web_translate.xml'],
'qweb': ["static/src/xml/base.xml"],
'installable': False,
"application": False,
"installable": True,
"depends": [
"web",
],
"data": [
"view/web_translate.xml",
],
"qweb": [
"static/src/xml/base.xml",
]
} }

54
web_translate_dialog/i18n/ar.po

@ -0,0 +1,54 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_translate_dialog
#
# Translators:
# SaFi J. <safi2266@gmail.com>, 2015
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-12-16 07:41+0000\n"
"PO-Revision-Date: 2015-12-16 17:26+0000\n"
"Last-Translator: SaFi J. <safi2266@gmail.com>\n"
"Language-Team: Arabic (http://www.transifex.com/oca/OCA-web-8-0/language/ar/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: ar\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:30
#, python-format
msgid "Cancel"
msgstr "إلغاء"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:7
#, python-format
msgid "Field"
msgstr "الحقل"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:29
#, python-format
msgid "Save"
msgstr "حفظ"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/js/web_translate_dialog.js:15
#, python-format
msgid "Translate"
msgstr "ترجم"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/js/web_translate_dialog.js:37
#, python-format
msgid "Translations"
msgstr "الترجمات"

54
web_translate_dialog/i18n/de.po

@ -0,0 +1,54 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_translate_dialog
#
# Translators:
# Rudolf Schnapka <rs@techno-flex.de>, 2016
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-01-10 07:31+0000\n"
"PO-Revision-Date: 2016-01-18 20:58+0000\n"
"Last-Translator: Rudolf Schnapka <rs@techno-flex.de>\n"
"Language-Team: German (http://www.transifex.com/oca/OCA-web-8-0/language/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:30
#, python-format
msgid "Cancel"
msgstr "Abbrechen"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:7
#, python-format
msgid "Field"
msgstr "Feld"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:29
#, python-format
msgid "Save"
msgstr "Speichern"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/js/web_translate_dialog.js:15
#, python-format
msgid "Translate"
msgstr "Übersetze"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/js/web_translate_dialog.js:37
#, python-format
msgid "Translations"
msgstr "Übersetzungen"

49
web_translate_dialog/i18n/es.po

@ -1,19 +1,43 @@
# Translation of OpenERP Server.
# Translation of Odoo Server.
# This file contains the translation of the following modules: # This file contains the translation of the following modules:
# * web_translate_dialog
# #
# Translators:
# Pedro M. Baeza <pedro.baeza@gmail.com>, 2015
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-12-09 07:15+0000\n"
"PO-Revision-Date: 2014-03-07 15:45+0000\n"
"Last-Translator: Pedro Manuel Baeza <pedro.baeza@gmail.com>\n"
"Language-Team: \n"
"POT-Creation-Date: 2015-11-23 13:46+0000\n"
"PO-Revision-Date: 2015-11-07 11:25+0000\n"
"Last-Translator: Pedro M. Baeza <pedro.baeza@gmail.com>\n"
"Language-Team: Spanish (http://www.transifex.com/oca/OCA-web-8-0/language/es/)\n"
"MIME-Version: 1.0\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"
"X-Launchpad-Export-Date: 2014-06-28 06:02+0000\n"
"X-Generator: Launchpad (build 17077)\n"
"Content-Transfer-Encoding: \n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:30
#, python-format
msgid "Cancel"
msgstr "Cancelar"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:7
#, python-format
msgid "Field"
msgstr "Campo"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:29
#, python-format
msgid "Save"
msgstr "Guardar"
#. module: web_translate_dialog #. module: web_translate_dialog
#. openerp-web #. openerp-web
@ -28,10 +52,3 @@ msgstr "Traducir"
#, python-format #, python-format
msgid "Translations" msgid "Translations"
msgstr "Traducciones" msgstr "Traducciones"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:7
#, python-format
msgid "Field"
msgstr "Campo"

54
web_translate_dialog/i18n/fi.po

@ -0,0 +1,54 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_translate_dialog
#
# Translators:
# Jarmo Kortetjärvi <jarmo.kortetjarvi@gmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-01-10 07:31+0000\n"
"PO-Revision-Date: 2016-02-01 09:53+0000\n"
"Last-Translator: Jarmo Kortetjärvi <jarmo.kortetjarvi@gmail.com>\n"
"Language-Team: Finnish (http://www.transifex.com/oca/OCA-web-8-0/language/fi/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: fi\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:30
#, python-format
msgid "Cancel"
msgstr "Peru"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:7
#, python-format
msgid "Field"
msgstr "Kenttä"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:29
#, python-format
msgid "Save"
msgstr "Tallenna"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/js/web_translate_dialog.js:15
#, python-format
msgid "Translate"
msgstr "Käännä"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/js/web_translate_dialog.js:37
#, python-format
msgid "Translations"
msgstr "Käännökset"

49
web_translate_dialog/i18n/fr.po

@ -1,19 +1,43 @@
# Translation of OpenERP Server.
# Translation of Odoo Server.
# This file contains the translation of the following modules: # This file contains the translation of the following modules:
# * web_translate_dialog
# #
# Translators:
# Mohamed HABOU <m.habou@agoradeveloppement.com>, 2016
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-12-09 07:15+0000\n"
"PO-Revision-Date: 2014-03-07 15:45+0000\n"
"Last-Translator: Guewen Baconnier @ Camptocamp <Unknown>\n"
"Language-Team: \n"
"POT-Creation-Date: 2016-01-10 07:31+0000\n"
"PO-Revision-Date: 2016-01-14 14:50+0000\n"
"Last-Translator: Mohamed HABOU <m.habou@agoradeveloppement.com>\n"
"Language-Team: French (http://www.transifex.com/oca/OCA-web-8-0/language/fr/)\n"
"MIME-Version: 1.0\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"
"X-Launchpad-Export-Date: 2014-06-28 06:02+0000\n"
"X-Generator: Launchpad (build 17077)\n"
"Content-Transfer-Encoding: \n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:30
#, python-format
msgid "Cancel"
msgstr "Annuler"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:7
#, python-format
msgid "Field"
msgstr "Champ"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:29
#, python-format
msgid "Save"
msgstr "Enregistrer"
#. module: web_translate_dialog #. module: web_translate_dialog
#. openerp-web #. openerp-web
@ -28,10 +52,3 @@ msgstr "Traduire"
#, python-format #, python-format
msgid "Translations" msgid "Translations"
msgstr "Traductions" msgstr "Traductions"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:7
#, python-format
msgid "Field"
msgstr "Champ"

53
web_translate_dialog/i18n/hr.po

@ -0,0 +1,53 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_translate_dialog
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-06-24 00:46+0000\n"
"PO-Revision-Date: 2015-11-07 11:21+0000\n"
"Last-Translator: <>\n"
"Language-Team: Croatian (http://www.transifex.com/oca/OCA-web-8-0/language/hr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: hr\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:30
#, python-format
msgid "Cancel"
msgstr "Otkaži"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:7
#, python-format
msgid "Field"
msgstr ""
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:29
#, python-format
msgid "Save"
msgstr ""
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/js/web_translate_dialog.js:15
#, python-format
msgid "Translate"
msgstr ""
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/js/web_translate_dialog.js:37
#, python-format
msgid "Translations"
msgstr ""

54
web_translate_dialog/i18n/it.po

@ -0,0 +1,54 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_translate_dialog
#
# Translators:
# Paolo Valier, 2016
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-03-17 07:30+0000\n"
"PO-Revision-Date: 2016-03-19 10:15+0000\n"
"Last-Translator: Paolo Valier\n"
"Language-Team: Italian (http://www.transifex.com/oca/OCA-web-8-0/language/it/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: it\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:30
#, python-format
msgid "Cancel"
msgstr "Annulla"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:7
#, python-format
msgid "Field"
msgstr "Campo"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:29
#, python-format
msgid "Save"
msgstr "Salva"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/js/web_translate_dialog.js:15
#, python-format
msgid "Translate"
msgstr "Traduci"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/js/web_translate_dialog.js:37
#, python-format
msgid "Translations"
msgstr "Traduzioni"

54
web_translate_dialog/i18n/pt_BR.po

@ -0,0 +1,54 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_translate_dialog
#
# Translators:
# danimaribeiro <danimaribeiro@gmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-03-11 02:17+0000\n"
"PO-Revision-Date: 2016-03-05 16:20+0000\n"
"Last-Translator: danimaribeiro <danimaribeiro@gmail.com>\n"
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-web-8-0/language/pt_BR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: pt_BR\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:30
#, python-format
msgid "Cancel"
msgstr "Cancelar"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:7
#, python-format
msgid "Field"
msgstr "Campo"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:29
#, python-format
msgid "Save"
msgstr "Salvar"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/js/web_translate_dialog.js:15
#, python-format
msgid "Translate"
msgstr "Traduzir"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/js/web_translate_dialog.js:37
#, python-format
msgid "Translations"
msgstr "Traduções"

54
web_translate_dialog/i18n/sl.po

@ -0,0 +1,54 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_translate_dialog
#
# Translators:
# Matjaž Mozetič <m.mozetic@matmoz.si>, 2015
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-11-23 13:46+0000\n"
"PO-Revision-Date: 2015-11-08 05:47+0000\n"
"Last-Translator: Matjaž Mozetič <m.mozetic@matmoz.si>\n"
"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-web-8-0/language/sl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: sl\n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:30
#, python-format
msgid "Cancel"
msgstr "Preklic"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:7
#, python-format
msgid "Field"
msgstr "Polje"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:29
#, python-format
msgid "Save"
msgstr "Shrani"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/js/web_translate_dialog.js:15
#, python-format
msgid "Translate"
msgstr "Prevod"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/js/web_translate_dialog.js:37
#, python-format
msgid "Translations"
msgstr "Prevodi"

56
web_translate_dialog/i18n/tr.po

@ -1,21 +1,44 @@
# Turkish translation for web-addons
# Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014
# This file is distributed under the same license as the web-addons package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2014.
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_translate_dialog
# #
# Translators:
# Ahmet Altınışık <aaltinisik@altinkaya.com.tr>, 2015
# FIRST AUTHOR <EMAIL@ADDRESS>, 2014
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: web-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2013-12-09 07:15+0000\n"
"PO-Revision-Date: 2014-03-07 22:08+0000\n"
"Last-Translator: Ediz Duman <neps1192@gmail.com>\n"
"Language-Team: Turkish <tr@li.org>\n"
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-01-08 21:34+0000\n"
"PO-Revision-Date: 2015-12-30 22:16+0000\n"
"Last-Translator: Ahmet Altınışık <aaltinisik@altinkaya.com.tr>\n"
"Language-Team: Turkish (http://www.transifex.com/oca/OCA-web-8-0/language/tr/)\n"
"MIME-Version: 1.0\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"
"X-Launchpad-Export-Date: 2014-06-28 06:02+0000\n"
"X-Generator: Launchpad (build 17077)\n"
"Content-Transfer-Encoding: \n"
"Language: tr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:30
#, python-format
msgid "Cancel"
msgstr "İptal"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:7
#, python-format
msgid "Field"
msgstr "Alan"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:29
#, python-format
msgid "Save"
msgstr "Kaydet"
#. module: web_translate_dialog #. module: web_translate_dialog
#. openerp-web #. openerp-web
@ -30,10 +53,3 @@ msgstr "Çeviri"
#, python-format #, python-format
msgid "Translations" msgid "Translations"
msgstr "daha çevrilmedi" msgstr "daha çevrilmedi"
#. module: web_translate_dialog
#. openerp-web
#: code:addons/web_translate_dialog/static/src/xml/base.xml:7
#, python-format
msgid "Field"
msgstr "Alan"

3
web_translate_dialog/static/src/css/base.css

@ -1,3 +1,6 @@
/* Copyright 2012 Guewen Baconnier (Camptocamp SA)
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
.openerp .oe_translation_field { .openerp .oe_translation_field {
width: 95%; width: 95%;
} }

197
web_translate_dialog/static/src/js/web_translate_dialog.js

@ -1,38 +1,27 @@
openerp.web_translate_dialog = function (instance) {
/* Copyright 2012 Guewen Baconnier (Camptocamp SA)
Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
odoo.define('web_translate_dialog.translate_dialog', function(require){
"use strict"; "use strict";
var QWeb = instance.web.qweb,
_t = instance.web._t,
_lt = instance.web._lt;
var _ = require('_');
var $ = require('$');
instance.web.FormView.include({
load_form: function(data) {
var self = this;
this._super(data);
if (this.sidebar) {
this.sidebar.add_items('other', _.compact([
self.is_action_enabled('edit') && { label: _t('Translate'), callback: self.on_button_translate },
]));
}
},
on_button_translate: function() {
var self = this;
$.when(this.has_been_loaded).then(function() {
self.open_translate_dialog(this);
});
},
});
var core = require('web.core');
var data = require('web.data');
var common = require('web.form_common');
instance.web.View.include({
open_translate_dialog: function() {
new instance.web_translate_dialog.TranslateDialog(this).open();
}
});
var FormView = require('web.FormView');
var View = require('web.View');
var Dialog = require('web.Dialog');
var _t = core._t;
var QWeb = core.qweb;
instance.web_translate_dialog.TranslateDialog = instance.web.Dialog.extend({
var translateDialog = Dialog.extend({
template: "TranslateDialog", template: "TranslateDialog",
init: function(parent, options, content) {
init: function(parent, field, content) {
this._super(parent, this._super(parent,
{title: _t("Translations"), {title: _t("Translations"),
width: '90%', width: '90%',
@ -43,12 +32,22 @@ openerp.web_translate_dialog = function (instance) {
this.view_type = parent.fields_view.type || ''; this.view_type = parent.fields_view.type || '';
this.$view_form = null; this.$view_form = null;
this.$sidebar_form = null; this.$sidebar_form = null;
this.translatable_fields_keys = _.map(this.view.translatable_fields || [], function(i) { return i.name;});
if (!!field) {
this.translatable_fields_keys = [field];
this.translatable_fields = _.filter(
this.view.translatable_fields || [],
function(i) {return i.name == field;}
);
} else {
this.translatable_fields_keys = _.map(
this.view.translatable_fields || [],
function(i) {return i.name;}
);
this.translatable_fields = this.view.translatable_fields.slice(0);
}
this.languages = null; this.languages = null;
this.languages_loaded = $.Deferred(); this.languages_loaded = $.Deferred();
(new instance.web.DataSetSearch(this,
'res.lang',
this.view.dataset.get_context(),
(new data.DataSetSearch(this, 'res.lang', this.view.dataset.get_context(),
[['translatable', '=', '1']])) [['translatable', '=', '1']]))
.read_slice(['code', 'name'], { sort: 'id' }) .read_slice(['code', 'name'], { sort: 'id' })
.then(this.on_languages_loaded); .then(this.on_languages_loaded);
@ -70,59 +69,48 @@ openerp.web_translate_dialog = function (instance) {
this.$el.find('.oe_translation_field').change(function() { this.$el.find('.oe_translation_field').change(function() {
$(this).toggleClass('touched', ($(this).val() != $(this).attr('data-value'))); $(this).toggleClass('touched', ($(this).val() != $(this).attr('data-value')));
}); });
this.$buttons.html(QWeb.render("TranslateDialog.buttons"));
this.$buttons.find(".oe_form_translate_dialog_save_button").click(function(){
this.$footer.html(QWeb.render("TranslateDialog.buttons"));
this.$footer.find(".oe_form_translate_dialog_save_button").click(function(){
self.on_button_save(); self.on_button_save();
self.on_button_close(); self.on_button_close();
}); });
this.$buttons.find(".oe_form_translate_dialog_cancel_button").click(function(){
this.$footer.find(".oe_form_translate_dialog_cancel_button").click(function(){
self.on_button_close(); self.on_button_close();
}); });
this.initialize_html_fields();
this.do_load_fields_values(); this.do_load_fields_values();
}, },
initialize_html_fields: function() {
this.$el.find('.oe_form_field_html textarea').each(function() {
var $textarea = $(this);
var width = 100; // forced to fixed size on initialization
// will be changed to percentage right after
// the creation
var height = 250;
$textarea.cleditor({
width: width, // width not including margins, borders or padding
height: height, // height not including margins, borders or padding
controls: // controls to add to the toolbar
"bold italic underline strikethrough " +
"| removeformat | bullets numbering | outdent " +
"indent | link unlink | source",
bodyStyle: // style to assign to document body contained within the editor
"margin:4px; color:#4c4c4c; font-size:13px; font-family:'Lucida Grande',Helvetica,Verdana,Arial,sans-serif; cursor:text"
});
var $cleditor = $textarea.cleditor()[0];
// Down to -- end, this is a workaround for the bug
// https://bugs.launchpad.net/openerp-web/+bug/1258463
// The editor is initially created with a fixed size so
// the buggy event is not bound to $(window), then we restore
// a percentage width and bind the "normal" event without the
// CHM's buggy change.
$cleditor.$main.width('95%');
$cleditor.options.width = '95%';
$(window).resize(function() {
//Forcefully blurred iframe contentWindow, chrome, IE, safari doesn't trigger blur on window resize and due to which text disappears
var contentWindow = $cleditor.$frame[0].contentWindow;
if(!$.browser.mozilla && contentWindow){
$(contentWindow).trigger('blur');
initialize_html_fields: function(lang) {
var self = this;
_.each(this.translatable_fields_keys, function(f) {
// Initialize summernote if HTML field
self.$el.find('.oe_form_field_html .oe_translation_field[name="' + lang.code + '-' + f + '"]').each(function() {
var $parent = $(this).summernote({
'focus': false,
'toolbar': [
['style', ['style']],
['font', ['bold', 'italic', 'underline', 'clear']],
['fontsize', ['fontsize']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['table', ['table']],
['insert', ['link', 'picture']],
['history', ['undo', 'redo']]
],
'prettifyHtml': false,
'styleWithSpan': false,
'inlinemedia': ['p'],
'lang': "odoo",
'onChange': function (value) {
$(this).toggleClass('touched', (value != $(this).attr('data-value')));
} }
}).parent();
// Triggers a mouseup to refresh the editor toolbar
$parent.find('.note-editable').trigger('mouseup');
$parent.find('.note-editing-area').css({
minHeight:'100px',
minWidth:'260px',
}); });
$cleditor.refresh();
// -- end
$cleditor.change(function() {
this.updateTextArea();
this.$area.toggleClass('touched',
(this.$area.val() != this.$area.attr('data-value')));
}); });
}); });
}, },
@ -132,16 +120,12 @@ openerp.web_translate_dialog = function (instance) {
self.$el.find('.oe_translation_field[name="' + lang.code + '-' + f + '"]') self.$el.find('.oe_translation_field[name="' + lang.code + '-' + f + '"]')
.val(values[f] || '') .val(values[f] || '')
.attr('data-value', values[f] || ''); .attr('data-value', values[f] || '');
var $tarea = self.$el.find('.oe_form_field_html .oe_translation_field[name="' + lang.code + '-' + f + '"]');
if ($tarea.length) {
$tarea.cleditor()[0].updateFrame();
}
}); });
var $textarea = this.$el.find('textarea.oe_translation_field');
$textarea.css({minHeight:'100px'});
$textarea.autosize();
this.$el.find('textarea.oe_translation_field').css({
minHeight:'100px',
});
$(window).resize(); // triggers the autosize $(window).resize(); // triggers the autosize
this.initialize_html_fields(lang);
}, },
do_load_fields_values: function() { do_load_fields_values: function() {
var self = this, var self = this,
@ -169,7 +153,7 @@ openerp.web_translate_dialog = function (instance) {
self.set_fields_values(lg, rows[0]); self.set_fields_values(lg, rows[0]);
deff.resolve(); deff.resolve();
}); });
};
}
}); });
return deferred; return deferred;
}, },
@ -184,12 +168,15 @@ openerp.web_translate_dialog = function (instance) {
} }
translations[field[0]][field[1]] = $(this).val(); translations[field[0]][field[1]] = $(this).val();
}); });
_.each(translations, function(data, code) {
_.each(translations, function(text, code) {
if (code === self.view_language) { if (code === self.view_language) {
self.view.set_values(data);
self.view.set_values(text);
} }
translation_mutex.exec(function() { translation_mutex.exec(function() {
return new instance.web.DataSet(self, self.view.dataset.model, self.view.dataset.get_context()).write(self.view.datarecord.id, data, { context : { 'lang': code }});
return new data.DataSet(self, self.view.dataset.model,
self.view.dataset.get_context())
.write(self.view.datarecord.id, text,
{ context : { 'lang': code }});
}); });
}); });
this.close(); this.close();
@ -200,10 +187,42 @@ openerp.web_translate_dialog = function (instance) {
}); });
instance.web.form.AbstractField.include({
FormView.include({
render_sidebar: function($node) {
this._super($node);
if (this.sidebar) {
this.sidebar.add_items('other', _.compact([
this.is_action_enabled('edit') &&
this.translatable_fields.length > 0 && {
label: _t('Translate'),
callback: this.on_button_translate
},
]));
}
},
on_button_translate: function() {
var self = this;
$.when(this.has_been_loaded).then(function() {
self.open_translate_dialog();
});
},
});
View.include({
open_translate_dialog: function(field) {
new translateDialog(this, field).open();
}
});
common.AbstractField.include({
on_translate: function() { on_translate: function() {
// the image next to the fields opens the translate dialog // the image next to the fields opens the translate dialog
this.view.open_translate_dialog();
this.view.open_translate_dialog(this.name);
}, },
}); });
return {
translateDialog: translateDialog,
}; };
}); // odoo.define

37
web_translate_dialog/static/src/xml/base.xml

@ -1,7 +1,14 @@
<templates>
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2012 Guewen Baconnier (Camptocamp SA)
Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<template>
<t t-name="TranslateDialog"> <t t-name="TranslateDialog">
<table t-if="widget.view.translatable_fields" class="oe_frame oe_forms oe_translation_form" border="0" cellpadding="0" cellspacing="0" width="100%">
<div class="modal-body">
<table t-if="widget.view.translatable_fields"
class="oe_frame oe_forms oe_translation_form"
border="0" cellpadding="0" cellspacing="0" width="100%">
<tr> <tr>
<td class="oe_form_separator" width="1%" nowrap="nowrap"> <td class="oe_form_separator" width="1%" nowrap="nowrap">
<div class="separator horizontal">Field</div> <div class="separator horizontal">Field</div>
@ -10,25 +17,35 @@
<div class="separator horizontal"><t t-esc="name"/></div> <div class="separator horizontal"><t t-esc="name"/></div>
</th> </th>
</tr> </tr>
<tr t-foreach="widget.view.translatable_fields" t-as="field" t-att-data-field="field.name">
<tr t-foreach="widget.translatable_fields" t-as="field"
t-att-data-field="field.name">
<td class="oe_form_frame_cell" width="1%" nowrap="nowrap"> <td class="oe_form_frame_cell" width="1%" nowrap="nowrap">
<label class="oe_label"><t t-esc="field.string"/>:</label> <label class="oe_label"><t t-esc="field.string"/>:</label>
</td> </td>
<td t-foreach="widget.languages" t-as="lg" class="oe_form_frame_cell"> <td t-foreach="widget.languages" t-as="lg" class="oe_form_frame_cell">
<input t-if="field.field.type == 'char' || field.field.type == 'url'" type="text" t-attf-name="#{lg.code}-#{field.name}" value="" data-value="" class="oe_translation_field"/>
<textarea t-if="field.field.type == 'text'" t-attf-name="#{lg.code}-#{field.name}" data-value="" class="oe_translation_field" ></textarea>
<input t-if="field.field.type == 'char' || field.field.type == 'url'"
type="text" t-attf-name="#{lg.code}-#{field.name}"
value="" data-value="" class="oe_translation_field"/>
<textarea t-if="field.field.type == 'text'"
t-attf-name="#{lg.code}-#{field.name}" data-value=""
class="oe_translation_field" ></textarea>
<div t-if="field.field.type == 'html'" class="oe_form_field_html"> <div t-if="field.field.type == 'html'" class="oe_form_field_html">
<textarea class="oe_translation_field oe_form_field" t-attf-name="#{lg.code}-#{field.name}" data-value=""/>
<textarea class="oe_translation_field oe_form_field"
t-attf-name="#{lg.code}-#{field.name}" data-value=""/>
</div> </div>
</td> </td>
</tr> </tr>
</table> </table>
</div>
</t> </t>
<t t-name="TranslateDialog.buttons"> <t t-name="TranslateDialog.buttons">
<button class="oe_form_translate_dialog_save_button oe_button oe_highlight">Save</button>
<button class="oe_form_translate_dialog_cancel_button oe_button">Cancel</button>
<button class="btn btn-sm oe_button btn-primary oe_form_translate_dialog_save_button">
<span>Save</span>
</button>
<button class="btn btn-sm oe_button btn-default oe_form_translate_dialog_cancel_button">
<span>Cancel</span>
</button>
</t> </t>
</templates>
</template>

11
web_translate_dialog/view/web_translate.xml

@ -1,11 +1,16 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2012 Guewen Baconnier (Camptocamp SA)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<openerp> <openerp>
<data> <data>
<template id="assets_backend" name="web_translate_dialog assets" inherit_id="web.assets_backend">
<template id="assets_backend" name="web_translate_dialog assets"
inherit_id="web.assets_backend">
<xpath expr="." position="inside"> <xpath expr="." position="inside">
<script type="text/javascript" src="/web_translate_dialog/static/src/js/web_translate_dialog.js"></script>
<link rel="stylesheet" href="/web_translate_dialog/static/src/css/base.css" id="translate-dialog-stylesheet"/>
<script type="text/javascript"
src="/web_translate_dialog/static/src/js/web_translate_dialog.js"/>
<link rel="stylesheet" id="translate-dialog-stylesheet"
href="/web_translate_dialog/static/src/css/base.css"/>
</xpath> </xpath>
</template> </template>

Loading…
Cancel
Save