From 3384b21177a160f7192a2e4877eea3b29880bf4e Mon Sep 17 00:00:00 2001 From: Hop311 Date: Thu, 30 Mar 2023 14:04:58 +0100 Subject: Added Localisation (#77) * Added Localisation * Removed `.gdignore`s. * Localisation dir path and Locale name cleanup * Incomplete entry warnings + README --- game/src/OptionMenu/GeneralTab.tscn | 28 ++++++++-------- game/src/OptionMenu/OptionsMenu.gd | 4 +-- game/src/OptionMenu/SettingNodes/SettingHSlider.gd | 4 +-- .../OptionMenu/SettingNodes/SettingOptionButton.gd | 4 +-- game/src/OptionMenu/VideoTab.tscn | 39 +++++++++++----------- game/src/OptionMenu/VolumeGrid.gd | 9 +++-- 6 files changed, 45 insertions(+), 43 deletions(-) (limited to 'game/src/OptionMenu') diff --git a/game/src/OptionMenu/GeneralTab.tscn b/game/src/OptionMenu/GeneralTab.tscn index b38f548..a9223af 100644 --- a/game/src/OptionMenu/GeneralTab.tscn +++ b/game/src/OptionMenu/GeneralTab.tscn @@ -26,7 +26,7 @@ columns = 2 [node name="SavegameFormatLabel" type="Label" parent="VBoxContainer/GridContainer"] layout_mode = 2 -text = "Savegame Format" +text = "OPTIONS_GENERAL_SAVEFORMAT" [node name="SavegameFormatSelector" type="OptionButton" parent="VBoxContainer/GridContainer"] editor_description = "UI-50" @@ -34,18 +34,18 @@ layout_mode = 2 focus_neighbor_bottom = NodePath("../AutosaveIntervalSelector") item_count = 2 selected = 0 -popup/item_0/text = "Binary" +popup/item_0/text = "OPTIONS_GENERAL_BINARY" popup/item_0/id = 0 -popup/item_1/text = "Text" +popup/item_1/text = "OPTIONS_GENERAL_TEXT" popup/item_1/id = 1 script = ExtResource("2_msx2u") -section_name = "General" -setting_name = "Savegame Format" +section_name = "general" +setting_name = "savegame_format" default_selected = 0 [node name="AutosaveIntervalLabel" type="Label" parent="VBoxContainer/GridContainer"] layout_mode = 2 -text = "Autosave Interval" +text = "OPTIONS_GENERAL_AUTOSAVE" horizontal_alignment = 1 [node name="AutosaveIntervalSelector" type="OptionButton" parent="VBoxContainer/GridContainer"] @@ -55,24 +55,24 @@ focus_neighbor_top = NodePath("../SavegameFormatSelector") focus_neighbor_bottom = NodePath("../LocaleButton") item_count = 5 selected = 0 -popup/item_0/text = "Monthly" +popup/item_0/text = "OPTIONS_GENERAL_AUTOSAVE_MONTHLY" popup/item_0/id = 0 -popup/item_1/text = "Bi-Monthly" +popup/item_1/text = "OPTIONS_GENERAL_AUTOSAVE_BIMONTHLY" popup/item_1/id = 1 -popup/item_2/text = "Bi-Yearly" +popup/item_2/text = "OPTIONS_GENERAL_AUTOSAVE_YEARLY" popup/item_2/id = 2 -popup/item_3/text = "Yearly" +popup/item_3/text = "OPTIONS_GENERAL_AUTOSAVE_BIYEARLY" popup/item_3/id = 3 -popup/item_4/text = "Never" +popup/item_4/text = "OPTIONS_GENERAL_AUTOSAVE_NEVER" popup/item_4/id = 4 script = ExtResource("2_t06tb") -section_name = "General" -setting_name = "Autosave Interval" +section_name = "general" +setting_name = "autosave_interval" default_selected = 0 [node name="LocaleLabel" type="Label" parent="VBoxContainer/GridContainer"] layout_mode = 2 -text = "Language" +text = "OPTIONS_GENERAL_LANGUAGE" [node name="LocaleButton" parent="VBoxContainer/GridContainer" instance=ExtResource("2_5cfd7")] editor_description = "UI-79" diff --git a/game/src/OptionMenu/OptionsMenu.gd b/game/src/OptionMenu/OptionsMenu.gd index d5f128c..5f6a088 100644 --- a/game/src/OptionMenu/OptionsMenu.gd +++ b/game/src/OptionMenu/OptionsMenu.gd @@ -20,7 +20,7 @@ func _ready(): # * UI-12 # * UIFUN-14 var reset_button := Button.new() - reset_button.text = "R" + reset_button.text = "OPTIONS_RESET" reset_button.pressed.connect(Events.Options.try_reset_settings) button_list.add_child(reset_button) @@ -28,7 +28,7 @@ func _ready(): # * UI-11 # * UIFUN-17 var back_button := Button.new() - back_button.text = "X" + back_button.text = "OPTIONS_BACK" back_button.pressed.connect(_on_back_button_pressed) button_list.add_child(back_button) get_viewport().get_window().close_requested.connect(_on_window_close_requested) diff --git a/game/src/OptionMenu/SettingNodes/SettingHSlider.gd b/game/src/OptionMenu/SettingNodes/SettingHSlider.gd index 6a0e5ed..4e7c9c9 100644 --- a/game/src/OptionMenu/SettingNodes/SettingHSlider.gd +++ b/game/src/OptionMenu/SettingNodes/SettingHSlider.gd @@ -2,10 +2,10 @@ extends HSlider class_name SettingHSlider @export -var section_name : String = "Setting" +var section_name : String = "setting" @export -var setting_name : String = "SettingHSlider" +var setting_name : String = "setting_hslider" @export var default_value : float = 0 diff --git a/game/src/OptionMenu/SettingNodes/SettingOptionButton.gd b/game/src/OptionMenu/SettingNodes/SettingOptionButton.gd index c7b760d..e0b8e4c 100644 --- a/game/src/OptionMenu/SettingNodes/SettingOptionButton.gd +++ b/game/src/OptionMenu/SettingNodes/SettingOptionButton.gd @@ -2,10 +2,10 @@ extends OptionButton class_name SettingOptionButton @export -var section_name : String = "Setting" +var section_name : String = "setting" @export -var setting_name : String = "SettingOptionMenu" +var setting_name : String = "setting_optionbutton" @export var default_selected : int = -1: diff --git a/game/src/OptionMenu/VideoTab.tscn b/game/src/OptionMenu/VideoTab.tscn index c060b19..c92f7f7 100644 --- a/game/src/OptionMenu/VideoTab.tscn +++ b/game/src/OptionMenu/VideoTab.tscn @@ -9,7 +9,6 @@ [node name="Video" type="HBoxContainer" node_paths=PackedStringArray("initial_focus")] editor_description = "UI-46" -tooltip_text = "This is my cool and very nice tooltip" alignment = 1 script = ExtResource("1_jvv62") initial_focus = NodePath("VBoxContainer/GridContainer/ResolutionSelector") @@ -29,7 +28,7 @@ columns = 2 [node name="ResolutionLabel" type="Label" parent="VBoxContainer/GridContainer"] layout_mode = 2 -text = "Resolution" +text = "OPTIONS_VIDEO_RESOLUTION" [node name="ResolutionSelector" type="OptionButton" parent="VBoxContainer/GridContainer"] editor_description = "UI-19" @@ -40,13 +39,13 @@ selected = 0 popup/item_0/text = "MISSING" popup/item_0/id = 0 script = ExtResource("1_i8nro") -section_name = "Video" -setting_name = "Resolution" +section_name = "video" +setting_name = "resolution" [node name="ScreenModeLabel" type="Label" parent="VBoxContainer/GridContainer"] editor_description = "UI-44" layout_mode = 2 -text = "Screen Mode" +text = "OPTIONS_VIDEO_SCREEN_MODE" [node name="ScreenModeSelector" type="OptionButton" parent="VBoxContainer/GridContainer"] layout_mode = 2 @@ -54,19 +53,19 @@ focus_neighbor_top = NodePath("../ResolutionSelector") focus_neighbor_bottom = NodePath("../MonitorDisplaySelector") item_count = 3 selected = 0 -popup/item_0/text = "Fullscreen" +popup/item_0/text = "OPTIONS_VIDEO_FULLSCREEN" popup/item_0/id = 0 -popup/item_1/text = "Borderless" +popup/item_1/text = "OPTIONS_VIDEO_BORDERLESS" popup/item_1/id = 1 -popup/item_2/text = "Windowed" +popup/item_2/text = "OPTIONS_VIDEO_WINDOWED" popup/item_2/id = 2 script = ExtResource("2_wa7vw") -section_name = "Video" -setting_name = "Mode Selected" +section_name = "video" +setting_name = "mode_selected" [node name="MonitorSelectionLabel" type="Label" parent="VBoxContainer/GridContainer"] layout_mode = 2 -text = "Monitor Selection" +text = "OPTIONS_VIDEO_MONITOR_SELECTION" [node name="MonitorDisplaySelector" type="OptionButton" parent="VBoxContainer/GridContainer"] layout_mode = 2 @@ -77,17 +76,17 @@ selected = 0 popup/item_0/text = "MISSING" popup/item_0/id = 0 script = ExtResource("3_y6lyb") -section_name = "Video" -setting_name = "Current Screen" +section_name = "video" +setting_name = "current_screen" [node name="RefreshRateLabel" type="Label" parent="VBoxContainer/GridContainer"] layout_mode = 2 -text = "Refresh Rate" +text = "OPTIONS_VIDEO_REFRESH_RATE" [node name="RefreshRateSelector" type="OptionButton" parent="VBoxContainer/GridContainer"] editor_description = "UI-18" layout_mode = 2 -tooltip_text = "Only change from VSYNC if you are having issues with screen tearing." +tooltip_text = "OPTIONS_VIDEO_REFRESH_RATE_TOOLTIP" focus_neighbor_top = NodePath("../MonitorDisplaySelector") focus_neighbor_bottom = NodePath("../QualityPresetSelector") item_count = 8 @@ -109,13 +108,13 @@ popup/item_6/id = 6 popup/item_7/text = "Unlimited" popup/item_7/id = 7 script = ExtResource("4_381mg") -section_name = "Video" -setting_name = "Refresh Rate" +section_name = "video" +setting_name = "refresh_rate" default_selected = 0 [node name="QualityPresetLabel" type="Label" parent="VBoxContainer/GridContainer"] layout_mode = 2 -text = "Quality Preset" +text = "OPTIONS_VIDEO_QUALITY" [node name="QualityPresetSelector" type="OptionButton" parent="VBoxContainer/GridContainer"] editor_description = "UI-21" @@ -134,8 +133,8 @@ popup/item_3/id = 3 popup/item_4/text = "Custom" popup/item_4/id = 4 script = ExtResource("5_srg4v") -section_name = "Video" -setting_name = "Quality Preset" +section_name = "video" +setting_name = "quality_preset" default_selected = 1 [connection signal="item_selected" from="VBoxContainer/GridContainer/ResolutionSelector" to="VBoxContainer/GridContainer/ResolutionSelector" method="_on_item_selected"] diff --git a/game/src/OptionMenu/VolumeGrid.gd b/game/src/OptionMenu/VolumeGrid.gd index 5b1d13f..46613b4 100644 --- a/game/src/OptionMenu/VolumeGrid.gd +++ b/game/src/OptionMenu/VolumeGrid.gd @@ -14,13 +14,16 @@ func get_volume_value_as_db(value : float) -> float: # linear_to_db consumes a float between 0 and 1 to produce the db value return linear_to_db(value / RATIO_FOR_LINEAR) -func add_volume_row(bus_name : StringName, bus_index : int) -> HSlider: +func add_volume_row(bus_name : String, bus_index : int) -> HSlider: var volume_label := Label.new() - volume_label.text = bus_name + " Volume" + if bus_name == "Master": + volume_label.text = "MASTER_BUS" + else: + volume_label.text = bus_name add_child(volume_label) var volume_slider := SettingHSlider.new() - volume_slider.section_name = "Audio" + volume_slider.section_name = "audio" volume_slider.setting_name = volume_label.text volume_slider.custom_minimum_size = Vector2(290, 0) volume_slider.size_flags_vertical = Control.SIZE_FILL -- cgit v1.2.3-56-ga3b1