bl_i18n_utils - bugs saving translations to py files and finding po strings if context is not present in the file #116934

Merged
Bastien Montagne merged 6 commits from Andrej730/blender:bl_i18n_utils_bugs into main 2024-02-06 16:58:58 +01:00

6 Commits

Author SHA1 Message Date
Andrej dc72c671a2 revert 0ceed7caf6 and change saved source paths to posix instead 2024-01-14 14:00:00 +05:00
Andrej 4382d70808 Fix for ffd2048daa - ensure default context is always present instead of using fallback values 2024-01-10 22:55:40 +05:00
Andrej ffd2048daa find_best_messages_matches not to fail if context is not present in .po
It was failing when current message context wasn't found in the .po file. E.g. there were not messages with context "View3D", "Operator", ... and you would try to edit translation for the element that uses that context.

Traceback
```
Error: Python: Traceback (most recent call last):
File "\Blender\4.0\scripts\addons\ui_translate\edit_translation.py", line 287, in invoke
msgs.find_best_messages_matches(self, self.msgmap, self.rna_ctxt, self.rna_struct, self.rna_prop, self.rna_enum)
File "\Blender\4.0\scripts\modules\bl_i18n_utils\utils.py", line 798, in find_best_messages_matches
k = ctxt_to_msg[rna_ctxt].copy()
KeyError: 'Operator'
2024-01-09 16:07:17 +05:00
Andrej 0ceed7caf6 `repr` saved sources and comments to avoid unexpected special characters 2024-01-09 16:06:24 +05:00
Andrej 7b071ed81d Note about what data is printed to the console 2024-01-09 16:05:49 +05:00
Andrej d43eb3c1ee minor typing addition 2024-01-09 16:05:38 +05:00