<feed xmlns='http://www.w3.org/2005/Atom'>
<title>Odoo/odoo/tools/translate.py, branch 14.0</title>
<subtitle>The current checkout of upstream Odoo</subtitle>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/'/>
<entry>
<title>[FIX] translate.py: CSV export correct module name</title>
<updated>2021-03-24T09:39:23+00:00</updated>
<author>
<name>Nicolas Lempereur</name>
<email>nle@odoo.com</email>
</author>
<published>2021-03-24T08:12:50+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=62e7b161d39e5f5f6751cf87826fa6f7b729f83d'/>
<id>62e7b161d39e5f5f6751cf87826fa6f7b729f83d</id>
<content type='text'>
Correct small typo that the module when exporting translations as CSV
file might have been the wrong module because we used variable from
previous loop.

This did not seem to cause any issue since in this given case in import
we got the module from the part before . in XML ID ({module}.{name})
that was right.

found when working on opw-2439029

closes odoo/odoo#68284

Signed-off-by: Nicolas Lempereur (nle) &lt;nle@odoo.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Correct small typo that the module when exporting translations as CSV
file might have been the wrong module because we used variable from
previous loop.

This did not seem to cause any issue since in this given case in import
we got the module from the part before . in XML ID ({module}.{name})
that was right.

found when working on opw-2439029

closes odoo/odoo#68284

Signed-off-by: Nicolas Lempereur (nle) &lt;nle@odoo.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] translate.py: import model from CSV correctly</title>
<updated>2021-03-23T17:27:22+00:00</updated>
<author>
<name>Nicolas Lempereur</name>
<email>nle@odoo.com</email>
</author>
<published>2021-03-23T15:21:44+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=19742eb91eadeecfbddd64d41848cfb4a525a7da'/>
<id>19742eb91eadeecfbddd64d41848cfb4a525a7da</id>
<content type='text'>
When importing transtlation from CSV, we:

- cut at `:` character to get the model
- used a model for types other than model and model_terms

This caused error that do not happen in PO import because:

- the model is before the `,` character
- the imd_model column is constrained to 64 characters, and a name that
  is not a model could be over that size.

With this changeset, the CSV import match better current PO import.

opw-2439029

closes odoo/odoo#68260

X-original-commit: cff91c6acbb7ef6a884d4dc4170574b83ff6e4cb
Signed-off-by: Martin Trigaux (mat) &lt;mat@odoo.com&gt;
Signed-off-by: Nicolas Lempereur (nle) &lt;nle@odoo.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When importing transtlation from CSV, we:

- cut at `:` character to get the model
- used a model for types other than model and model_terms

This caused error that do not happen in PO import because:

- the model is before the `,` character
- the imd_model column is constrained to 64 characters, and a name that
  is not a model could be over that size.

With this changeset, the CSV import match better current PO import.

opw-2439029

closes odoo/odoo#68260

X-original-commit: cff91c6acbb7ef6a884d4dc4170574b83ff6e4cb
Signed-off-by: Martin Trigaux (mat) &lt;mat@odoo.com&gt;
Signed-off-by: Nicolas Lempereur (nle) &lt;nle@odoo.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] tools: properly format error message</title>
<updated>2021-03-09T09:07:51+00:00</updated>
<author>
<name>Martin Trigaux</name>
<email>mat@odoo.com</email>
</author>
<published>2021-03-09T09:03:12+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=a2a45539ca4056eb3b3d5d6bafbfb63c10255843'/>
<id>a2a45539ca4056eb3b3d5d6bafbfb63c10255843</id>
<content type='text'>
To reproduce:
1. take a translatable record with an external id
2. delete the record but keep the ir.model.data (sql)
3. export the translations of the module linked to the orphan
   ir.model.data
-&gt; Error while formating the message

This commit fixes three issues:
- %d instead of %s to construct the string
- wrong order to identify the missing records
- display the external ids instead of the ids (which may not be very
  helpful to debug)

Courtesy of Yannick Brant

closes odoo/odoo#67509

Signed-off-by: Martin Trigaux (mat) &lt;mat@odoo.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
To reproduce:
1. take a translatable record with an external id
2. delete the record but keep the ir.model.data (sql)
3. export the translations of the module linked to the orphan
   ir.model.data
-&gt; Error while formating the message

This commit fixes three issues:
- %d instead of %s to construct the string
- wrong order to identify the missing records
- display the external ids instead of the ids (which may not be very
  helpful to debug)

Courtesy of Yannick Brant

closes odoo/odoo#67509

Signed-off-by: Martin Trigaux (mat) &lt;mat@odoo.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] core: parsing of external ids in PO files</title>
<updated>2020-12-08T09:55:55+00:00</updated>
<author>
<name>Raphael Collet</name>
<email>rco@odoo.com</email>
</author>
<published>2020-12-08T09:02:58+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=52bf0e331fb9230423b76b9014bb13d490930e76'/>
<id>52bf0e331fb9230423b76b9014bb13d490930e76</id>
<content type='text'>
The parsing of external ids was made with the regexp `(\w+)\.([\w-]+)`.
This regexp is inadequate for external ids that contain non-alphanumeric
characters like.  We have such a use-case with the selections of field
`rating_operator` in module `sale_subscription` that uses the values
`"&gt;"` and `"&lt;"`.

The fix consists in replacing the regexp by `(\w+)\.([^ ]+)`.

closes odoo/odoo#62976

Related: odoo/enterprise#15182
Signed-off-by: Raphael Collet (rco) &lt;rco@openerp.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The parsing of external ids was made with the regexp `(\w+)\.([\w-]+)`.
This regexp is inadequate for external ids that contain non-alphanumeric
characters like.  We have such a use-case with the selections of field
`rating_operator` in module `sale_subscription` that uses the values
`"&gt;"` and `"&lt;"`.

The fix consists in replacing the regexp by `(\w+)\.([^ ]+)`.

closes odoo/odoo#62976

Related: odoo/enterprise#15182
Signed-off-by: Raphael Collet (rco) &lt;rco@openerp.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] tools: extract translations in static/src/ directory</title>
<updated>2020-11-17T12:42:17+00:00</updated>
<author>
<name>Martin Trigaux</name>
<email>mat@odoo.com</email>
</author>
<published>2020-11-17T05:55:13+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=f1d403723d59b8e53b00cf2d26bd9d3d54437803'/>
<id>f1d403723d59b8e53b00cf2d26bd9d3d54437803</id>
<content type='text'>
Since 14.0, the javascript code of snippets is moved inside a
/static/src/snippets directory.
With owl, the components are defined in static/src/components
Some other modules were using more exotic path and ended up with no
translations.

opw-2381030</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since 14.0, the javascript code of snippets is moved inside a
/static/src/snippets directory.
With owl, the components are defined in static/src/components
Some other modules were using more exotic path and ended up with no
translations.

opw-2381030</pre>
</div>
</content>
</entry>
<entry>
<title>[IMP] translate: add add/radd methods on _lt class</title>
<updated>2020-10-27T14:55:13+00:00</updated>
<author>
<name>Paul Morelle</name>
<email>pmo@odoo.com</email>
</author>
<published>2020-10-27T10:01:52+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=c77fbcf429f1f6d07c68ebe674b8c0035015328b'/>
<id>c77fbcf429f1f6d07c68ebe674b8c0035015328b</id>
<content type='text'>
In order to ease the usage of lazy translation, add the possibility to
add the _lt objects together and with strings.

Adding two _lt objects together or to a string will execute their
translation, so these operations still must be done once the user's
language has been defined.

For example, this is now possible:

    MESSAGES = {
        1: _lt("Hello, world!"),
        2: _lt("Lorem ipsum"),
    }

    def get_text(code):
        return _("Text is: ") + MESSAGES[code]

closes odoo/odoo#60842

X-original-commit: c4596664e5514018c565eaf14b93e000d972bd30
Signed-off-by: Martin Trigaux (mat) &lt;mat@odoo.com&gt;
Signed-off-by: Paul Morelle &lt;madprog@users.noreply.github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In order to ease the usage of lazy translation, add the possibility to
add the _lt objects together and with strings.

Adding two _lt objects together or to a string will execute their
translation, so these operations still must be done once the user's
language has been defined.

For example, this is now possible:

    MESSAGES = {
        1: _lt("Hello, world!"),
        2: _lt("Lorem ipsum"),
    }

    def get_text(code):
        return _("Text is: ") + MESSAGES[code]

closes odoo/odoo#60842

X-original-commit: c4596664e5514018c565eaf14b93e000d972bd30
Signed-off-by: Martin Trigaux (mat) &lt;mat@odoo.com&gt;
Signed-off-by: Paul Morelle &lt;madprog@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] tools: skip inexistant model</title>
<updated>2020-08-06T14:16:08+00:00</updated>
<author>
<name>Martin Trigaux</name>
<email>mat@odoo.com</email>
</author>
<published>2020-08-06T12:17:55+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=7742f0b42b860abad395cf1d89e0988581e32ef4'/>
<id>7742f0b42b860abad395cf1d89e0988581e32ef4</id>
<content type='text'>
When trying to generate translation for a model that is not present in
the registry (leftover of migration?), the code used to return
self.browse(), expecting an empty recordset.

self was however a TranslationModuleReader that has no browse method
return empty recordset with no model specified

closes odoo/odoo#55574

X-original-commit: c004f00bdec83b7c56664425011db53db85da53a
Signed-off-by: Martin Trigaux (mat) &lt;mat@odoo.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When trying to generate translation for a model that is not present in
the registry (leftover of migration?), the code used to return
self.browse(), expecting an empty recordset.

self was however a TranslationModuleReader that has no browse method
return empty recordset with no model specified

closes odoo/odoo#55574

X-original-commit: c004f00bdec83b7c56664425011db53db85da53a
Signed-off-by: Martin Trigaux (mat) &lt;mat@odoo.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[IMP] tools: use same syntax for _lt than _</title>
<updated>2020-06-30T10:19:50+00:00</updated>
<author>
<name>Martin Trigaux</name>
<email>mat@odoo.com</email>
</author>
<published>2020-06-29T15:04:11+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=110263df56933abe885d1c4058afa5a0669e5aa9'/>
<id>110263df56933abe885d1c4058afa5a0669e5aa9</id>
<content type='text'>
A new gettext syntax was added at odoo/odoo#52155 but only for _, not
for _lt
Allow to have the same syntax</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A new gettext syntax was added at odoo/odoo#52155 but only for _, not
for _lt
Allow to have the same syntax</pre>
</div>
</content>
</entry>
<entry>
<title>[IMP] tools: fallback on empty translation</title>
<updated>2020-06-30T08:53:29+00:00</updated>
<author>
<name>Martin Trigaux</name>
<email>mat@odoo.com</email>
</author>
<published>2020-06-23T11:41:04+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=d12813f7eec9d71be7573bf1dcaba9f8cf67eb79'/>
<id>d12813f7eec9d71be7573bf1dcaba9f8cf67eb79</id>
<content type='text'>
Avoid returning False if, for any reason, the return is falsy (False,
None,...)

Following the discussion in odoo/odoo#53254, the root cause was a call in the form
  _(foo)

where foo was equal False

While nothing else than a string should be the argument of _, it's
still technically possible to pass something else and get a bad return
value.
Fallback on empty string to be consistent.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Avoid returning False if, for any reason, the return is falsy (False,
None,...)

Following the discussion in odoo/odoo#53254, the root cause was a call in the form
  _(foo)

where foo was equal False

While nothing else than a string should be the argument of _, it's
still technically possible to pass something else and get a bad return
value.
Fallback on empty string to be consistent.</pre>
</div>
</content>
</entry>
<entry>
<title>[IMP] *: replace to new _() syntax</title>
<updated>2020-06-18T11:03:34+00:00</updated>
<author>
<name>Martin Trigaux</name>
<email>mat@odoo.com</email>
</author>
<published>2020-06-04T10:39:11+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=ba244cef01132347df4d2d9553ea3105ba13a938'/>
<id>ba244cef01132347df4d2d9553ea3105ba13a938</id>
<content type='text'>
Using a few regex like
\((_\(.*%s.*)(\) % )([\w\[\]][\w .\[\]\(\)'"]*)\)
($1, $3))

Old syntax is still compatible but starts the migration to the new
syntax that catches error.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Using a few regex like
\((_\(.*%s.*)(\) % )([\w\[\]][\w .\[\]\(\)'"]*)\)
($1, $3))

Old syntax is still compatible but starts the migration to the new
syntax that catches error.
</pre>
</div>
</content>
</entry>
</feed>
