Skip to content

Commit

Permalink
[REF] po-duplicate-message-definition: Ignore i18n_extra folder
Browse files Browse the repository at this point in the history
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
  • Loading branch information
moylop260 committed Jan 30, 2025
1 parent 7ab8608 commit b1e33c8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/oca_pre_commit_hooks/checks_odoo_module_po.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ def check_po(self):
if entry.obsolete:
continue

# po_duplicate_message_definition
if self.is_message_enabled("po-duplicate-message-definition"):
# Ignore i18n_extra https://github.com/OCA/odoo-pre-commit-hooks/issues/122
if self.is_message_enabled("po-duplicate-message-definition") and self.data_section != "i18n_extra":
duplicated[hash(entry.msgid)].append(entry)

if self.is_message_enabled("po-duplicate-model-definition"):
Expand All @@ -351,7 +351,9 @@ def check_po(self):
msg_id_short = f"{msg_id_short}..."
self.register_error(
code="po-duplicate-message-definition",
message=f"Duplicate PO message definition `{msg_id_short}` in lines {duplicated_str}",
message=f"Duplicate PO message definition `{msg_id_short}` in lines {duplicated_str}. "
"Odoo exports these items by msgid and delete one of them. "
"Use the `i18n_extra` folder instead of `i18n` to ignore this message.",
filepath=self.filename_short,
line=self._get_po_line_number(entries[0]),
)
Expand Down

0 comments on commit b1e33c8

Please sign in to comment.