Fixed version label not translating

This commit is contained in:
Rendo 2025-12-21 02:56:55 +05:00
commit 88bbe56467
5 changed files with 20 additions and 12 deletions

View file

@ -5,7 +5,7 @@ var popup_scene: PackedScene = preload("uid://5goo8fyxkv33")
var new_version_avaiable: bool
var popup: ConfirmationDialog
signal update_version_text(to: StringName)
signal update_version_text(to: StringName,error: int)
func _ready() -> void:
request_completed.connect(on_request_completed)
@ -18,22 +18,22 @@ func _ready() -> void:
patch_request.download_file = exec_dir.path_join("chelimbalo.pck")
patch_request.request_completed.connect(patch_downloaded)
update_version_text.emit(tr("au_loading"))
update_version_text.emit("au_loading")
request("https://2ndbeam.ru/durenije/chelimbalo/release/deploy_data")
func on_request_completed(result: int, _response_code: int, _headers: PackedStringArray, body: PackedByteArray):
if result != OK:
update_version_text.emit("[color=red]" + tr("au_err_load") + str(result) +"[/color]")
update_version_text.emit("au_err_load",result)
return
var ver_hash = body.get_string_from_ascii().split("\n")[1]
if ver_hash != load("res://version.tres").version:
update_version_text.emit(tr("au_new_version"))
update_version_text.emit("au_new_version")
popup.popup_centered()
else:
update_version_text.emit("[color=green]"+tr("au_current_version")+"[/color]")
update_version_text.emit("au_current_version")
func download_button_pressed() -> void:
popup.get_node("HTTPRequest").request("https://2ndbeam.ru/durenije/chelimbalo/release/chelimbalo.pck")
@ -43,4 +43,4 @@ func patch_downloaded(result: int, _response_code: int, _headers: PackedStringAr
OS.create_process(OS.get_executable_path(),OS.get_cmdline_args())
get_tree().quit()
else:
update_version_text.emit("[color=red]" + tr("au_err_install") + str(result) +"[/color]")
update_version_text.emit("au_err_install",result)