Adds localization to main menu, adult check and package downloader.

This commit is contained in:
Dylan Sarrazyn
2024-07-10 16:38:49 +02:00
parent 1d22612490
commit ee4f8dac14
16 changed files with 95 additions and 44 deletions
+31
View File
@@ -0,0 +1,31 @@
keys;fr;es
LOGGED_AS;Connecté en tant que;Conectado como :
BUILD_VERSION;Numéro de version;Número de versión :
DEVICE_ID;Numéro d'appareil;
LANGUAGE;Langue;
SIGN_IN_TEACHER;Connexion enseignant;
SIGN_IN_PARENT;Connexion parent;
CREATE_ACCOUNT;Création de compte;
LOGIN;Identifiants;
EMAIL;Adresse mail;
PASSWORD;Mot de passe;
LOG_IN;Se connecter;
INVALID_EMAIL_OR_PASSWORD;Adresse mail ou mot de passe invalide;
DEVICE_NUMBER;Appareil n° {number};
SETTINGS;Paramètres;
ADULT_CHECK_PROMPT;"Veuillez confirmer que vous êtes un adulte !
Appuyez sur les touches {1}, {2} et {3}";
STAR;Étoile;
BAR;Barre;
CIRCLE;Cercle;
PLUS;Plus;
SQUARE;Carré;
TRIANGLE;Triangle;
DOWNLOADING_DATA;Téléchargement des données...;
BACK;Précédent;
NEXT;Suivant;
CANCEL;Annuler;
ACCOUNT_TYPE_PROMPT;Veuillez sélectionner le type de compte que vous souhaitez créer;
ACCOUNT_TYPE;Type de compte;
TEACHER;Enseignant;
PARENT;Parent;
1 keys fr es
2 LOGGED_AS Connecté en tant que Conectado como :
3 BUILD_VERSION Numéro de version Número de versión :
4 DEVICE_ID Numéro d'appareil
5 LANGUAGE Langue
6 SIGN_IN_TEACHER Connexion enseignant
7 SIGN_IN_PARENT Connexion parent
8 CREATE_ACCOUNT Création de compte
9 LOGIN Identifiants
10 EMAIL Adresse mail
11 PASSWORD Mot de passe
12 LOG_IN Se connecter
13 INVALID_EMAIL_OR_PASSWORD Adresse mail ou mot de passe invalide
14 DEVICE_NUMBER Appareil n° {number}
15 SETTINGS Paramètres
16 ADULT_CHECK_PROMPT Veuillez confirmer que vous êtes un adulte ! Appuyez sur les touches {1}, {2} et {3}
17 STAR Étoile
18 BAR Barre
19 CIRCLE Cercle
20 PLUS Plus
21 SQUARE Carré
22 TRIANGLE Triangle
23 DOWNLOADING_DATA Téléchargement des données...
24 BACK Précédent
25 NEXT Suivant
26 CANCEL Annuler
27 ACCOUNT_TYPE_PROMPT Veuillez sélectionner le type de compte que vous souhaitez créer
28 ACCOUNT_TYPE Type de compte
29 TEACHER Enseignant
30 PARENT Parent
+17
View File
@@ -0,0 +1,17 @@
[remap]
importer="csv_translation"
type="Translation"
uid="uid://ccpq4mu4yjj71"
[deps]
files=["res://kalulu_localization.fr.translation", "res://kalulu_localization.es.translation"]
source_file="res://kalulu_localization.csv"
dest_files=["res://kalulu_localization.fr.translation", "res://kalulu_localization.es.translation"]
[params]
compress=true
delimiter=1
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
+1
View File
@@ -73,6 +73,7 @@ right_click={
[internationalization] [internationalization]
locale/translation_remaps={} locale/translation_remaps={}
locale/translations=PackedStringArray("res://kalulu_localization.es.translation", "res://kalulu_localization.fr.translation")
[rendering] [rendering]
+1
View File
@@ -11,6 +11,7 @@ const supported_locales: Array[String] = [
language = value language = value
Database.language = value Database.language = value
TranslationServer.set_locale(value) TranslationServer.set_locale(value)
print(TranslationServer.get_locale())
@export var teacher : String @export var teacher : String
@export var device_id : int @export var device_id : int
+13 -9
View File
@@ -3,22 +3,20 @@ extends Control
const main_menu_scene_path: = "res://sources/menus/main/main_menu.tscn" const main_menu_scene_path: = "res://sources/menus/main/main_menu.tscn"
const register_scene_path := "res://sources/menus/register/register.tscn" const register_scene_path := "res://sources/menus/register/register.tscn"
const symbols_names = { const symbols_names = {
"1" : "star", "1" : "STAR",
"2" : "bar", "2" : "BAR",
"3" : "circle", "3" : "CIRCLE",
"4" : "plus", "4" : "PLUS",
"5" : "square", "5" : "SQUARE",
"6" : "triangle", "6" : "TRIANGLE",
} }
@onready var code_keyboard : CodeKeyboard = %CodeKeyboard @onready var code_keyboard : CodeKeyboard = %CodeKeyboard
@onready var password_label : Label = %PasswordLabel @onready var password_label : Label = %PasswordLabel
var base_password_label_text : String
var password : String = "" var password : String = ""
func _ready() -> void: func _ready() -> void:
base_password_label_text = password_label.text
_reset_password() _reset_password()
OpeningCurtain.open() OpeningCurtain.open()
@@ -27,7 +25,13 @@ func _ready() -> void:
func _reset_password() -> void: func _reset_password() -> void:
password = TeacherSettings.available_codes.pick_random() password = TeacherSettings.available_codes.pick_random()
var password_array: = password.split("") var password_array: = password.split("")
password_label.text = base_password_label_text % [symbols_names[password_array[0]], symbols_names[password[1]], symbols_names[password[2]]] password_label.text = tr("ADULT_CHECK_PROMPT").format(
{
"1" : tr(symbols_names[password_array[0]]),
"2" : tr(symbols_names[password_array[1]]),
"3" : tr(symbols_names[password_array[2]])
}
)
func _on_back_button_pressed() -> void: func _on_back_button_pressed() -> void:
@@ -46,8 +46,6 @@ custom_minimum_size = Vector2(1500, 500)
layout_mode = 2 layout_mode = 2
size_flags_vertical = 1 size_flags_vertical = 1
theme_override_font_sizes/font_size = 70 theme_override_font_sizes/font_size = 70
text = "Please confirm you are an adult !
Press the %s, %s and %s"
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1 vertical_alignment = 1
autowrap_mode = 2 autowrap_mode = 2
@@ -46,7 +46,7 @@ layout_mode = 2
layout_mode = 2 layout_mode = 2
size_flags_vertical = 3 size_flags_vertical = 3
theme_override_font_sizes/font_size = 90 theme_override_font_sizes/font_size = 90
text = "Téléchargement des données..." text = "DOWNLOADING_DATA"
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1 vertical_alignment = 1
+1 -1
View File
@@ -28,7 +28,7 @@ func _ready():
if UserDataManager.teacher_settings and UserDataManager.teacher_settings.account_type == TeacherSettings.AccountType.Teacher: if UserDataManager.teacher_settings and UserDataManager.teacher_settings.account_type == TeacherSettings.AccountType.Teacher:
device_number_label.show() device_number_label.show()
device_number_label.text += str(UserDataManager.get_device_settings().device_id) device_number_label.text = tr("DEVICE_NUMBER").format({"number" : UserDataManager.get_device_settings().device_id})
await OpeningCurtain.open() await OpeningCurtain.open()
+1 -2
View File
@@ -41,7 +41,6 @@ offset_right = 158.5
offset_bottom = 176.0 offset_bottom = 176.0
grow_horizontal = 2 grow_horizontal = 2
theme_override_font_sizes/font_size = 70 theme_override_font_sizes/font_size = 70
text = "DEVICE n°"
[node name="CodeKeyboard" parent="." instance=ExtResource("5_xwrca")] [node name="CodeKeyboard" parent="." instance=ExtResource("5_xwrca")]
layout_mode = 1 layout_mode = 1
@@ -96,7 +95,7 @@ theme_override_constants/margin_bottom = 50
layout_mode = 2 layout_mode = 2
size_flags_vertical = 8 size_flags_vertical = 8
theme_override_font_sizes/font_size = 70 theme_override_font_sizes/font_size = 70
text = "Teacher" text = "SETTINGS"
[node name="TeacherTimer" type="Timer" parent="InterfaceRight/TeacherButton"] [node name="TeacherTimer" type="Timer" parent="InterfaceRight/TeacherButton"]
wait_time = 5.0 wait_time = 5.0
+15 -17
View File
@@ -200,7 +200,7 @@ theme_override_constants/separation = 0
[node name="LanguageLabel" type="Label" parent="UserSelection/Form/LanguageContainer"] [node name="LanguageLabel" type="Label" parent="UserSelection/Form/LanguageContainer"]
layout_mode = 2 layout_mode = 2
theme_override_font_sizes/font_size = 70 theme_override_font_sizes/font_size = 70
text = "Language" text = "LANGUAGE"
[node name="LanguageField" type="OptionButton" parent="UserSelection/Form/LanguageContainer"] [node name="LanguageField" type="OptionButton" parent="UserSelection/Form/LanguageContainer"]
unique_name_in_owner = true unique_name_in_owner = true
@@ -212,21 +212,19 @@ script = ExtResource("13_rs3hd")
[node name="SignInTeacher" type="Button" parent="UserSelection/Form"] [node name="SignInTeacher" type="Button" parent="UserSelection/Form"]
layout_mode = 2 layout_mode = 2
theme_override_font_sizes/font_size = 70 theme_override_font_sizes/font_size = 70
text = "Sign-in teacher account text = "SIGN_IN_TEACHER"
"
metadata/_edit_use_anchors_ = true metadata/_edit_use_anchors_ = true
[node name="SignInParent" type="Button" parent="UserSelection/Form"] [node name="SignInParent" type="Button" parent="UserSelection/Form"]
layout_mode = 2 layout_mode = 2
theme_override_font_sizes/font_size = 70 theme_override_font_sizes/font_size = 70
text = "Sign-in parent account text = "SIGN_IN_PARENT"
"
metadata/_edit_use_anchors_ = true metadata/_edit_use_anchors_ = true
[node name="Register" type="Button" parent="UserSelection/Form"] [node name="Register" type="Button" parent="UserSelection/Form"]
layout_mode = 2 layout_mode = 2
theme_override_font_sizes/font_size = 70 theme_override_font_sizes/font_size = 70
text = "Create an account" text = "CREATE_ACCOUNT"
metadata/_edit_use_anchors_ = true metadata/_edit_use_anchors_ = true
[node name="LoginForm" type="Control" parent="."] [node name="LoginForm" type="Control" parent="."]
@@ -249,7 +247,7 @@ offset_top = 168.0
offset_bottom = 286.0 offset_bottom = 286.0
grow_horizontal = 2 grow_horizontal = 2
theme_override_font_sizes/font_size = 90 theme_override_font_sizes/font_size = 90
text = "Teacher login" text = "SIGN_IN_TEACHER"
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1 vertical_alignment = 1
@@ -263,7 +261,7 @@ offset_top = 168.0
offset_bottom = 286.0 offset_bottom = 286.0
grow_horizontal = 2 grow_horizontal = 2
theme_override_font_sizes/font_size = 90 theme_override_font_sizes/font_size = 90
text = "Parent login" text = "SIGN_IN_PARENT"
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1 vertical_alignment = 1
@@ -302,7 +300,7 @@ theme_override_constants/separation = 0
[node name="DeviceIDLabel" type="Label" parent="LoginForm/LoginFormValidator/FormContainer/DeviceIDContainer"] [node name="DeviceIDLabel" type="Label" parent="LoginForm/LoginFormValidator/FormContainer/DeviceIDContainer"]
layout_mode = 2 layout_mode = 2
theme_override_font_sizes/font_size = 70 theme_override_font_sizes/font_size = 70
text = "Device number" text = "DEVICE_ID"
[node name="DeviceIDField" type="SpinBox" parent="LoginForm/LoginFormValidator/FormContainer/DeviceIDContainer"] [node name="DeviceIDField" type="SpinBox" parent="LoginForm/LoginFormValidator/FormContainer/DeviceIDContainer"]
unique_name_in_owner = true unique_name_in_owner = true
@@ -330,14 +328,14 @@ theme_override_constants/separation = 0
layout_mode = 2 layout_mode = 2
theme = ExtResource("15_pcmnw") theme = ExtResource("15_pcmnw")
theme_override_font_sizes/font_size = 70 theme_override_font_sizes/font_size = 70
text = "Login" text = "LOGIN"
[node name="EmailField" type="LineEdit" parent="LoginForm/LoginFormValidator/FormContainer/EmailContainer"] [node name="EmailField" type="LineEdit" parent="LoginForm/LoginFormValidator/FormContainer/EmailContainer"]
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
theme_type_variation = &"1" theme_type_variation = &"1"
theme_override_font_sizes/font_size = 70 theme_override_font_sizes/font_size = 70
placeholder_text = "Email" placeholder_text = "EMAIL"
[node name="EmailValidator" type="Node" parent="LoginForm/LoginFormValidator/FormContainer/EmailContainer/EmailField"] [node name="EmailValidator" type="Node" parent="LoginForm/LoginFormValidator/FormContainer/EmailContainer/EmailField"]
script = ExtResource("18_iunlb") script = ExtResource("18_iunlb")
@@ -355,7 +353,7 @@ theme_override_constants/separation = 0
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
theme_override_font_sizes/font_size = 70 theme_override_font_sizes/font_size = 70
placeholder_text = "Password" placeholder_text = "PASSWORD"
secret = true secret = true
[node name="PasswordValidator" type="Node" parent="LoginForm/LoginFormValidator/FormContainer/PasswordContainer/PasswordField"] [node name="PasswordValidator" type="Node" parent="LoginForm/LoginFormValidator/FormContainer/PasswordContainer/PasswordField"]
@@ -370,13 +368,13 @@ layout_mode = 2
layout_mode = 2 layout_mode = 2
size_flags_vertical = 8 size_flags_vertical = 8
theme_override_font_sizes/font_size = 70 theme_override_font_sizes/font_size = 70
text = "Log in" text = "LOG_IN"
[node name="LoginError" type="Label" parent="LoginForm/LoginFormValidator/FormContainer"] [node name="LoginError" type="Label" parent="LoginForm/LoginFormValidator/FormContainer"]
unique_name_in_owner = true unique_name_in_owner = true
visible = false visible = false
layout_mode = 2 layout_mode = 2
text = "Invalid username or password" text = "INVALID_EMAIL_OR_PASSWORD"
[node name="InterfaceLeft" type="MarginContainer" parent="."] [node name="InterfaceLeft" type="MarginContainer" parent="."]
unique_name_in_owner = true unique_name_in_owner = true
@@ -417,7 +415,7 @@ offset_left = 10.0
offset_right = 261.0 offset_right = 261.0
offset_bottom = 56.0 offset_bottom = 56.0
theme_override_font_sizes/font_size = 30 theme_override_font_sizes/font_size = 30
text = "Build Version :" text = "BUILD_VERSION"
vertical_alignment = 1 vertical_alignment = 1
[node name="BuildVersionValue" type="Label" parent="Informations"] [node name="BuildVersionValue" type="Label" parent="Informations"]
@@ -436,7 +434,7 @@ offset_top = 56.0
offset_right = 261.0 offset_right = 261.0
offset_bottom = 112.0 offset_bottom = 112.0
theme_override_font_sizes/font_size = 30 theme_override_font_sizes/font_size = 30
text = "Logged as :" text = "LOGGED_AS"
vertical_alignment = 1 vertical_alignment = 1
[node name="TeacherValue" type="Label" parent="Informations"] [node name="TeacherValue" type="Label" parent="Informations"]
@@ -456,7 +454,7 @@ offset_top = 112.0
offset_right = 261.0 offset_right = 261.0
offset_bottom = 168.0 offset_bottom = 168.0
theme_override_font_sizes/font_size = 30 theme_override_font_sizes/font_size = 30
text = "Device Id :" text = "DEVICE_ID"
vertical_alignment = 1 vertical_alignment = 1
[node name="DeviceIDValue" type="Label" parent="Informations"] [node name="DeviceIDValue" type="Label" parent="Informations"]
@@ -1,5 +1,12 @@
extends Step extends Step
@onready var type: = %TypeSelect
func _ready() -> void:
type.add_item(tr("TEACHER"))
type.add_item(tr("PARENT"))
func _on_next() -> bool: func _on_next() -> bool:
var register_data = data as TeacherSettings var register_data = data as TeacherSettings
if register_data: if register_data:
@@ -22,36 +22,32 @@ rules = Array[Resource("res://addons/godot-form-validator/rules/validator_rule.g
[node name="AccountTypeStep" instance=ExtResource("1_g51ml")] [node name="AccountTypeStep" instance=ExtResource("1_g51ml")]
script = ExtResource("2_k6524") script = ExtResource("2_k6524")
step_name = "type" step_name = "type"
question = "Choose the type of account" question = "ACCOUNT_TYPE_PROMPT"
[node name="BackButton" parent="LeftMargin/LeftContainer" index="0"] [node name="BackButton" parent="LeftMargin/LeftContainer" index="0"]
text = "Cancel" text = "CANCEL"
[node name="QuestionLabel" parent="PanelContainer/QuestionContainer" index="0"]
text = "Choose the type of account"
[node name="TypeContainer" type="HBoxContainer" parent="Background/FormMargin/FormValidator/FormBinder/FormContainer" index="0"] [node name="TypeContainer" type="HBoxContainer" parent="Background/FormMargin/FormValidator/FormBinder/FormContainer" index="0"]
layout_mode = 2 layout_mode = 2
theme_override_constants/separation = 20
[node name="TypeSelectLabel" type="Label" parent="Background/FormMargin/FormValidator/FormBinder/FormContainer/TypeContainer" index="0"] [node name="TypeSelectLabel" type="Label" parent="Background/FormMargin/FormValidator/FormBinder/FormContainer/TypeContainer" index="0"]
custom_minimum_size = Vector2(350, 0) custom_minimum_size = Vector2(350, 0)
layout_mode = 2 layout_mode = 2
size_flags_vertical = 1 size_flags_vertical = 1
theme_override_font_sizes/font_size = 70 theme_override_font_sizes/font_size = 70
text = "Type :" text = "ACCOUNT_TYPE"
[node name="VBoxContainer" type="VBoxContainer" parent="Background/FormMargin/FormValidator/FormBinder/FormContainer/TypeContainer" index="1"] [node name="VBoxContainer" type="VBoxContainer" parent="Background/FormMargin/FormValidator/FormBinder/FormContainer/TypeContainer" index="1"]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
[node name="TypeSelect" type="ItemList" parent="Background/FormMargin/FormValidator/FormBinder/FormContainer/TypeContainer/VBoxContainer" index="0"] [node name="TypeSelect" type="ItemList" parent="Background/FormMargin/FormValidator/FormBinder/FormContainer/TypeContainer/VBoxContainer" index="0"]
unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
theme_override_font_sizes/font_size = 70 theme_override_font_sizes/font_size = 70
allow_search = false allow_search = false
auto_height = true auto_height = true
item_count = 2
item_0/text = "Teacher"
item_1/text = "Parent"
[node name="ControlValidator" type="Node" parent="Background/FormMargin/FormValidator/FormBinder/FormContainer/TypeContainer/VBoxContainer/TypeSelect" index="1"] [node name="ControlValidator" type="Node" parent="Background/FormMargin/FormValidator/FormBinder/FormContainer/TypeContainer/VBoxContainer/TypeSelect" index="1"]
script = ExtResource("2_hidu6") script = ExtResource("2_hidu6")
+2 -3
View File
@@ -15,7 +15,6 @@ anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
script = ExtResource("1_02ocl") script = ExtResource("1_02ocl")
infos = null
[node name="LeftMargin" type="MarginContainer" parent="."] [node name="LeftMargin" type="MarginContainer" parent="."]
custom_minimum_size = Vector2(450, 2.08165e-12) custom_minimum_size = Vector2(450, 2.08165e-12)
@@ -40,7 +39,7 @@ alignment = 2
[node name="BackButton" type="Button" parent="LeftMargin/LeftContainer"] [node name="BackButton" type="Button" parent="LeftMargin/LeftContainer"]
layout_mode = 2 layout_mode = 2
theme_override_font_sizes/font_size = 70 theme_override_font_sizes/font_size = 70
text = "Back" text = "BACK"
icon = ExtResource("2_41tvo") icon = ExtResource("2_41tvo")
[node name="RightMargin" type="MarginContainer" parent="."] [node name="RightMargin" type="MarginContainer" parent="."]
@@ -69,7 +68,7 @@ alignment = 2
[node name="ValidateButton" type="Button" parent="RightMargin/RightContainer"] [node name="ValidateButton" type="Button" parent="RightMargin/RightContainer"]
layout_mode = 2 layout_mode = 2
theme_override_font_sizes/font_size = 70 theme_override_font_sizes/font_size = 70
text = "Next" text = "NEXT"
icon = ExtResource("3_17uns") icon = ExtResource("3_17uns")
icon_alignment = 2 icon_alignment = 2