-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MERGE] Forward-port saas-3 up to 9b55532
- Loading branch information
Showing
12 changed files
with
272 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# -*- coding: utf-8 -*- | ||
import models |
15 changes: 15 additions & 0 deletions
15
openerp/tests/addons/test_translation_import/__openerp__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# -*- coding: utf-8 -*- | ||
{ | ||
'name': 'test-translation-import', | ||
'version': '0.1', | ||
'category': 'Tests', | ||
'description': """A module to test translation import.""", | ||
'author': 'OpenERP SA', | ||
'maintainer': 'OpenERP SA', | ||
'website': 'http://www.openerp.com', | ||
'depends': ['base'], | ||
'data': ['view.xml'], | ||
'test': ['tests.yml'], | ||
'installable': True, | ||
'auto_install': False, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# 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:17 | ||
# This line is present in the POT and removed here to test the translation | ||
# import behavior. | ||
#. module: test_translation_import | ||
#: field:test.translation.import,name:0 | ||
#, 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" | ||
|
58 changes: 58 additions & 0 deletions
58
openerp/tests/addons/test_translation_import/i18n/test_translation_import.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# 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:17 | ||
#: field:test.translation.import,name:0 | ||
#, 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 "" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- coding: utf-8 -*- | ||
import openerp | ||
from openerp.tools.translate import _ | ||
|
||
class m(openerp.osv.orm.TransientModel): | ||
""" A model to provide source strings. | ||
""" | ||
_name = 'test.translation.import' | ||
|
||
_columns = { | ||
'name': openerp.osv.fields.char( | ||
'1XBUO5PUYH2RYZSA1FTLRYS8SPCNU1UYXMEYMM25ASV7JC2KTJZQESZYRV9L8CGB', | ||
size=32, help='Efgh'), | ||
} | ||
|
||
_('Ijkl') | ||
|
||
# With the name label above, this source string should be generated twice. | ||
_('1XBUO5PUYH2RYZSA1FTLRYS8SPCNU1UYXMEYMM25ASV7JC2KTJZQESZYRV9L8CGB') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
- | ||
Load the french translation. | ||
- | ||
!python {model: ir.translation }: | | ||
import openerp | ||
openerp.tools.trans_load(cr, 'test_translation_import/i18n/fr.po', 'fr_FR', verbose=False) | ||
- | ||
Assert we have loaded the correct number of entries for the given source string. | ||
- | ||
!python {model: ir.translation }: | | ||
ids = self.search(cr, uid, | ||
[('src', '=', '1XBUO5PUYH2RYZSA1FTLRYS8SPCNU1UYXMEYMM25ASV7JC2KTJZQESZYRV9L8CGB')]) | ||
assert len(ids) == 2, "2 entries are expected, got %s instead." % len(ids) |
9 changes: 9 additions & 0 deletions
9
openerp/tests/addons/test_translation_import/tests/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# -*- coding: utf-8 -*- | ||
import unittest2 | ||
|
||
import test_term_count | ||
|
||
suite = [ | ||
test_term_count | ||
] | ||
|
16 changes: 16 additions & 0 deletions
16
openerp/tests/addons/test_translation_import/tests/test_term_count.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import openerp | ||
from openerp.tests import common | ||
|
||
class TestTermCount(common.TransactionCase): | ||
|
||
def test_count_term(self): | ||
""" | ||
Just make sure we have as many translation entries as we wanted. | ||
""" | ||
openerp.tools.trans_load(self.cr, 'test_translation_import/i18n/fr.po', 'fr_FR', verbose=False) | ||
ids = self.registry('ir.translation').search(self.cr, self.uid, | ||
[('src', '=', '1XBUO5PUYH2RYZSA1FTLRYS8SPCNU1UYXMEYMM25ASV7JC2KTJZQESZYRV9L8CGB')]) | ||
self.assertEqual(len(ids), 2) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<openerp> | ||
<data> | ||
|
||
<record id="action_test_translation_import" model="ir.actions.act_window"> | ||
<field name="name">Test translation import</field> | ||
<field name="type">ir.actions.act_window</field> | ||
<field name="res_model">test.translation.import</field> | ||
<field name="view_type">form</field> | ||
<field name="view_mode">tree,form</field> | ||
<field name="target">current</field> | ||
</record> | ||
|
||
<menuitem icon="STOCK_PREFERENCES" id="base.menu_tests" name="Tests"/> | ||
|
||
<menuitem id="menu_test_translation" parent="base.menu_tests" name="Test translation"/> | ||
|
||
<menuitem id="menu_test_translation_import" | ||
name="Test translation import" | ||
action="action_test_translation_import" | ||
parent="menu_test_translation"/> | ||
</data> | ||
</openerp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters