Add italian localizations and mechanism for card, levels and buttons and labels

This commit is contained in:
Luca Canali 2021-09-06 23:15:34 +02:00
parent 2c275424a3
commit 705cc849c2
125 changed files with 131 additions and 71 deletions

View file

@ -170,5 +170,6 @@ stretch_mode = 6
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="mouse_entered" from="Area2D" to="." method="_mouse_entered"]
[connection signal="mouse_exited" from="Area2D" to="." method="_mouse_exited"]

View file

@ -3,7 +3,7 @@ extends Control
var card_store = {}
var cards
var card_radius = 1500
var lang = "it" # TODO: Make a global variable to setting dir and cards localizations
#var lang = "it" # TODO: Make a global variable to setting dir and cards localizations
func _ready():
load_card_store()
@ -17,7 +17,7 @@ func _process(_delta):
func load_card_store():
card_store = {}
var cards_json = JSON.parse(helpers.read_file("res://resources/cards_i18n.json")).result
var cards_json = JSON.parse(helpers.read_file("res://resources/cards.json")).result
for card in cards_json:
card_store[card["id"]] = card
@ -40,7 +40,7 @@ func draw_card(card):
new_card.id = card["id"]
new_card.command = card["command"]
new_card.description = card["description"][lang]
new_card.description = card["description"][helpers.lang]
new_card.energy = 0 #card.energy
new_card.position = Vector2(rect_size.x, rect_size.y*2)
add_child(new_card)

View file

@ -49,4 +49,5 @@ text = "3"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="Button" to="." method="redraw_all_cards"]

View file

@ -13,7 +13,7 @@ func load(path):
var level_names = []
var dir = Directory.new()
dir.open("res://levels/%s" % slug)
dir.open("res://levels/" + helpers.lang + "/%s" % slug)
dir.list_dir_begin()
while true:
@ -28,7 +28,7 @@ func load(path):
var final_level_sequence = []
var level_sequence = Array(helpers.read_file("res://levels/%s/sequence" % slug, "").split("\n"))
var level_sequence = Array(helpers.read_file("res://levels/" + helpers.lang + "/%s/sequence" % slug, "").split("\n"))
for level in level_sequence:
if level == "":
@ -42,7 +42,7 @@ func load(path):
for l in final_level_sequence:
var level = Level.new()
level.load("res://levels/%s/%s" % [slug, l])
level.load("res://levels/" + helpers.lang + "/%s/%s" % [slug, l])
levels.push_back(level)
func _to_string():

View file

@ -45,5 +45,6 @@ material = SubResource( 3 )
position = Vector2( -0.102825, -0.377726 )
scale = Vector2( 2.25501, 2.25501 )
texture = ExtResource( 2 )
[connection signal="area_entered" from="Area2D" to="." method="_mouse_entered"]
[connection signal="area_exited" from="Area2D" to="." method="_mouse_exited"]

View file

@ -131,5 +131,6 @@ __meta__ = {
[node name="PopupMenu" type="PopupMenu" parent="."]
margin_right = 20.0
margin_bottom = 20.0
[connection signal="pressed" from="Panel/TextEdit/SaveButton" to="." method="save"]
[connection signal="pressed" from="Panel/TextEdit/CloseButton" to="." method="close"]

View file

@ -122,4 +122,5 @@ autowrap = true
[node name="PopupMenu" type="PopupMenu" parent="."]
margin_right = 20.0
margin_bottom = 20.0
[connection signal="id_pressed" from="PopupMenu" to="." method="_popup_menu_pressed"]

View file

@ -1,5 +1,7 @@
extends Node
var lang = "it" # Variable for localization
var debug_file_io = false
# Crash the game and display the error message.

View file

@ -21,4 +21,5 @@ anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="text_entered" from="LineEdit" to="." method="_text_entered"]

View file

@ -15,6 +15,7 @@ func back():
func reload():
for child in level_list.get_children():
child.queue_free()

View file

@ -42,35 +42,11 @@ margin_right = 1320.0
margin_bottom = 1080.0
size_flags_horizontal = 3
[node name="Button" type="Button" parent="."]
margin_left = 61.0902
margin_top = 59.0538
margin_right = 126.09
margin_bottom = 98.0538
text = "Back"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Button2" type="Button" parent="."]
margin_left = 138.588
margin_top = 59.3009
margin_right = 226.588
margin_bottom = 98.3009
focus_mode = 0
enabled_focus_mode = 0
text = "Reload"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Button3" parent="." instance=ExtResource( 4 )]
[node name="HelpLabel" type="Label" parent="."]
visible = false
margin_left = 63.0
margin_top = 159.0
margin_right = 378.0
margin_right = 379.0
margin_bottom = 220.0
text = "Help us improving Oh My Git! by
answering some questions:"
@ -90,6 +66,41 @@ text = "To the survey /o/"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="Button" to="." method="back"]
[connection signal="pressed" from="Button2" to="." method="reload"]
[node name="HBoxContainer" type="HBoxContainer" parent="."]
anchor_right = 1.0
margin_left = 89.0
margin_top = 24.0
margin_bottom = 63.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Back" type="Button" parent="HBoxContainer"]
margin_right = 75.0
margin_bottom = 39.0
text = "BACK"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Reload" type="Button" parent="HBoxContainer"]
margin_left = 80.0
margin_right = 188.0
margin_bottom = 39.0
focus_mode = 0
enabled_focus_mode = 0
text = "RELOAD"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Toggle_Music" parent="HBoxContainer" instance=ExtResource( 4 )]
margin_left = 193.0
margin_top = 0.0
margin_right = 282.0
margin_bottom = 39.0
[connection signal="pressed" from="HelpLabel/Button3" to="." method="onSurveyPressed"]
[connection signal="pressed" from="HBoxContainer/Back" to="." method="back"]
[connection signal="pressed" from="HBoxContainer/Reload" to="." method="reload"]

View file

@ -9,7 +9,7 @@ func reload():
chapters = []
var dir = Directory.new()
dir.open("res://levels")
dir.open("res://levels/" + helpers.lang) # TODO: Add language directory to get a correct language
dir.list_dir_begin()
var chapter_names = []
@ -26,7 +26,7 @@ func reload():
var final_chapter_sequence = []
var chapter_sequence = Array(helpers.read_file("res://levels/sequence", "").split("\n"))
var chapter_sequence = Array(helpers.read_file("res://levels/" + helpers.lang + "/sequence", "").split("\n"))
for chapter in chapter_sequence:
if chapter == "":
@ -40,5 +40,5 @@ func reload():
for c in final_chapter_sequence:
var chapter = Chapter.new()
chapter.load("res://levels/%s" % c)
chapter.load("res://levels/" + helpers.lang + "/%s" % c)
chapters.push_back(chapter)

View file

@ -206,31 +206,31 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="BackButton" type="Button" parent="Menu"]
margin_right = 65.0
[node name="Back" type="Button" parent="Menu"]
margin_right = 75.0
margin_bottom = 39.0
focus_mode = 0
enabled_focus_mode = 0
text = "Back"
text = "BACK"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ReloadButton2" type="Button" parent="Menu"]
margin_left = 73.0
margin_right = 161.0
[node name="Reload" type="Button" parent="Menu"]
margin_left = 83.0
margin_right = 191.0
margin_bottom = 39.0
focus_mode = 0
enabled_focus_mode = 0
text = "Reload"
text = "RELOAD"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="CardsButton" type="Button" parent="Menu"]
visible = false
margin_left = 458.0
margin_right = 539.0
margin_left = 169.0
margin_right = 250.0
margin_bottom = 39.0
focus_mode = 0
enabled_focus_mode = 0
@ -251,35 +251,36 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Button3" parent="Menu" instance=ExtResource( 11 )]
margin_left = 169.0
[node name="Toogle_Music" parent="Menu" instance=ExtResource( 11 )]
margin_left = 199.0
margin_top = 0.0
margin_right = 315.0
margin_right = 288.0
margin_bottom = 39.0
[node name="CLIBadge" parent="Menu" instance=ExtResource( 10 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 323.0
margin_right = 368.0
margin_left = 296.0
margin_right = 341.0
margin_bottom = 39.0
[node name="NextLevelButton" type="Button" parent="Menu"]
margin_left = 376.0
margin_right = 493.0
margin_left = 349.0
margin_right = 501.0
margin_bottom = 39.0
focus_mode = 0
custom_styles/hover = SubResource( 2 )
custom_styles/normal = ExtResource( 4 )
enabled_focus_mode = 0
text = "Next level"
text = "NEXT_LEVEL"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="saved" from="Rows/Columns/RightSide/FileBrowser" to="." method="update_repos"]
[connection signal="command_done" from="Rows/Controls/Terminal" to="." method="update_repos"]
[connection signal="pressed" from="Menu/BackButton" to="." method="back"]
[connection signal="pressed" from="Menu/ReloadButton2" to="." method="reload_level"]
[connection signal="pressed" from="Menu/Back" to="." method="back"]
[connection signal="pressed" from="Menu/Reload" to="." method="reload_level"]
[connection signal="pressed" from="Menu/CardsButton" to="." method="toggle_cards"]
[connection signal="pressed" from="Menu/Tip!" to="." method="new_tip"]
[connection signal="pressed" from="Menu/NextLevelButton" to="." method="load_next_level"]

View file

@ -1,6 +1,5 @@
extends Button
func _ready():
pass

View file

@ -2,16 +2,17 @@
[ext_resource path="res://scenes/music_button.gd" type="Script" id=1]
[node name="Button3" type="Button"]
[node name="Toggle_music" type="Button"]
margin_left = 241.005
margin_top = 58.856
margin_right = 387.005
margin_bottom = 97.856
focus_mode = 0
enabled_focus_mode = 0
text = "Toggle music"
text = "MUSIC"
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="." to="." method="toggle_music"]

View file

@ -58,11 +58,11 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Button" type="Button" parent="VBoxContainer"]
[node name="Levels" type="Button" parent="VBoxContainer"]
visible = false
margin_right = 351.0
margin_bottom = 39.0
text = "Levels"
text = "LEVELS"
[node name="Button3" type="Button" parent="VBoxContainer"]
visible = false
@ -70,10 +70,10 @@ margin_right = 351.0
margin_bottom = 39.0
text = "Sandbox"
[node name="Button2" type="Button" parent="VBoxContainer"]
[node name="Install" type="Button" parent="VBoxContainer"]
margin_right = 351.0
margin_bottom = 39.0
text = "Sure, I'll install it!"
text = "INSTALL"
[node name="Sprite" type="Sprite" parent="."]
@ -94,12 +94,12 @@ margin_left = 20.0
margin_top = 21.0
margin_right = 546.0
margin_bottom = 252.0
text = "Hi! It seems that you don't have Git installed yet!
On Linux, please install it from your package manager, usually the package is called \"git\"!
On macOS 10.8 and below, you can download Git from git-scm.com."
text = "GIT_MESSAGE"
autowrap = true
[connection signal="pressed" from="VBoxContainer/Button" to="." method="levels"]
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="VBoxContainer/Levels" to="." method="levels"]
[connection signal="pressed" from="VBoxContainer/Button3" to="." method="sandbox"]
[connection signal="pressed" from="VBoxContainer/Button2" to="." method="quit"]
[connection signal="pressed" from="VBoxContainer/Install" to="." method="quit"]

View file

@ -81,6 +81,7 @@ custom_colors/font_color = Color( 1, 1, 1, 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="mouse_entered" from="Rect" to="." method="_on_hover"]
[connection signal="mouse_exited" from="Rect" to="." method="_on_unhover"]
[connection signal="mouse_entered" from="Area2D" to="." method="_on_hover"]

View file

@ -60,4 +60,5 @@ text = "Got it!"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="Panel/CenterContainer/OK" to="." method="confirm"]

View file

@ -52,7 +52,7 @@ __meta__ = {
[node name="Button" type="Button" parent="VBoxContainer"]
margin_right = 351.0
margin_bottom = 39.0
text = "Levels"
text = "LEVELS"
[node name="Button3" type="Button" parent="VBoxContainer"]
margin_top = 44.0
@ -64,7 +64,7 @@ text = "Sandbox"
margin_top = 88.0
margin_right = 351.0
margin_bottom = 127.0
text = "Quit"
text = "QUIT"
[node name="Sprite" type="Sprite" parent="."]