frame-of-mind/src/dev-util/i18n_texture_rect.gd

24 lines
688 B
GDScript3
Raw Normal View History

2025-10-07 22:31:22 +00:00
@tool
extends TextureRect
@export var textures: Dictionary[String, Texture] = {}
func _get_configuration_warnings() -> PackedStringArray:
var warnings: PackedStringArray = []
for key in textures.keys():
if not TranslationServer.get_all_languages().has(key):
warnings.append("Locale not supported: %s" % key)
return warnings
func _ready() -> void:
State.settings_changed.connect(update_img)
update_img()
func update_img() -> void:
if textures.keys().has(TranslationServer.get_locale()):
texture = textures[TranslationServer.get_locale()]
func _validate_property(property: Dictionary) -> void:
if property.name == "texture":
property.usage |= PROPERTY_USAGE_READ_ONLY