diff --git a/locales/en.po b/locales/en.po index dd3fb48..8b6b17d 100644 --- a/locales/en.po +++ b/locales/en.po @@ -307,6 +307,3 @@ msgstr "Nothing" msgid "win_developper" msgstr "Developper" - -msgid "lab_dev_tools" -msgstr "Developper tools" diff --git a/locales/fr.po b/locales/fr.po index f3de6eb..462a0dc 100644 --- a/locales/fr.po +++ b/locales/fr.po @@ -307,6 +307,3 @@ msgstr "Rien n'est sélectionné" msgid "win_developper" msgstr "Développeur" - -msgid "lab_dev_tools" -msgstr "Outils de développement" diff --git a/locales/messages.mo b/locales/messages.mo index 924a7a2..6862cf4 100644 Binary files a/locales/messages.mo and b/locales/messages.mo differ diff --git a/locales/messages.pot b/locales/messages.pot index a6bb178..103d3b2 100644 --- a/locales/messages.pot +++ b/locales/messages.pot @@ -299,6 +299,3 @@ msgstr "" msgid "win_developper" msgstr "" -msgid "lab_dev_tools" -msgstr "" - diff --git a/scenes/developper/developper.gd b/scenes/developper/developper.gd new file mode 100644 index 0000000..3b6c092 --- /dev/null +++ b/scenes/developper/developper.gd @@ -0,0 +1,14 @@ +extends Control + + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + pass + +func _on_quit_pressed(): + $Window.visible = false diff --git a/scenes/developper/developper.tscn b/scenes/developper/developper.tscn index e7faf67..6d6d37c 100644 --- a/scenes/developper/developper.tscn +++ b/scenes/developper/developper.tscn @@ -1,9 +1,9 @@ [gd_scene load_steps=2 format=3 uid="uid://cua4782cbjhla"] -[ext_resource type="Script" path="res://scenes/languages/languages.gd" id="1_irmml"] +[ext_resource type="Script" path="res://scenes/developper/developper.gd" id="1_qf0rd"] [node name="Control" type="Control"] -script = ExtResource( "1_irmml" ) +script = ExtResource( "1_qf0rd" ) [node name="Window" type="Window" parent="."] title = "win_developper" @@ -18,10 +18,18 @@ size_flags_horizontal = 3 size_flags_vertical = 3 metadata/_edit_use_custom_anchors = false -[node name="Label" type="Label" parent="Window/VBoxContainer"] +[node name="VBoxContainer2" type="VBoxContainer" parent="Window/VBoxContainer"] offset_right = 40.0 -offset_bottom = 23.0 -text = "lab_dev_tools" +offset_bottom = 40.0 + +[node name="TabBar" type="TabBar" parent="Window/VBoxContainer/VBoxContainer2"] +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_top = 31.0 +offset_bottom = 22.0 +tab_count = 2 +tab_0/title = "tab_sky" +tab_1/title = "tab_weather" [node name="Quit" type="Button" parent="Window/VBoxContainer"] offset_top = 35.0 diff --git a/scenes/languages/languages.gd b/scenes/languages/languages.gd index 5a6881a..a63210a 100644 --- a/scenes/languages/languages.gd +++ b/scenes/languages/languages.gd @@ -2,7 +2,42 @@ extends Control # Called when the node enters the scene tree for the first time. func _ready(): - pass + $Window/VBoxContainer/Select.clear() + var id = 0 + var selected = -1 + var near_selected = -1 + var current_locale = TranslationServer.get_locale() + var root_language = current_locale.split('_')[0] + for key in TranslationServer.get_loaded_locales(): + if key == TranslationServer.get_locale(): + selected = id + else: + var tmp = key.split("_") + # print("tmp:" + tmp[0]) + if tmp[0] == root_language: + if tmp.size() == 1: + near_selected = id + elif near_selected == -1: + near_selected = id + $Window/VBoxContainer/Select.add_item(TranslationServer.get_locale_name(key) + " [" + key + "]", id) + id += 1 + if selected == -1 and near_selected != -1: + selected = near_selected + if selected == -1: + # Your language not exist, create it just for the form + var key = TranslationServer.get_locale() + $Window/VBoxContainer/Select.add_item(TranslationServer.get_locale_name(key) + " (" + key + " !)", id) + selected = id + $Window/VBoxContainer/Select.select(selected) + + +func _on_select_item_selected(_index): + var pos = 0 + for key in TranslationServer.get_loaded_locales(): + if pos == $Window/VBoxContainer/Select.get_selected(): + TranslationServer.set_locale(key) + return + pos += 1 func _on_quit_pressed():