-
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
False Positive: "Duplicate PO message definition" for Contextually Different Translations #122
Comments
I think the described behavior is expected, because Odoo doesn't support providing different translations for the same term. In fact, if the translation file is re-exported, those will be lost and a single one will be included. |
Could you export the PO file in order to double-confirm that Luis said, please? |
@moylop260 @luisg123v |
Could you share the po file and the odoo version, please? |
odoo version 18 |
I have created a video with the following steps:
...
-- ORIGINAL
#. modules: account, sale_management
#: model:ir.model.fields,field_description:account.field_account_account_tag__active
#: model:ir.model.fields,field_description:sale_management.field_sale_order_template__active
#: model:ir.model.fields.selection,name:account.selection__account_lock_exception__state__active
#: model_terms:ir.ui.view,arch_db:account.view_account_tax_search
msgid "Active"
msgstr "Activo"
... -- EDITED
#. modules: account
#: model:ir.model.fields,field_description:account.field_account_account_tag__active
#: model:ir.model.fields.selection,name:account.selection__account_lock_exception__state__active
#: model_terms:ir.ui.view,arch_db:account.view_account_tax_search
msgid "Active"
msgstr "Activo1"
#. modules: sale_management
#: model:ir.model.fields,field_description:sale_management.field_sale_order_template__active
msgid "Active"
msgstr "Activo2" The diff --- original
+++ edited
@@ -1,11 +1,11 @@
-...
-
-#. modules: account, sale_management
+#. modules: account
#: model:ir.model.fields,field_description:account.field_account_account_tag__active
-#: model:ir.model.fields,field_description:sale_management.field_sale_order_template__active
#: model:ir.model.fields.selection,name:account.selection__account_lock_exception__state__active
#: model_terms:ir.ui.view,arch_db:account.view_account_tax_search
msgid "Active"
-msgstr "Activo"
+msgstr "Activo1"
-...
+#. modules: sale_management
+#: model:ir.model.fields,field_description:sale_management.field_sale_order_template__active
+msgid "Active"
+msgstr "Activo2"
The new PO file looks like the original one ...
#. modules: account, sale_management
#: model:ir.model.fields,field_description:account.field_account_account_tag__active
#: model:ir.model.fields,field_description:sale_management.field_sale_order_template__active
#: model:ir.model.fields.selection,name:account.selection__account_lock_exception__state__active
#: model_terms:ir.ui.view,arch_db:account.view_account_tax_search
msgid "Active"
msgstr "Activo1"
... See the video: Notice this is the purpose of the check, so it is a valid case. Also, notice you are using a po file for 2 modules, so maybe it should be used in |
I think this is the source of the issue. Your file Maybe we can disable the check for |
Odoo exports translations grouped by "msgid" and delete duplicated if you will not use odoo exports feature so you will need to manage manually the po file It could be in i18n_extra in order to ignore the Odoo's normal flow More info about OCA#122
Odoo exports translations grouped by "msgid" and delete duplicated if you will not use odoo exports feature so you will need to manage manually the po file It could be in i18n_extra in order to ignore the Odoo's normal flow More info about OCA#122
Odoo exports translations grouped by "msgid" and delete duplicated if you will not use odoo exports feature so you will need to manage manually the po file It could be in i18n_extra in order to ignore the Odoo's normal flow More info about OCA#122
Please, review: I have added a better message but I think it could be even better Could you check it, please? |
Thank you so much @moylop260 @luisg123v Turns out adding the translations to the i18n_extra was exactly what I needed. |
Odoo exports translations grouped by "msgid" and deletes duplicated if you will not use the Odoo export feature so you will need to manage manually the PO file These kind of files should be in `i18n_extra` folder in order to ignore `po-duplicate-message-definition` check More info about #122
Thank you for reporting the issue IMHO it is a valid case I only needed to understand it very well in order to know what was the best fix for that It will be released in v0.1.1 |
Module
hook id: oca-checks-po
Describe the bug
The Odoo pre-commit hook for .po[t] files incorrectly flags valid translations as duplicates when they have different msgstr values.
To Reproduce
Create a .po file with multiple translations for the same msgid, each with different msgstr values.
e.g :
Translation 1
msgid "Submitted"
msgstr "Soumis"
Translation 2
msgid "Submitted"
msgstr "Soumise"
Expected behavior
The pre-commit hook should not flag different msgstr values for the same msgid as duplicates when they represent valid translations in different contexts.
The text was updated successfully, but these errors were encountered: