UI Translations: fix add-on translation PO export #104942

Merged
Bastien Montagne merged 1 commits from pioverfour/blender-addons:dp_fix_translation_export into blender-v4.0-release 2023-10-11 14:26:15 +02:00
Member

The export of add-on translations to PO files suffered from two
issues:

  1. To find the best file candidate for each language, the exporter
    compares ISO codes. One of the codes it tried to compare with is
    the invalid __POT__ (settings.PARSER_TEMPLATE_ID).

    This would raise an assert in
    bl_i18n_utils.utils.locale_explode() because its implementation
    is different from the original bpy_translations.locale_explode()
    when given invalid values.

    This key is now filtered out to avoid the exception.

  2. With "Update Existing" enabled, it tried to update the nonexistant
    trans.msgs of the translations. The proper dictionary is
    trans.trans.

The export of add-on translations to PO files suffered from two issues: 1. To find the best file candidate for each language, the exporter compares ISO codes. One of the codes it tried to compare with is the invalid `__POT__` (`settings.PARSER_TEMPLATE_ID`). This would raise an assert in `bl_i18n_utils.utils.locale_explode()` because its implementation is different from the original `bpy_translations.locale_explode()` when given invalid values. This key is now filtered out to avoid the exception. 2. With "Update Existing" enabled, it tried to update the nonexistant `trans.msgs` of the translations. The proper dictionary is `trans.trans`.
Damien Picard added the
Interest
Translations
label 2023-10-11 13:16:01 +02:00
Damien Picard added 1 commit 2023-10-11 13:16:04 +02:00
The export of add-on translations to PO files suffered from two
issues:

1. To find the best file candidate for each language, the exporter
   compares ISO codes. One of the codes it tried to compare with is
   the invalid `__POT__` (`settings.PARSER_TEMPLATE_ID`).

   This would raise an assert in
   `bl_i18n_utils.utils.locale_explode()` because its implementation
   is different from the original `bpy_translations.locale_explode()`
   when given invalid values.

   This key is now filtered out to avoid the exception.

2. With "Update Existing" enabled, it tried to update the nonexistant
   `trans.msgs` of the translations. The proper dictionary is
   `trans.trans`.
Damien Picard changed title from UI Translations: fix add-on translation export to UI Translations: fix add-on translation PO export 2023-10-11 13:16:16 +02:00
Damien Picard requested review from Bastien Montagne 2023-10-11 13:42:19 +02:00
Bastien Montagne approved these changes 2023-10-11 14:25:56 +02:00
Bastien Montagne merged commit ddc9ecd46f into blender-v4.0-release 2023-10-11 14:26:15 +02:00
Bastien Montagne deleted branch dp_fix_translation_export 2023-10-11 14:26:16 +02:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#104942
No description provided.