Start of Translations

- This is the start of the translations system, does not yet work as I can't seem to get it to swap languages, I too tired today to fix it but it's a start.
- It also adds properties registration as well.
This commit is contained in:
Yusarina
2024-06-19 02:27:07 +01:00
parent 96d03075c0
commit 01f8363e07
8 changed files with 140 additions and 19 deletions
+15
View File
@@ -0,0 +1,15 @@
import bpy
from ..functions.translations import t, get_languages_list, update_ui
from ..core.register import register_property
from typing import Tuple
def register() -> None:
register_property((bpy.types.Scene, "language", bpy.props.EnumProperty(
name=t("Settings.language.label"),
description=t("Settings.language.desc"),
items=get_languages_list,
update=update_ui
)))
def unregister() -> None:
pass
+13
View File
@@ -5,6 +5,8 @@ import typing
__bl_classes = []
# List to store the ordered classes for registration
__bl_ordered_classes = []
# List to store props to register
__bl_props = []
def register_wrap(cls):
# Check if the class has a 'bl_rna' attribute (indicating it's a Blender class)
@@ -13,6 +15,17 @@ def register_wrap(cls):
__bl_classes.append(cls)
return cls
# Register all properties
def register_property(prop):
__bl_props.append(prop)
def register_properties():
for prop in __bl_props:
setattr(prop[0], prop[1], prop[2])
def unregister_properties():
for prop in reversed(__bl_props):
delattr(prop[0], prop[1])
#- @989onan had to add this from Cats. This is extremely important else you will be screamed at by register order issues!
# Find order to register to solve dependencies