mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 18:16:40 +00:00
update translations in current blender session
This commit is contained in:
@@ -2,6 +2,7 @@ import bpy
|
||||
import addon_utils
|
||||
import shutil
|
||||
import tempfile
|
||||
import importlib
|
||||
from pathlib import Path
|
||||
|
||||
context = bpy.context
|
||||
@@ -70,6 +71,13 @@ def update_translations_from_po():
|
||||
|
||||
temp_po_dir.cleanup()
|
||||
|
||||
# update translations in current Blender session
|
||||
bpy.app.translations.unregister(ADDON_NAME)
|
||||
addon_module = importlib.import_module(ADDON_NAME)
|
||||
translations_module = getattr(addon_module, "translations")
|
||||
importlib.reload(translations_module)
|
||||
bpy.app.translations.register(ADDON_NAME, translations_module.translations_dict)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if not is_addon_loaded("ui_translate"):
|
||||
|
||||
Reference in New Issue
Block a user