mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-16 21:42:19 +00:00
expose current blender locale in bbim translations ui
This commit is contained in:
@@ -23,7 +23,9 @@ bl_info = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
context = bpy.context
|
context = bpy.context
|
||||||
SUPPORT_LANGUAGES = ["ru_RU", "de_DE"]
|
# NOTE: list of available languages in Blender can be retrieved
|
||||||
|
# by the command below:
|
||||||
|
# bpy.context.preferences.view.language = "test"
|
||||||
ADDON_NAME = "blenderbim"
|
ADDON_NAME = "blenderbim"
|
||||||
TRANSLATION_UI_IS_LOADED = False
|
TRANSLATION_UI_IS_LOADED = False
|
||||||
|
|
||||||
@@ -335,7 +337,7 @@ class SetupTranslationUI(bpy.types.Operator):
|
|||||||
|
|
||||||
# setup selected languages
|
# setup selected languages
|
||||||
for lang in i18n_settings.langs:
|
for lang in i18n_settings.langs:
|
||||||
lang.use = lang.uid in SUPPORT_LANGUAGES
|
lang.use = lang.uid == context.preferences.view.language
|
||||||
|
|
||||||
global TRANSLATION_UI_IS_LOADED
|
global TRANSLATION_UI_IS_LOADED
|
||||||
TRANSLATION_UI_IS_LOADED = True
|
TRANSLATION_UI_IS_LOADED = True
|
||||||
@@ -463,6 +465,8 @@ class BBIM_PT_translations(bpy.types.Panel):
|
|||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
|
layout.prop(context.preferences.view, "language")
|
||||||
|
|
||||||
if not TRANSLATION_UI_IS_LOADED:
|
if not TRANSLATION_UI_IS_LOADED:
|
||||||
layout.operator("bim.setup_translation_ui")
|
layout.operator("bim.setup_translation_ui")
|
||||||
layout.prop(context.preferences.filepaths, "i18n_branches_directory", text="I18n branches directory")
|
layout.prop(context.preferences.filepaths, "i18n_branches_directory", text="I18n branches directory")
|
||||||
|
|||||||
Reference in New Issue
Block a user