Adding tabs and proper localization and scripts to dev tools
This commit is contained in:
parent
9f07705b62
commit
e019d8bb3e
7 changed files with 63 additions and 15 deletions
|
@ -307,6 +307,3 @@ msgstr "Nothing"
|
|||
|
||||
msgid "win_developper"
|
||||
msgstr "Developper"
|
||||
|
||||
msgid "lab_dev_tools"
|
||||
msgstr "Developper tools"
|
||||
|
|
|
@ -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"
|
||||
|
|
Binary file not shown.
|
@ -299,6 +299,3 @@ msgstr ""
|
|||
msgid "win_developper"
|
||||
msgstr ""
|
||||
|
||||
msgid "lab_dev_tools"
|
||||
msgstr ""
|
||||
|
||||
|
|
14
scenes/developper/developper.gd
Normal file
14
scenes/developper/developper.gd
Normal file
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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():
|
||||
|
|
Loading…
Reference in a new issue