UI Translations: fix add-on translation export
commitddc9ecd46f21560ccb25b8f7b815524687e27eec
authorDamien Picard <dam.pic@free.fr>
Tue, 10 Oct 2023 11:56:14 +0000 (10 13:56 +0200)
committerGitea <gitea@fake.local>
Wed, 11 Oct 2023 12:26:12 +0000 (11 14:26 +0200)
treeb4bb92115e5711bb9f4513be13f5e81076a45d75
parente153c299b49e7a41d4b21da93e05b1ba37649e22
UI Translations: fix add-on translation export

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`.

Pull Request: https://projects.blender.org/blender/blender-addons/pulls/104942
ui_translate/update_addon.py