diff --git a/translation_helper/__init__.py b/translation_helper/__init__.py new file mode 100644 index 000000000..a3e10cf0b --- /dev/null +++ b/translation_helper/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: LINTO C T() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## + +import models \ No newline at end of file diff --git a/translation_helper/__manifest__.py b/translation_helper/__manifest__.py new file mode 100644 index 000000000..405cfd7fe --- /dev/null +++ b/translation_helper/__manifest__.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Linto C T() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +{ + 'name': 'Translation Helper', + 'version': '10.0.1.0.0', + 'category': 'Extra Tools', + 'summary': """Button To Translate New Words Using 'googletrans'.""", + 'description': """This module will help you to translate new words.""", + 'author': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'depends': ['base'], + 'external_dependencies': {'python': ['googletrans']}, + 'data': [ + 'data/lang_data.xml', + 'views/translation.xml', + 'security/ir.model.access.csv', + ], + 'images': ['static/description/banner.jpg'], + 'license': 'LGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/translation_helper/data/lang_data.xml b/translation_helper/data/lang_data.xml new file mode 100644 index 000000000..9ac3ef38d --- /dev/null +++ b/translation_helper/data/lang_data.xml @@ -0,0 +1,159 @@ + + + + Greek / Ελληνικά + el + + + English + en + + + Catalan / Català + ca + + + Italian / Italiano + it + + + Swedish / svenska + sv + + + Czech / Čeština + cs + + + Arabic / الْعَرَبيّة + ar + + + Estonian / Eesti keel + et + + + Indonesian / Bahasa Indonesia + id + + + Spanish / Español + es + + + Russian / русский язык + es + + + Dutch / Nederlands + nl + + + Portuguese / Português + pt + + + Turkish / Türkçe + tr + + + Latvian / latviešu valoda + lv + + + Lithuanian / Lietuvių kalba + lt + + + Thai / ภาษาไทย + th + + + Vietnamese / Tiếng Việt + vi + + + Romanian / română + ro + + + Polish / Język polski + pl + + + French / Français + fr + + + Bulgarian / български език + bg + + + Ukrainian / українська + uk + + + Croatian / hrvatski jezik + hr + + + Slovenian / slovenščina + sl + + + Danish / Dansk + da + + + Persian / فارس + fa + + + Hindi / हिंदी + hi + + + Finnish / Suomi + fi + + + Hungarian / Magyar + hu + + + Japanese / 日本語 + ja + + + Norwegian Bokmål / Norsk bokmål + no + + + Korean (KP) / 한국어 (KP) + ko + + + Korean (KP) / 한국어 (KP)Korean (KR) / 한국어 (KR) + ko + + + Slovak / Slovenský jazyk + sk + + + Slovak / Slovenský jazyk + sk + + + German / Deutsch + de + + + German (CH) / Deutsch (CH) + de + + + German (CH) / Deutsch (CH) + de + + \ No newline at end of file diff --git a/translation_helper/models/__init__.py b/translation_helper/models/__init__.py new file mode 100644 index 000000000..74ef3490d --- /dev/null +++ b/translation_helper/models/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: LINTO C T() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## + +import translation_helper \ No newline at end of file diff --git a/translation_helper/models/translation_helper.py b/translation_helper/models/translation_helper.py new file mode 100644 index 000000000..590815b8d --- /dev/null +++ b/translation_helper/models/translation_helper.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: LINTO C T() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## + +import time +try: + from googletrans import Translator + translator = Translator() +except ImportError: + print "Unable to import " + +from odoo import models, fields, _ +from odoo.exceptions import UserError + + +class LanguageList(models.Model): + _name = 'languages.list' + + name = fields.Char(string="Name") + code = fields.Char(string="Code") + + +class TranslationHelper(models.Model): + _inherit = 'ir.translation' + + def translate_term(self): + if self.lang: + lang = dict(self.fields_get(allfields=['lang'])['lang']['selection'])[self.lang] + rec = self.env['languages.list'].search([('name', '=', lang)], limit=1) + if rec: + code = rec.code + if self.source and code: + try: + val = translator.translate(self.source, dest=code) + time.sleep(1) + self.value = val.text + except: + raise UserError(_("No Translation Found. Please Check Your Internet Connection.")) + else: + raise UserError(_("There is nothing to translate !")) + else: + raise UserError(_("Select a language!")) diff --git a/translation_helper/security/ir.model.access.csv b/translation_helper/security/ir.model.access.csv new file mode 100644 index 000000000..da2bd1e83 --- /dev/null +++ b/translation_helper/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +administration_settings,access_administration,translation_helper.model_languages_list,base.group_system,1,1,1,1 diff --git a/translation_helper/static/description/banner.jpg b/translation_helper/static/description/banner.jpg new file mode 100644 index 000000000..3afbfc3d4 Binary files /dev/null and b/translation_helper/static/description/banner.jpg differ diff --git a/translation_helper/static/description/cybro_logo.png b/translation_helper/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/translation_helper/static/description/cybro_logo.png differ diff --git a/translation_helper/static/description/icon.png b/translation_helper/static/description/icon.png new file mode 100644 index 000000000..aad84713f Binary files /dev/null and b/translation_helper/static/description/icon.png differ diff --git a/translation_helper/static/description/index.html b/translation_helper/static/description/index.html new file mode 100644 index 000000000..0eb2938d4 --- /dev/null +++ b/translation_helper/static/description/index.html @@ -0,0 +1,108 @@ +
+
+

Translation Helper

+

..Single Click To Translate New Words..

+

Cybrosys Technologies

+
+
+

Features:

+
+ Translate words to other languages using 'googletrans'.
+
+
+
+ +
+
+
+

Overview

+

+ Creating translations for new words has became simple with this module. It can be done in a single + button click. +

+
+
+
+ +
+
+
+

Note:

+

For the perfect working, we have to install an external dependency, 'googlerans' + using 'pip install googletrans'.

+
+
+
+ +
+
+
+

With the help of this module, finding translation for new words has become more easier in odoo. + Instead of finding the translation manually, we can automate that process. We just need to provide the + source which we need to translate and the language to which we need to translate the source. A new button, + 'Translate' is added for this purpose.

+
+
+
+ +
+
+

Translate button

+
+
+ +
+
+


+
+
+

+ For creating a new translation, first enable the debug mode and go to + Settings - > Translation - > Application Terms -> Translated Terms. We can create new + translations from here. After entering the source value, language and the other required details, + click on the 'Translate' button. After clicking the button, it will automatically find the translation + for the source and fill the value in the translated value column. +

+

+ We can translate to 36 different languages with the help of this module. +

+
+
+
+
+ +
+
+

Note:

+
+

Please make sure that there is proper internet connection. Without proper internet connection, not all the + facilities of this module will work. +

+
+
+ +
+

Need Any Help?

+ +
\ No newline at end of file diff --git a/translation_helper/static/description/translate_button.png b/translation_helper/static/description/translate_button.png new file mode 100644 index 000000000..b9a048f75 Binary files /dev/null and b/translation_helper/static/description/translate_button.png differ diff --git a/translation_helper/views/translation.xml b/translation_helper/views/translation.xml new file mode 100644 index 000000000..fcb0a39db --- /dev/null +++ b/translation_helper/views/translation.xml @@ -0,0 +1,25 @@ + + + + + translator.helper.tree + ir.translation + + + +