Renamed share_with_server -> send_to_server

requested by @juliancoffee
This commit is contained in:
Maxicarlos08 2024-01-16 17:11:05 +01:00
parent d814296676
commit 25c7169991
No known key found for this signature in database
5 changed files with 22 additions and 20 deletions

View File

@ -137,7 +137,7 @@ hud-settings-music_spacing = Music Spacing
hud-settings-audio_device = Audio Device
hud-settings-reset_sound = Reset to Defaults
hud-settings-english_fallback = Display English for missing translations
hud-settings-language_share_with_server = Share configured language with servers (for localizing rules and motd)
hud-settings-language_send_to_server = Send the configured language to servers (for localizing rules and motd messages)
hud-settings-awaitingkey = Press a key...
hud-settings-unbound = None
hud-settings-reset_keybinds = Reset to Defaults

View File

@ -17,8 +17,8 @@ widget_ids! {
window_r,
english_fallback_button,
english_fallback_button_label,
share_with_server_checkbox,
share_with_server_checkbox_label,
send_to_server_checkbox,
send_to_server_checkbox_label,
window_scrollbar,
language_list[],
}
@ -89,8 +89,8 @@ impl<'a> Widget for Language<'a> {
.set(state.ids.window_scrollbar, ui);
// Share with server button
let share_with_server = ToggleButton::new(
self.global_state.settings.language.share_with_server,
let send_to_server = ToggleButton::new(
self.global_state.settings.language.send_to_server,
self.imgs.checkbox,
self.imgs.checkbox_checked,
)
@ -98,23 +98,23 @@ impl<'a> Widget for Language<'a> {
.top_left_with_margin_on(state.ids.window, 20.0)
.hover_images(self.imgs.checkbox_mo, self.imgs.checkbox_checked_mo)
.press_images(self.imgs.checkbox_press, self.imgs.checkbox_checked)
.set(state.ids.share_with_server_checkbox, ui);
.set(state.ids.send_to_server_checkbox, ui);
if share_with_server != self.global_state.settings.language.share_with_server {
events.push(ToggleShareWithServer(share_with_server));
if send_to_server != self.global_state.settings.language.send_to_server {
events.push(ToggleSendToServer(send_to_server));
}
Text::new(
&self
.localized_strings
.get_msg("hud-settings-language_share_with_server"),
.get_msg("hud-settings-language_send_to_server"),
)
.right_from(state.ids.share_with_server_checkbox, 10.0)
.right_from(state.ids.send_to_server_checkbox, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
.graphics_for(state.ids.share_with_server_checkbox)
.graphics_for(state.ids.send_to_server_checkbox)
.color(TEXT_COLOR)
.set(state.ids.share_with_server_checkbox_label, ui);
.set(state.ids.send_to_server_checkbox_label, ui);
// English as fallback language
let show_english_fallback = ToggleButton::new(
@ -123,7 +123,7 @@ impl<'a> Widget for Language<'a> {
self.imgs.checkbox_checked,
)
.w_h(18.0, 18.0)
.down_from(state.ids.share_with_server_checkbox, 10.0)
.down_from(state.ids.send_to_server_checkbox, 10.0)
.hover_images(self.imgs.checkbox_mo, self.imgs.checkbox_checked_mo)
.press_images(self.imgs.checkbox_press, self.imgs.checkbox_checked)
.set(state.ids.english_fallback_button, ui);

View File

@ -125,7 +125,7 @@ impl PlayState for MainMenuState {
ConnectionArgs::Mpsc(14004),
&mut self.init,
&global_state.tokio_runtime,
global_state.settings.language.share_with_server.then_some(
global_state.settings.language.send_to_server.then_some(
global_state.settings.language.selected_language.clone(),
),
&global_state.i18n,
@ -365,7 +365,7 @@ impl PlayState for MainMenuState {
global_state
.settings
.language
.share_with_server
.send_to_server
.then_some(global_state.settings.language.selected_language.clone()),
&global_state.i18n,
);

View File

@ -161,7 +161,7 @@ pub enum Interface {
#[derive(Clone)]
pub enum Language {
ChangeLanguage(Box<LanguageMetadata>),
ToggleShareWithServer(bool),
ToggleSendToServer(bool),
ToggleEnglishFallback(bool),
}
#[derive(Clone)]
@ -718,8 +718,8 @@ impl SettingsChange {
.i18n
.set_english_fallback(settings.language.use_english_fallback);
},
Language::ToggleShareWithServer(share) => {
settings.language.share_with_server = share;
Language::ToggleSendToServer(share) => {
settings.language.send_to_server = share;
},
},
SettingsChange::Networking(networking_change) => match networking_change {

View File

@ -5,7 +5,9 @@ use serde::{Deserialize, Serialize};
pub struct LanguageSettings {
pub selected_language: String,
#[serde(default = "default_true")]
pub share_with_server: bool,
/// Controls whether the locale is sent to servers we connect (usually for
/// localizing rules & motd messages)
pub send_to_server: bool,
pub use_english_fallback: bool,
}
@ -13,7 +15,7 @@ impl Default for LanguageSettings {
fn default() -> Self {
Self {
selected_language: i18n::REFERENCE_LANG.to_string(),
share_with_server: true,
send_to_server: true,
use_english_fallback: true,
}
}