diff options
author | Hop311 <Hop3114@gmail.com> | 2023-03-30 15:04:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-30 15:04:58 +0200 |
commit | 3384b21177a160f7192a2e4877eea3b29880bf4e (patch) | |
tree | db9c9a37a187e15ef494a700f8afe5d65c3a8b78 /game/src | |
parent | 8f213935bdea2400b6809f9d5db45dde3416dedc (diff) |
Added Localisation (#77)
* Added Localisation
* Removed `.gdignore`s.
* Localisation dir path and Locale name cleanup
* Incomplete entry warnings + README
Diffstat (limited to 'game/src')
-rw-r--r-- | game/src/Autoload/Events.gd | 1 | ||||
-rw-r--r-- | game/src/Autoload/Events/Localisation.gd | 30 | ||||
-rw-r--r-- | game/src/CreditsMenu/CreditsMenu.tscn | 2 | ||||
-rw-r--r-- | game/src/GameSession/GameSessionMenu.tscn | 4 | ||||
-rw-r--r-- | game/src/LobbyMenu/LobbyMenu.tscn | 4 | ||||
-rw-r--r-- | game/src/LocaleButton.gd | 60 | ||||
-rw-r--r-- | game/src/MainMenu/MainMenu.tscn | 14 | ||||
-rw-r--r-- | game/src/MainMenu/ReleaseInfoBox.gd | 16 | ||||
-rw-r--r-- | game/src/MainMenu/ReleaseInfoBox.tscn | 10 | ||||
-rw-r--r-- | game/src/OptionMenu/GeneralTab.tscn | 28 | ||||
-rw-r--r-- | game/src/OptionMenu/OptionsMenu.gd | 4 | ||||
-rw-r--r-- | game/src/OptionMenu/SettingNodes/SettingHSlider.gd | 4 | ||||
-rw-r--r-- | game/src/OptionMenu/SettingNodes/SettingOptionButton.gd | 4 | ||||
-rw-r--r-- | game/src/OptionMenu/VideoTab.tscn | 39 | ||||
-rw-r--r-- | game/src/OptionMenu/VolumeGrid.gd | 9 |
15 files changed, 141 insertions, 88 deletions
diff --git a/game/src/Autoload/Events.gd b/game/src/Autoload/Events.gd index f0f60b7..25a185f 100644 --- a/game/src/Autoload/Events.gd +++ b/game/src/Autoload/Events.gd @@ -1,3 +1,4 @@ extends Node var Options = preload("Events/Options.gd").new() +var Localisation = preload("Events/Localisation.gd").new() diff --git a/game/src/Autoload/Events/Localisation.gd b/game/src/Autoload/Events/Localisation.gd new file mode 100644 index 0000000..eda7e51 --- /dev/null +++ b/game/src/Autoload/Events/Localisation.gd @@ -0,0 +1,30 @@ +extends RefCounted + +# REQUIREMENTS +# * SS-59, SS-60, SS-61 +func get_default_locale() -> String: + var locales := TranslationServer.get_loaded_locales() + var default_locale := OS.get_locale() + if default_locale in locales: + return default_locale + var default_language := OS.get_locale_language() + for locale in locales: + if locale.begins_with(default_language): + return default_language + return ProjectSettings.get_setting("internationalization/locale/fallback", "en_GB") + +func load_localisation(dir_path : String) -> void: + if LoadLocalisation.load_localisation_dir(dir_path) == OK: + print("loaded locales: ", TranslationServer.get_loaded_locales()) + else: + push_error("Failed to load localisation directory: ", dir_path) + +# REQUIREMENTS +# * SS-57 +# * FS-17 +func _init(): + var localisation_dir_path : String = ProjectSettings.get_setting("internationalization/locale/localisation_path", "") + if localisation_dir_path.is_empty(): + push_error("Missing localisation_path setting!") + else: + load_localisation(localisation_dir_path) diff --git a/game/src/CreditsMenu/CreditsMenu.tscn b/game/src/CreditsMenu/CreditsMenu.tscn index d2819d7..6c5f36b 100644 --- a/game/src/CreditsMenu/CreditsMenu.tscn +++ b/game/src/CreditsMenu/CreditsMenu.tscn @@ -29,7 +29,7 @@ theme_type_variation = &"BackButtonsMargin" [node name="BackButton" type="Button" parent="ControlMargin"] editor_description = "UI-38" layout_mode = 2 -text = "Back to Main Menu" +text = "CREDITS_BACK" [node name="Scroll" type="ScrollContainer" parent="."] editor_description = "UI-35" diff --git a/game/src/GameSession/GameSessionMenu.tscn b/game/src/GameSession/GameSessionMenu.tscn index d6a7ca9..45fff4b 100644 --- a/game/src/GameSession/GameSessionMenu.tscn +++ b/game/src/GameSession/GameSessionMenu.tscn @@ -14,7 +14,7 @@ layout_mode = 2 [node name="MainMenuButton" type="Button" parent="VBoxContainer"] editor_description = "UI-71" layout_mode = 2 -text = "Resign" +text = "GAMESESSIONMENU_RESIGN" [node name="HSeparator" type="HSeparator" parent="VBoxContainer"] layout_mode = 2 @@ -22,7 +22,7 @@ layout_mode = 2 [node name="CloseButton" type="Button" parent="VBoxContainer"] editor_description = "UI-80" layout_mode = 2 -text = "Close" +text = "GAMESESSIONMENU_CLOSE" [connection signal="pressed" from="VBoxContainer/MainMenuButton" to="." method="_on_to_main_menu_pressed"] [connection signal="pressed" from="VBoxContainer/CloseButton" to="." method="_on_close_button_pressed"] diff --git a/game/src/LobbyMenu/LobbyMenu.tscn b/game/src/LobbyMenu/LobbyMenu.tscn index fcf2263..528e7ae 100644 --- a/game/src/LobbyMenu/LobbyMenu.tscn +++ b/game/src/LobbyMenu/LobbyMenu.tscn @@ -34,7 +34,7 @@ size_flags_vertical = 3 [node name="BackButton" type="Button" parent="GameSelectPanel/VBoxContainer"] editor_description = "UI-37" layout_mode = 2 -text = "Back" +text = "GAMELOBBY_BACK" [node name="Spacer2" type="Control" parent="GameSelectPanel/VBoxContainer"] custom_minimum_size = Vector2(0, 33) @@ -71,7 +71,7 @@ size_flags_vertical = 3 editor_description = "UI-43" layout_mode = 2 disabled = true -text = "Start Game" +text = "GAMELOBBY_START" [node name="Spacer3" type="Control" parent="GameStartPanel/VBoxContainer"] custom_minimum_size = Vector2(0, 33) diff --git a/game/src/LocaleButton.gd b/game/src/LocaleButton.gd index c3c6925..2b717a4 100644 --- a/game/src/LocaleButton.gd +++ b/game/src/LocaleButton.gd @@ -1,40 +1,49 @@ extends OptionButton -const section_name : String = "Localization" -const setting_name : String = "Locale" +const section_name : String = "localisation" +const setting_name : String = "locale" -var _locales_country_rename : Dictionary -var _locales_list : Array[String] +var _default_locale_index : int func _ready(): - _locales_country_rename = ProjectSettings.get_setting("internationalization/locale/country_short_name", {}) + var locales_country_rename : Dictionary = ProjectSettings.get_setting("internationalization/locale/country_short_name", {}) - _locales_list = [TranslationServer.get_locale()] - _locales_list.append_array(TranslationServer.get_loaded_locales()) + var locales_list = TranslationServer.get_loaded_locales() + var default_locale := Events.Localisation.get_default_locale() + if default_locale not in locales_list: + locales_list.push_back(default_locale) - for locale in _locales_list: + for locale in locales_list: + # locale_name consists of a compulsory language name and optional script + # and country names, in the format: "<language>[ (script)][, country]" var locale_name := TranslationServer.get_locale_name(locale) - var locale_first_part := locale_name.get_slice(", ", 0) - var locale_second_part := locale_name.substr(locale_first_part.length() + 2) - if locale_second_part in _locales_country_rename: - locale_second_part = _locales_country_rename[locale_second_part] + var comma_idx := locale_name.find(", ") + if comma_idx != -1: + var locale_country_name := locale_name.substr(comma_idx + 2) + locale_country_name = locales_country_rename.get(locale_country_name, "") + if not locale_country_name.is_empty(): + locale_name = locale_name.left(comma_idx + 2) + locale_country_name - add_item("%s, %s" % [locale_first_part, locale_second_part]) + add_item(locale_name) + set_item_metadata(item_count - 1, locale) + + if locale == default_locale: + _default_locale_index = item_count - 1 Events.Options.load_settings.connect(load_setting) Events.Options.save_settings.connect(save_setting) - -func _notification(what): + +func _notification(what : int): match what: NOTIFICATION_TRANSLATION_CHANGED: _select_locale_by_string(TranslationServer.get_locale()) func _valid_index(index : int) -> bool: - return 0 <= index and index < _locales_list.size() + return 0 <= index and index < item_count func load_setting(file : ConfigFile) -> void: if file == null: return - var load_value = file.get_value(section_name, setting_name, TranslationServer.get_locale()) + var load_value = file.get_value(section_name, setting_name, Events.Localisation.get_default_locale()) match typeof(load_value): TYPE_STRING, TYPE_STRING_NAME: if _select_locale_by_string(load_value as String): @@ -42,28 +51,29 @@ func load_setting(file : ConfigFile) -> void: return push_error("Setting value '%s' invalid for setting [%s] %s" % [load_value, section_name, setting_name]) reset_setting() - + func _select_locale_by_string(locale : String) -> bool: - var locale_index := _locales_list.find(locale) - if locale_index != -1: - selected = locale_index - return true + for idx in item_count: + if get_item_metadata(idx) == locale: + selected = idx + return true + selected = _default_locale_index return false # REQUIREMENTS: # * UIFUN-74 func save_setting(file : ConfigFile) -> void: if file == null: return - file.set_value(section_name, setting_name, _locales_list[selected]) + file.set_value(section_name, setting_name, get_item_metadata(selected)) func reset_setting() -> void: - selected = _locales_list.find(TranslationServer.get_locale()) + _select_locale_by_string(TranslationServer.get_locale()) # REQUIREMENTS: # * SS-58 func _on_item_selected(index : int) -> void: if _valid_index(index): - TranslationServer.set_locale(_locales_list[index]) + TranslationServer.set_locale(get_item_metadata(index)) Events.Options.save_settings_to_file.call_deferred() else: push_error("Invalid LocaleButton index: %d" % index) diff --git a/game/src/MainMenu/MainMenu.tscn b/game/src/MainMenu/MainMenu.tscn index 10bf526..5fb6ca9 100644 --- a/game/src/MainMenu/MainMenu.tscn +++ b/game/src/MainMenu/MainMenu.tscn @@ -34,7 +34,7 @@ layout_mode = 2 size_flags_vertical = 6 size_flags_stretch_ratio = 1.5 theme_type_variation = &"TitleLabel" -text = "OpenVic2" +text = "MAINMENU_TITLE" horizontal_alignment = 1 vertical_alignment = 1 @@ -60,7 +60,7 @@ focus_neighbor_right = NodePath("../ContinueButton") focus_next = NodePath("../ContinueButton") focus_previous = NodePath("../ExitButton") theme_type_variation = &"TitleButton" -text = "New Game" +text = "MAINMENU_NEW_GAME" clip_text = true [node name="ContinueButton" type="Button" parent="Panel/VBox/Margin/ButtonList"] @@ -72,7 +72,7 @@ focus_next = NodePath("../MultiplayerButton") focus_previous = NodePath("../NewGameButton") theme_type_variation = &"TitleButton" disabled = true -text = "Continue" +text = "MAINMENU_CONTINUE" clip_text = true [node name="MultiplayerButton" type="Button" parent="Panel/VBox/Margin/ButtonList"] @@ -84,7 +84,7 @@ focus_neighbor_right = NodePath("../OptionsButton") focus_next = NodePath("../OptionsButton") focus_previous = NodePath("../ContinueButton") theme_type_variation = &"TitleButton" -text = "Multiplayer" +text = "MAINMENU_MULTIPLAYER" clip_text = true [node name="OptionsButton" type="Button" parent="Panel/VBox/Margin/ButtonList"] @@ -96,7 +96,7 @@ focus_neighbor_right = NodePath("../CreditsButton") focus_next = NodePath("../CreditsButton") focus_previous = NodePath("../MultiplayerButton") theme_type_variation = &"TitleButton" -text = "Options" +text = "MAINMENU_OPTIONS" clip_text = true [node name="CreditsButton" type="Button" parent="Panel/VBox/Margin/ButtonList"] @@ -108,7 +108,7 @@ focus_neighbor_right = NodePath("../ExitButton") focus_next = NodePath("../ExitButton") focus_previous = NodePath("../OptionsButton") theme_type_variation = &"TitleButton" -text = "Credits" +text = "MAINMENU_CREDITS" clip_text = true [node name="ExitButton" type="Button" parent="Panel/VBox/Margin/ButtonList"] @@ -120,7 +120,7 @@ focus_neighbor_right = NodePath("../NewGameButton") focus_next = NodePath("../NewGameButton") focus_previous = NodePath("../OptionsButton") theme_type_variation = &"TitleButton" -text = "Exit" +text = "MAINMENU_EXIT" clip_text = true [node name="BottomSpace" type="Control" parent="Panel/VBox"] diff --git a/game/src/MainMenu/ReleaseInfoBox.gd b/game/src/MainMenu/ReleaseInfoBox.gd index 48686f3..ca03af3 100644 --- a/game/src/MainMenu/ReleaseInfoBox.gd +++ b/game/src/MainMenu/ReleaseInfoBox.gd @@ -9,6 +9,8 @@ var _commit_label : Button @export var _checksum_label : Button +var _checksum : String = "????" + # REQUIREMENTS: # * UIFUN-97 func _ready(): @@ -17,9 +19,17 @@ func _ready(): _commit_label.text = _GIT_INFO_.short_hash _commit_label.tooltip_text = _GIT_INFO_.commit_hash # UI-111 - _checksum_label.tooltip_text = "Checksum " + Checksum.get_checksum_text() - _checksum_label.text = "(" + Checksum.get_checksum_text().substr(0, 4) + ")" + _checksum = Checksum.get_checksum_text() + _update_checksum_label_text() + +func _notification(what : int): + match what: + NOTIFICATION_TRANSLATION_CHANGED: + _update_checksum_label_text() +func _update_checksum_label_text() -> void: + _checksum_label.tooltip_text = tr("MAINMENU_CHECKSUM") % _checksum + _checksum_label.text = "(%s)" % _checksum.substr(0, 4) func _on_version_label_pressed(): DisplayServer.clipboard_set(_GIT_INFO_.tag) @@ -28,4 +38,4 @@ func _on_commit_label_pressed(): DisplayServer.clipboard_set(_GIT_INFO_.commit_hash) func _on_checksum_label_pressed(): - DisplayServer.clipboard_set(Checksum.get_checksum_text()) + DisplayServer.clipboard_set(_checksum) diff --git a/game/src/MainMenu/ReleaseInfoBox.tscn b/game/src/MainMenu/ReleaseInfoBox.tscn index d15ae31..821982b 100644 --- a/game/src/MainMenu/ReleaseInfoBox.tscn +++ b/game/src/MainMenu/ReleaseInfoBox.tscn @@ -11,25 +11,25 @@ _checksum_label = NodePath("ChecksumLabel") [node name="VersionLabel" type="Button" parent="."] layout_mode = 2 -tooltip_text = "OpenVic2 v0.01 \"Primum Mobile\"" +tooltip_text = "VERSION_MISSING" theme_type_variation = &"VersionLabel" -text = "v0.01" +text = "VERSION_MISSING" flat = true alignment = 0 [node name="CommitLabel" type="Button" parent="."] layout_mode = 2 theme_type_variation = &"CommitLabel" -text = "ffffffff" +text = "????????" flat = true alignment = 0 [node name="ChecksumLabel" type="Button" parent="."] editor_description = "UI-111" layout_mode = 2 -tooltip_text = "Checksum 00000000" +tooltip_text = "CHECKSUM_MISSING" theme_type_variation = &"ChecksumLabel" -text = "(0000)" +text = "(????)" flat = true alignment = 0 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 |