[FIX] test_translation_import: correct test and add required i18n files ignored during forward-port

This commit is contained in:
Christophe Simonis
2018-09-07 12:06:24 +02:00
parent 21a186dadd
commit 1884c71245
3 changed files with 147 additions and 7 deletions
@@ -0,0 +1,69 @@
# This is a test PO file, not a true french translation.
# See the POT file for further information.
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 6.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-10-17 12:36+0000\n"
"PO-Revision-Date: 2012-10-17 12:36+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
# Note: there is normally an additional line:
# #: code:addons/test_translation_import/models.py:15
# This line is present in the POT and removed here to test the translation
# import behavior.
#. module: test_translation_import
#: model:ir.model.fields,field_description:test_translation_import.field_test_translation_import__name
#, python-format
msgid "1XBUO5PUYH2RYZSA1FTLRYS8SPCNU1UYXMEYMM25ASV7JC2KTJZQESZYRV9L8CGB"
msgstr "1XBUO5PUYH2RYZSA1FTLRYS8SPCNU1UYXMEYMM25ASV7JC2KTJZQESZYRV9L8CGB in french"
#. module: test_translation_import
#: code:addons/test_translation_import/models.py:14
#, python-format
msgid "Ijkl"
msgstr "Ijkl in french"
#. module: test_translation_import
#: model:ir.model,name:test_translation_import.model_test_translation_import
msgid "test.translation.import"
msgstr "test.translation.import in french"
#. module: test_translation_import
#: help:test.translation.import,name:0
msgid "Efgh"
msgstr "Efgh in french"
#. module: test_translation_import
#: model:ir.actions.act_window,name:test_translation_import.action_test_translation_import
#: model:ir.ui.menu,name:test_translation_import.menu_test_translation_import
msgid "Test translation import"
msgstr "Test translation import in french"
#. module: test_translation_import
#: model:ir.ui.menu,name:test_translation_import.menu_test_translation
msgid "Test translation"
msgstr "Test translation in french"
#. module: test_translation_import
#: code:addons/base/models/arthur.py:42
#: code:addons/base/models/arthur.py:43
msgid "Test translation with two code lines"
msgstr "Test traduction avec deux lignes de code"
#. module: test_translation_import
#: code:addons/base/models/ford.py:43
msgid "Test translation with a code type but different line number in pot"
msgstr "Test traduction avec un type code mais différent numéro de ligne dans le pot"
#. module: test_translation_import
#: model:ir.model.fields,field_description:test_translation_import.field_test_translation_import__other_name
#: code:addons/base/models/marvin.py:42
#: code:addons/base/models/trillian.py:42
msgid "Test translation with two code type and model"
msgstr "Test traduction avec deux type code et un model"
@@ -0,0 +1,75 @@
# This is a test POT file, not a true template. It is manually maintained
# to test the import translation behavior of OpenERP.
#
# In particular, the
# `1XBUO5PUYH2RYZSA1FTLRYS8SPCNU1UYXMEYMM25ASV7JC2KTJZQESZYRV9L8CGB` source is
# given with two targets (the #: comments): `code` and `field`. The code one is
# removed in the fr.po file. Still, the import should generate a database entry
# for the `code` one. I.e. the targets defined in the POT must be added to the
# targets defined in the PO file. This was done to fix a bug, as reported by
# lp:933496.
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 6.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-10-17 12:36+0000\n"
"PO-Revision-Date: 2012-10-17 12:36+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: test_translation_import
#: code:addons/test_translation_import/models.py:15
#: model:ir.model.fields,field_description:test_translation_import.field_test_translation_import__name
#, python-format
msgid "1XBUO5PUYH2RYZSA1FTLRYS8SPCNU1UYXMEYMM25ASV7JC2KTJZQESZYRV9L8CGB"
msgstr ""
#. module: test_translation_import
#: code:addons/test_translation_import/models.py:14
#, python-format
msgid "Ijkl"
msgstr ""
#. module: test_translation_import
#: model:ir.model,name:test_translation_import.model_test_translation_import
msgid "test.translation.import"
msgstr ""
#. module: test_translation_import
#: help:test.translation.import,name:0
msgid "Efgh"
msgstr ""
#. module: test_translation_import
#: model:ir.actions.act_window,name:test_translation_import.action_test_translation_import
#: model:ir.ui.menu,name:test_translation_import.menu_test_translation_import
msgid "Test translation import"
msgstr ""
#. module: test_translation_import
#: model:ir.ui.menu,name:test_translation_import.menu_test_translation
msgid "Test translation"
msgstr ""
#. module: test_translation_import
#: code:addons/base/models/arthur.py:42
#: code:addons/base/models/arthur.py:43
msgid "Test translation with two code lines"
msgstr ""
#. module: test_translation_import
#: code:addons/base/models/ford.py:42
msgid "Test translation with a code type but different line number in pot"
msgstr ""
#. module: test_translation_import
#: model:ir.model.fields,field_description:test_translation_import.field_test_translation_import__other_name
#: code:addons/base/models/marvin.py:42
#: code:addons/base/models/trillian.py:42
msgid "Test translation with two code type and model"
msgstr ""
@@ -1,15 +1,11 @@
# -*- coding: utf-8 -*-
from contextlib import closing
import io
import odoo
from odoo.tests import common
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
class TestTermCount(common.TransactionCase):
@@ -35,7 +31,7 @@ class TestTermCount(common.TransactionCase):
odoo.tools.trans_load(self.cr, 'test_translation_import/i18n/fr.po', 'fr_FR', module_name='test_translation_import', verbose=False, context={'overwrite': True})
# trans_load invalidates ormcache but not record cache
menu.refresh()
menu.clear_caches()
self.assertEqual(menu.name, "New Name")
self.assertEqual(menu.with_context(lang='fr_FR').name, "Nouveau nom")
@@ -61,7 +57,7 @@ class TestTermCount(common.TransactionCase):
"""When the string and the translation is equal the translation is empty"""
# Export the translations
def update_translations():
with closing(StringIO()) as bufferobj:
with closing(io.BytesIO()) as bufferobj:
odoo.tools.trans_export('fr_FR', ['test_translation_import'], bufferobj, 'po', self.cr)
bufferobj.name = 'test_translation_import/i18n/fr.po'
odoo.tools.trans_load_data(self.cr, bufferobj, 'po', 'fr_FR', verbose=False, context={'overwrite': True})