1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 09:09:47 +00:00

Fix certain strings not updating when language changes (#1043)

A few buttons and labels in Pixelorama weren't getting updated when changing languages, they'd just remain at the language the program started up with or only update when changing projects.

This fixes that and ensures they get updated as soon as the user changes languages.
This commit is contained in:
nicejammer 2024-07-26 10:10:56 -03:00 committed by GitHub
parent 40be1a9559
commit 9196995697
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 24 additions and 8 deletions

View file

@ -32,9 +32,9 @@ var old_name := ""
func _ready() -> void:
export_file_dialog.use_native_dialog = Global.use_native_file_dialogs
# Add delete and export buttons to edit palette dialog
add_button(tr("Delete"), false, DELETE_ACTION)
add_button(tr("Export"), false, EXPORT_ACTION)
delete_confirmation.add_button(tr("Move to Trash"), false, BIN_ACTION)
add_button("Delete", false, DELETE_ACTION)
add_button("Export", false, EXPORT_ACTION)
delete_confirmation.add_button("Move to Trash", false, BIN_ACTION)
func open(current_palette: Palette) -> void:

View file

@ -17,7 +17,7 @@ func _ready() -> void:
_extension_loaded(extension, extension_name)
extensions.extension_loaded.connect(_extension_loaded)
extensions.extension_uninstalled.connect(_extension_uninstalled)
delete_confirmation.add_button(tr("Move to Trash"), false, Extensions.BIN_ACTION)
delete_confirmation.add_button("Move to Trash", false, Extensions.BIN_ACTION)
if OS.get_name() == "Web":
$HBoxContainer/AddExtensionButton.disabled = true
$HBoxContainer/OpenFolderButton.visible = false

View file

@ -29,6 +29,13 @@ func _ready() -> void:
transparent_checker.visible = false
func _notification(what: int) -> void:
if what == NOTIFICATION_TRANSLATION_CHANGED:
tooltip_text = (
tr("Frame: %s, Layer: %s") % [frame + 1, Global.current_project.layers[layer].name]
)
func cel_switched(force_stylebox_change := false) -> void:
z_index = 1 if button_pressed else 0
var current_theme := Global.control.theme

View file

@ -94,9 +94,22 @@ func _ready() -> void:
_setup_help_menu()
func _notification(what: int) -> void:
if what == NOTIFICATION_TRANSLATION_CHANGED and Global.current_project != null:
_update_file_menu_buttons(Global.current_project)
func _project_switched() -> void:
var project := Global.current_project
edit_menu.set_item_disabled(Global.EditMenu.NEW_BRUSH, not project.has_selection)
_update_file_menu_buttons(project)
for j in Tiles.MODE.values():
tile_mode_submenu.set_item_checked(j, j == project.tiles.mode)
_update_current_frame_mark()
func _update_file_menu_buttons(project: Project) -> void:
if project.export_directory_path.is_empty():
file_menu.set_item_text(Global.FileMenu.SAVE, tr("Save"))
else:
@ -109,10 +122,6 @@ func _project_switched() -> void:
file_menu.set_item_text(Global.FileMenu.EXPORT, tr("Export") + f_name)
else:
file_menu.set_item_text(Global.FileMenu.EXPORT, tr("Export"))
for j in Tiles.MODE.values():
tile_mode_submenu.set_item_checked(j, j == project.tiles.mode)
_update_current_frame_mark()
func _update_current_frame_mark() -> void: