When a single po file is processed (i.e. direct po import, not read from a i18n
directory inside a module), there was no module information on code translations
The module information is important for web translations where the list of
modules is given in the call to the route '/website/translations' and
'/web/webclient/translations' and only the web translations of these specific
modules is retrieved and used.
To manually import the translations of a custom module (e.g. openerp_enterprise),
the base.language.import wizard is typically used and the give .po file is
directly imported.
For model and model_terms, the module information is easily deducted from the
the record external id (<module>.<reference>) but for code translation, we
relied on the global variable module_name.
The .po file do contain the module information but this information was ignored.
Real example:
#. module: openerp_enterprise
#. openerp-web
#: code:addons/openerp_enterprise/static/src/js/odoo_enterprise_start_trial.js:249
#, python-format
msgid "Please choose your domain name"
msgstr "Veuillez choisir votre nom de domaine"
Before this commit, the above translation was imported without the module and
was not retrieved in the '/website/translations' call on the /trial page
The global module_name is still used when set for backward compatibility.
Co-authored-by: Raphael Collet <rco@odoo.com>
Complete cd4080839f
<span class="fa fa-globe" title="Title stuff"/>
is not correctly extracted but
<span class="fa fa-globe" title=""/>
was also extracted while there is no content
Check the size of the content too
Similar content is present on odoo.com website and should not be translatable
on Transifex
closesodoo/odoo#32018
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
With 12.0's (#28297) empty translations were no longer added by default
with the idea that if needed the "Generate Missing Terms" wizard should
be used.
But that wizard itself used what was modified so also did not added
empty translation.
With this changeset, empty translations are added when using the
"Generate Missing Terms" wizard.
fixes#29184closes#30037
Instead of checking the size of text only node, let the xml_translate verify it.
The size verification using etree was introduced at 40efdccc3d but was
probably too simple.
Since 45352512a8, this becomes redundant with the nonspace method which can
be extended.
The re.sub is still relevant as some terms may contain only non-alphanumeric and
use push_translation (e.g. '>=' as a selection or xml terms extracted by babel
in static repository)
closesodoo/odoo#29432
This commit replaces calls to pycompat helpers that were intended for
python 2 <-> python 3 interoperability for python 3 builtins, as python
2 is no longer officially supported by Odoo.
This includes:
* calls to imap/izip/ifilter replaced by map/zip/filter
* uses of text_type replaced by str
* uses of unichr replaced by chr
* calls to implements_to_string, implements_iterator removed
* string_types and integer_types replaced by str, int respectively
* calls to to_native replaced by calls to to_text
This is done in preparation to the removal of these deprecated helpers
in the following commit.
When there is a language and its base language translation files in a
module, in 12.0 an empty translation in the language translation file
will not fallback on the base language.
eg.
fr.po : {'one': 'un', 'seventy': 'soixante-dix'}
fr_BE.po: {'one': '', 'seventy': 'septante'}
=> the translation in fr_BE will be {'one': '', 'seventy': 'septante'}
but before 7288b477 it would have been {'one': 'un', 'seventy': 'septante'}
With this commit, an empty translation is no longer created so does not
override base language.
Also the intention of d84b795b0a that was also lost is restored by
upserting only noupdate==false translation, and inserting the other
ones.
opw-1904638
closes#28297
Backport of fccfd36e05, 4ba7fbbf81 and 1421949c67 to saas-11.3
[FIX] tools: use pot as reference file
In the first attempt at #26134, the pot_targets was cleared after creating
the pot_rows object.
Since the rows not present in the pot_targets are now skipped, clearing the pot
should not be done.
Still use a temporary list pot_rows to avoid modifying the list we are iterating
on.
Update the .po test file to match the new file format
[FIX] tools: import translation file without pot
Due to fccfd36 and 4ba7fbb the translations were only imported, considering the
.pot as the reference.
During import or a manual csv or po file, there is no pot file.
Add tests with Klingon and Dothraki
Due to fccfd36 and 4ba7fbb the translations were only imported, considering the
.pot as the reference.
During import or a manual csv or po file, there is no pot file.
Add tests with Klingon and Dothraki
Fixes#27044
The ir_translations were pretty slow to load, this was mainly caused by
the condition in variable 'find_expr' and the import of po values in the
temporary table.
To improve the load performance, we made two improvement:
1. Insert the row in the temporary table by batch instead of making an
insertion for each record.
2. Replacing the condition in the variable 'find_expr' by partial unique
index. To perform such a thing, we had to separate the type model in
two types, 'model' and 'model_terms' because it wasn't possible to
create a partial unique index on type 'model' because the type was
used for two different use cases. The type model is now used for
fields that have have a value not callable for the attribute
translate, these field can only have one record for the same field,
model, res_id and language. And the type 'model_terms' is used for
the fields callable, because they can have multiple sources for the
same res_id.
We also removed the deprecated types 'report', 'help', 'view', 'field'.
Thanks to @rco-odoo for the improvement of the first point.
In the first attempt at #26134, the pot_targets was cleared after creating
the pot_rows object.
Since the rows not present in the pot_targets are now skipped, clearing the pot
should not be done.
Still use a temporary list pot_rows to avoid modifying the list we are iterating
on.
Update the .po test file to match the new file format
Closes#26881
cherry-pick of 428fbd0381 that was reverted at 737ba55e1e as it was making
tests fail
The following commit will correct the tests
This commit only reverts the revert
This commit fixes two bugs:
- a8469c45 was fixing the case where the first line was not 'code' but broke
the usecase where a po started with code line
- Correct the usecase where a pot and po file do not have the same line of code
by matching on res_id=0
This avoids to have a pot expecting a code message at line 42 and a translation
at line 43
Closes#26722
The previous code, as explained at b505ba9e0a, was to avoid creating duplicated
code entries for the same source (as only one is considered).
In case of a po comment like
#. openerp-web
#: model:ir.ui.view,arch_db:base.ir_access_view_search
#: code:addons/web/static/src/js/chrome/search_inputs.js:716
#: code:addons/web/static/src/xml/base.xml:1125
#, python-format
the condition was not triggered (trans_type is model), creating two code entries
Necessary in #26614 to fix#26553
Today, Odoo is really tricky to use without seeing the screen, it must be improved to be usable.
This PR forbid to use labels without a "for" attribute, add some title, rule and aria attributes in HTML. With that, Odoo will be fully usable with a screen reader.
* [IMP] Labels must have a for attribute. Improve accessibility.
* [IMP] Better error message when trying to read a missing cached value
* [FIX] Add some aria-label and title attributes for screen readers.
* [FIX] Template name is not included in the error message in case of SyntaxError in QWeb
* [FIX] Improve the Tour failed at step error message to be more explicit.
* [IMP] Add aria-labels
* [FIX] Add missing aria-label on failing test
* [IMP] aria-hidden means hidden. Fix all bad aria-hidden and hide aria-hidden for all.
* [IMP] Color names on kanban views and many2many tags
* [IMP] Add some checks on views for accessibility.
* [IMP] Add `alt` attribute on `img` tags.
* [IMP] Add aria-label and title on non-described icons
* [IMP] Add button role to widgets with btn class
* [IMP] Translate aria and formatted attributes.
* [IMP] Remove wrong aria-labelledby
* [IMP] Add menu role on dropdowns
* [IMP] Buttons must be focusable
* [IMP] Add aria attributes on progress bars
* [IMP] Improve accessibility of basic widgets
* [IMP] Change main layout to more semantic tags
* [IMP] Add menuitem role when missing
* [IMP] Remove wrong role='presentation'
* [IMP] Improve accessibility of tab panels
* [IMP] Add aria-invalid on invalid fields
* [IMP] Add aria-sort on ordered columns
* [IMP] Add role on alerts
* [IMP] Use dialog role, header, main and footer tags for modals
* [IMP] Add labels on o_status
* [IMP] Improve accessibility of kanban view with feeds and articles
* [IMP] Add alerts in case of new messages
* [IMP] Add widget, navigation or img role to aria-labelled items
* don't use FS to do export
* update translations export dialog to fix outdated links (launchpad
& 6.1 translations doc)
Note: can't use ``TarFile.gettarinfo`` to create the TarInfo object
because it wants an actual file object with a ``name`` attribute and
possibly even an fd.
closes#22798
msgid ""
"You cannot set a negative product quantity in an inventory line:\n"
"\t%s - qty: %s"
Was creating a ir.translation record with a src as
You cannot set a negative product quantity in an inventory line:
t%s - qty: %s
('t' instead of \t)
Closes#23541Fixes#23521
When exporting to a tarfile, we first export each module's translations
to a file on the FS, then create a tarball from all of them.
With the P3 bytes/string split, translation export was defined to export
to a bytes IO object in order to work correctly with CSV (which work on
bytes IO for better cross-version compatibility). However the tgz file
export was left opening module's files in `w` mode, which in P3 means
text, which blows up as POFile expects to ultimately write to a bytes IO
object: it uses text, and a StreamReaderWriter is used to translate that
into an underlying bytes IO.
Fix by explicitly opening the files in binary mode.
Fixes#22700
Instead of use the original string by default.
Currently odoo export a PO translation file using the logic:
"If there is not a translation then use the source."
This generate a false 100% of file translated for tools based on PO
files.
This commit change this logic to:
"If there is not a translation then use empty string."
Odoo import a PO translation file supporting empty string because
if a item is empty string odoo use the original source.
Closes#17925
With Odoo v11 running on Python3:
1. Go to Settings -> Translation -> Import Translation
2. Choose a valid .po file (e.g. generated with the menu Export Translation)
3. Click Import
There is a server error.
There are two bugs behind this error:
1. we open a temporary file that cannot insert bytes ('w+')
2. the name of the temporary file is an integer (its file descriptor)
Python2 processed some implicit conversion between str and bytes, so that the 1st error doesn't occur. The name of a temporary file in Python2 is '<fopen>'.
We made the following corrections to the code:
1. open the temporary file with w+b access (write bytes)
2. enhanced a conditional statement so that we skip instructions in case where the field name of the tempfile is a string
Related Ticket:
opw-775445
Now that we're closer to switching to P3 for good, these helpers have
outlived their usefulness, and mostly add noise.
All remaining dict.iter*() or dict.view*() must be converted to the
normal keys(), values() or items() calls.
Whenever the result is likely to be used for more than the scope of a
loop, or when the dict needs to be modified during iteration, the calls
must be wrapped in a ``list()``, to protect the new P3 semantics.
Those cases are very exceptional.
Also removed some dead code or improved the API to remove unnecessary
conversions.