Migrate code to new i18n API

This commit is contained in:
juliancoffee 2022-08-06 20:47:45 +03:00
parent 8ba50e62d5
commit d000cc90a1
35 changed files with 964 additions and 914 deletions

8
Cargo.lock generated
View File

@ -1905,7 +1905,7 @@ dependencies = [
[[package]]
name = "fluent"
version = "0.16.0"
source = "git+https://github.com/juliancoffee/fluent-rs.git#efd8159736c0c5d5f00a1c1f91fe35492e9ab473"
source = "git+https://github.com/juliancoffee/fluent-rs.git#cfaf910cd5dd915619d7def671140fd5311383b6"
dependencies = [
"fluent-bundle",
"unic-langid",
@ -1914,7 +1914,7 @@ dependencies = [
[[package]]
name = "fluent-bundle"
version = "0.15.2"
source = "git+https://github.com/juliancoffee/fluent-rs.git#efd8159736c0c5d5f00a1c1f91fe35492e9ab473"
source = "git+https://github.com/juliancoffee/fluent-rs.git#cfaf910cd5dd915619d7def671140fd5311383b6"
dependencies = [
"fluent-langneg",
"fluent-syntax",
@ -1938,7 +1938,7 @@ dependencies = [
[[package]]
name = "fluent-syntax"
version = "0.11.0"
source = "git+https://github.com/juliancoffee/fluent-rs.git#efd8159736c0c5d5f00a1c1f91fe35492e9ab473"
source = "git+https://github.com/juliancoffee/fluent-rs.git#cfaf910cd5dd915619d7def671140fd5311383b6"
dependencies = [
"thiserror",
]
@ -2843,7 +2843,7 @@ dependencies = [
[[package]]
name = "intl-memoizer"
version = "0.5.1"
source = "git+https://github.com/juliancoffee/fluent-rs.git#efd8159736c0c5d5f00a1c1f91fe35492e9ab473"
source = "git+https://github.com/juliancoffee/fluent-rs.git#cfaf910cd5dd915619d7def671140fd5311383b6"
dependencies = [
"type-map",
"unic-langid",

View File

@ -988,7 +988,7 @@ impl<'a> AgentData<'a> {
let used = match msg {
AgentEvent::Talk(..) | AgentEvent::TradeAccepted(_) => {
self.chat_npc_if_allowed_to_speak(
"npc.speech.villager_busy",
"npc-speech-villager_busy",
agent,
event_emitter,
);
@ -998,13 +998,13 @@ impl<'a> AgentData<'a> {
controller.push_invite_response(InviteResponse::Decline);
if agent.behavior.can_trade() {
self.chat_npc_if_allowed_to_speak(
"npc.speech.merchant_busy",
"npc-speech-merchant_busy",
agent,
event_emitter,
);
} else {
self.chat_npc_if_allowed_to_speak(
"npc.speech.villager_busy",
"npc-speech-villager_busy",
agent,
event_emitter,
);
@ -1018,12 +1018,12 @@ impl<'a> AgentData<'a> {
match result {
TradeResult::Completed => {
self.chat_npc(
"npc.speech.merchant_trade_successful",
"npc-speech-merchant_trade_successful",
event_emitter,
);
},
_ => {
self.chat_npc("npc.speech.merchant_trade_declined", event_emitter);
self.chat_npc("npc-speech-merchant_trade_declined", event_emitter);
},
}
agent.behavior.unset(BehaviorState::TRADING);
@ -1039,7 +1039,7 @@ impl<'a> AgentData<'a> {
*tradeid,
TradeAction::Decline,
));
self.chat_npc("npc.speech.merchant_trade_cancelled_hostile", event_emitter);
self.chat_npc("npc-speech-merchant_trade_cancelled_hostile", event_emitter);
true
},
AgentEvent::ServerSound(_) | AgentEvent::Hurt => false,
@ -1158,18 +1158,18 @@ impl<'a> AgentData<'a> {
if !agent.behavior.is(BehaviorState::TRADING) {
controller.push_initiate_invite(*by, InviteKind::Trade);
self.chat_npc(
"npc.speech.merchant_advertisement",
"npc-speech-merchant_advertisement",
event_emitter,
);
} else {
let default_msg = "npc.speech.merchant_busy";
let default_msg = "npc-speech-merchant_busy";
let msg = self.rtsim_entity.map_or(default_msg, |e| {
if e.brain
.personality
.personality_traits
.contains(PersonalityTrait::Disagreeable)
{
"npc.speech.merchant_busy_rude"
"npc-speech-merchant_busy_rude"
} else {
default_msg
}
@ -1185,57 +1185,57 @@ impl<'a> AgentData<'a> {
{
let msg = match extreme_trait {
PersonalityTrait::Open => {
"npc.speech.villager_open"
"npc-speech-villager_open"
},
PersonalityTrait::Adventurous => {
"npc.speech.villager_adventurous"
"npc-speech-villager_adventurous"
},
PersonalityTrait::Closed => {
"npc.speech.villager_closed"
"npc-speech-villager_closed"
},
PersonalityTrait::Conscientious => {
"npc.speech.villager_conscientious"
"npc-speech-villager_conscientious"
},
PersonalityTrait::Busybody => {
"npc.speech.villager_busybody"
"npc-speech-villager_busybody"
},
PersonalityTrait::Unconscientious => {
"npc.speech.villager_unconscientious"
"npc-speech-villager_unconscientious"
},
PersonalityTrait::Extroverted => {
"npc.speech.villager_extroverted"
"npc-speech-villager_extroverted"
},
PersonalityTrait::Introverted => {
"npc.speech.villager_introverted"
"npc-speech-villager_introverted"
},
PersonalityTrait::Agreeable => {
"npc.speech.villager_agreeable"
"npc-speech-villager_agreeable"
},
PersonalityTrait::Sociable => {
"npc.speech.villager_sociable"
"npc-speech-villager_sociable"
},
PersonalityTrait::Disagreeable => {
"npc.speech.villager_disagreeable"
"npc-speech-villager_disagreeable"
},
PersonalityTrait::Neurotic => {
"npc.speech.villager_neurotic"
"npc-speech-villager_neurotic"
},
PersonalityTrait::Seeker => {
"npc.speech.villager_seeker"
"npc-speech-villager_seeker"
},
PersonalityTrait::SadLoner => {
"npc.speech.villager_sad_loner"
"npc-speech-villager_sad_loner"
},
PersonalityTrait::Worried => {
"npc.speech.villager_worried"
"npc-speech-villager_worried"
},
PersonalityTrait::Stable => {
"npc.speech.villager_stable"
"npc-speech-villager_stable"
},
};
self.chat_npc(msg, event_emitter);
} else {
self.chat_npc("npc.speech.villager", event_emitter);
self.chat_npc("npc-speech-villager", event_emitter);
}
}
},
@ -1244,12 +1244,12 @@ impl<'a> AgentData<'a> {
if !agent.behavior.is(BehaviorState::TRADING) {
controller.push_initiate_invite(*by, InviteKind::Trade);
self.chat_npc(
"npc.speech.merchant_advertisement",
"npc-speech-merchant_advertisement",
event_emitter,
);
} else {
self.chat_npc(
"npc.speech.merchant_busy",
"npc-speech-merchant_busy",
event_emitter,
);
}
@ -1257,7 +1257,7 @@ impl<'a> AgentData<'a> {
// TODO: maybe make some travellers willing to trade with
// simpler goods like potions
self.chat_npc(
"npc.speech.villager_decline_trade",
"npc-speech-villager_decline_trade",
event_emitter,
);
}
@ -1383,7 +1383,7 @@ impl<'a> AgentData<'a> {
} else {
controller.push_invite_response(InviteResponse::Decline);
self.chat_npc_if_allowed_to_speak(
"npc.speech.merchant_busy",
"npc-speech-merchant_busy",
agent,
event_emitter,
);
@ -1392,7 +1392,7 @@ impl<'a> AgentData<'a> {
// TODO: Provide a hint where to find the closest merchant?
controller.push_invite_response(InviteResponse::Decline);
self.chat_npc_if_allowed_to_speak(
"npc.speech.villager_decline_trade",
"npc-speech-villager_decline_trade",
agent,
event_emitter,
);
@ -1413,10 +1413,10 @@ impl<'a> AgentData<'a> {
if agent.behavior.is(BehaviorState::TRADING) {
match result {
TradeResult::Completed => {
self.chat_npc("npc.speech.merchant_trade_successful", event_emitter);
self.chat_npc("npc-speech-merchant_trade_successful", event_emitter);
},
_ => {
self.chat_npc("npc.speech.merchant_trade_declined", event_emitter);
self.chat_npc("npc-speech-merchant_trade_declined", event_emitter);
},
}
agent.behavior.unset(BehaviorState::TRADING);
@ -1553,12 +1553,12 @@ impl<'a> AgentData<'a> {
if self.remembers_fight_with(target, read_data) {
chat_villager_remembers_fighting();
} else if is_dressed_as_cultist(target, read_data) {
chat("npc.speech.villager_cultist_alarm");
chat("npc-speech-villager_cultist_alarm");
} else {
chat("npc.speech.menacing");
chat("npc-speech-menacing");
}
} else {
chat("npc.speech.menacing");
chat("npc-speech-menacing");
}
}
@ -2468,13 +2468,13 @@ impl<'a> AgentData<'a> {
// FIXME: If going to use "cultist + low health + fleeing" string, make sure
// they are each true.
self.chat_npc_if_allowed_to_speak(
"npc.speech.cultist_low_health_fleeing",
"npc-speech-cultist_low_health_fleeing",
agent,
event_emitter,
);
} else if is_villager(self.alignment) {
self.chat_npc_if_allowed_to_speak(
"npc.speech.villager_under_attack",
"npc-speech-villager_under_attack",
agent,
event_emitter,
);
@ -2489,7 +2489,7 @@ impl<'a> AgentData<'a> {
) {
if is_villager(self.alignment) {
self.chat_npc_if_allowed_to_speak(
"npc.speech.villager_enemy_killed",
"npc-speech-villager_enemy_killed",
agent,
event_emitter,
);

View File

@ -31,6 +31,7 @@ use conrod_core::{
widget_ids, Color, Colorable, Positionable, Scalar, Sizeable, UiCell, Widget, WidgetCommon,
};
use i18n::Localization;
use std::borrow::Cow;
use crate::hud::slots::SlotKind;
use specs::Entity as EcsEntity;
@ -194,8 +195,9 @@ impl<'a> InventoryScroller<'a> {
Text::new(
&self
.localized_strings
.get("hud.bag.inventory")
.replace("{playername}", &*self.playername),
.get_msg_ctx("hud-bag-inventory", &i18n::fluent_args! {
"playername" => &*self.playername,
}),
)
.mid_top_with_margin_on(self.bg_ids.bg_frame, 9.0)
.font_id(self.fonts.cyri.conrod_id)
@ -205,8 +207,9 @@ impl<'a> InventoryScroller<'a> {
Text::new(
&self
.localized_strings
.get("hud.bag.inventory")
.replace("{playername}", &*self.playername),
.get_msg_ctx("hud-bag-inventory", &i18n::fluent_args! {
"playername" => &*self.playername,
}),
)
.top_left_with_margins_on(state.ids.inventory_title_bg, 2.0, 2.0)
.font_id(self.fonts.cyri.conrod_id)
@ -814,11 +817,11 @@ impl<'a> Widget for Bag<'a> {
.top_left_with_margins_on(state.bg_ids.bg_frame, inv_sort_btn_top, 47.0)
.with_tooltip(
self.tooltip_manager,
match inventory.next_sort_order() {
&(match inventory.next_sort_order() {
InventorySortOrder::Name => i18n.get("hud.bag.sort_by_name"),
InventorySortOrder::Quality => i18n.get("hud.bag.sort_by_quality"),
InventorySortOrder::Tag => i18n.get("hud.bag.sort_by_category"),
},
}),
"",
&tooltip,
color::WHITE,
@ -887,7 +890,7 @@ impl<'a> Widget for Bag<'a> {
} else {
let manager = &mut *self.tooltip_manager;
$slot_maker
.with_tooltip(manager, i18n.get($desc), "", &tooltip, color::WHITE)
.with_tooltip(manager, &i18n.get($desc), "", &tooltip, color::WHITE)
.set($slot_id, ui)
}
};
@ -973,18 +976,18 @@ impl<'a> Widget for Bag<'a> {
"Protection" => i18n.get("hud.bag.protection"),
"Stun Resilience" => i18n.get("hud.bag.stun_res"),
"Stealth" => i18n.get("hud.bag.stealth"),
_ => "",
_ => Cow::Borrowed(""),
};
let tooltip_txt = match i.1 {
"Combat Rating" => i18n.get("hud.bag.combat_rating_desc"),
"Protection" => i18n.get("hud.bag.protection_desc"),
"Stun Resilience" => i18n.get("hud.bag.stun_res_desc"),
_ => "",
_ => Cow::Borrowed(""),
};
btn.with_tooltip(
self.tooltip_manager,
tooltip_head,
tooltip_txt,
&tooltip_head,
&tooltip_txt,
&bag_tooltip,
TEXT_COLOR,
)
@ -1213,19 +1216,22 @@ impl<'a> Widget for Bag<'a> {
.align_middle_y_of(state.ids.active_mainhand_slot)
.with_tooltip(
self.tooltip_manager,
i18n.get("hud.bag.swap_equipped_weapons_title"),
if let Some(key) = self
&i18n.get("hud.bag.swap_equipped_weapons_title"),
&(if let Some(key) = self
.global_state
.settings
.controls
.get_binding(GameInput::SwapLoadout)
{
i18n.get("hud.bag.swap_equipped_weapons_desc")
.replace("{key}", key.display_string(key_layout).as_str())
i18n.get_msg_ctx(
"hud-bag-swap_equipped_weapons_desc",
&i18n::fluent_args! {
"key" => key.display_string(key_layout)
},
)
} else {
"".to_string()
}
.as_str(),
Cow::Borrowed("")
}),
&tooltip,
color::WHITE,
)

View File

@ -238,7 +238,7 @@ impl<'a> Widget for BuffsBar<'a> {
.middle_of(*id)
.with_tooltip(
self.tooltip_manager,
title,
&title,
&desc,
&buffs_tooltip,
BUFF_COLOR,
@ -308,7 +308,7 @@ impl<'a> Widget for BuffsBar<'a> {
.middle_of(*id)
.with_tooltip(
self.tooltip_manager,
title,
&title,
&desc,
&buffs_tooltip,
DEBUFF_COLOR,
@ -400,7 +400,7 @@ impl<'a> Widget for BuffsBar<'a> {
.middle_of(*id)
.with_tooltip(
self.tooltip_manager,
title,
&title,
&desc,
&buffs_tooltip,
if buff.is_buff {

View File

@ -165,9 +165,9 @@ impl<'a> Widget for Buttons<'a> {
.w_h(420.0 / 10.0, 480.0 / 10.0)
.with_tooltip(
self.tooltip_manager,
&localized_strings
.get("hud.bag.inventory")
.replace("{playername}", &self.stats.name),
&localized_strings.get_msg_ctx("hud-bag-inventory", &i18n::fluent_args! {
"playername" => &self.stats.name
}),
"",
&button_tooltip,
TEXT_COLOR,
@ -228,7 +228,7 @@ impl<'a> Widget for Buttons<'a> {
.press_image(self.imgs.settings_press)
.with_tooltip(
self.tooltip_manager,
localized_strings.get("common.settings"),
&localized_strings.get("common.settings"),
"",
&button_tooltip,
TEXT_COLOR,
@ -261,7 +261,7 @@ impl<'a> Widget for Buttons<'a> {
.press_image(self.imgs.social_press)
.with_tooltip(
self.tooltip_manager,
localized_strings.get("hud.social"),
&localized_strings.get("hud.social"),
"",
&button_tooltip,
TEXT_COLOR,
@ -293,7 +293,7 @@ impl<'a> Widget for Buttons<'a> {
.press_image(self.imgs.map_press)
.with_tooltip(
self.tooltip_manager,
localized_strings.get("hud.map.map_title"),
&localized_strings.get("hud.map.map_title"),
"",
&button_tooltip,
TEXT_COLOR,
@ -330,7 +330,7 @@ impl<'a> Widget for Buttons<'a> {
.press_image(self.imgs.spellbook_press)
.with_tooltip(
self.tooltip_manager,
localized_strings.get("hud.diary"),
&localized_strings.get("hud.diary"),
"",
&button_tooltip,
TEXT_COLOR,
@ -363,14 +363,14 @@ impl<'a> Widget for Buttons<'a> {
.mid_top_with_margin_on(state.ids.spellbook_button, -12.0 + arrow_ani as f64)
.color(Some(QUALITY_LEGENDARY))
.set(state.ids.sp_arrow, ui);
Text::new(localized_strings.get("hud.sp_arrow_txt"))
Text::new(&localized_strings.get("hud.sp_arrow_txt"))
.mid_top_with_margin_on(state.ids.sp_arrow, -18.0)
.graphics_for(state.ids.spellbook_button)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(14))
.color(BLACK)
.set(state.ids.sp_arrow_txt_bg, ui);
Text::new(localized_strings.get("hud.sp_arrow_txt"))
Text::new(&localized_strings.get("hud.sp_arrow_txt"))
.graphics_for(state.ids.spellbook_button)
.bottom_right_with_margins_on(state.ids.sp_arrow_txt_bg, 1.0, 1.0)
.font_id(self.fonts.cyri.conrod_id)
@ -386,7 +386,7 @@ impl<'a> Widget for Buttons<'a> {
.press_image(self.imgs.crafting_icon_press)
.with_tooltip(
self.tooltip_manager,
localized_strings.get("hud.crafting"),
&localized_strings.get("hud.crafting"),
"",
&button_tooltip,
TEXT_COLOR,

View File

@ -429,7 +429,20 @@ impl<'a> Widget for Chat<'a> {
.map(|m| {
let mut message = m.clone();
if let Some(template_key) = get_chat_template_key(&message.chat_type) {
message.message = self.localized_strings.get(template_key).to_string();
// FIXME (i18n death messages):
// Death message is half localized in voxygen, half in client.
// Make this not.
message.message = self
.localized_strings
.get_msg_ctx(template_key, &i18n::fluent_args! {
"attacker" => "{attacker}",
"name" => "{name}",
"died_from_buff" => "{died_from_buff}",
"victim" => "{victim}",
"environment" => "{environment}",
})
.into_owned();
if let ChatType::Kill(kill_source, _) = &message.chat_type {
match kill_source {
KillSource::Player(_, KillType::Buff(buffkind))
@ -544,7 +557,7 @@ impl<'a> Widget for Chat<'a> {
.hover_image(self.imgs.selection_hover)
.hover_image(self.imgs.selection_press)
.image_color(shading)
.label(self.localized_strings.get("hud.chat.all"))
.label(&self.localized_strings.get("hud.chat.all"))
.label_font_size(self.fonts.cyri.scale(14))
.label_font_id(self.fonts.cyri.conrod_id)
.label_color(TEXT_COLOR.alpha(alpha))
@ -603,7 +616,8 @@ impl<'a> Widget for Chat<'a> {
.set(state.ids.chat_tab_tooltip_bg, ui);
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.chat.chat_tab_hover_tooltip"),
)
.mid_top_with_margin_on(state.ids.chat_tab_tooltip_bg, 3.0)
@ -770,12 +784,11 @@ fn render_chat_line(chat_type: &ChatType<String>, imgs: &Imgs) -> (Color, conrod
fn insert_killing_buff(buff: BuffKind, localized_strings: &Localization, template: &str) -> String {
let buff_outcome = match buff {
BuffKind::Burning => localized_strings.get("hud.outcome.burning"),
BuffKind::Bleeding => localized_strings.get("hud.outcome.bleeding"),
BuffKind::Cursed => localized_strings.get("hud.outcome.curse"),
BuffKind::Crippled => localized_strings.get("hud.outcome.crippled"),
BuffKind::Frozen => localized_strings.get("hud.outcome.frozen"),
BuffKind::Poisoned => localized_strings.get("hud.outcome.poisoned"),
BuffKind::Burning => "hud-outcome-burning",
BuffKind::Bleeding => "hud-outcome-bleeding",
BuffKind::Cursed => "hud-outcome-curse",
BuffKind::Crippled => "hud-outcome-crippled",
BuffKind::Frozen => "hud-outcome-frozen",
BuffKind::Regeneration
| BuffKind::Saturation
| BuffKind::Potion
@ -787,39 +800,39 @@ fn insert_killing_buff(buff: BuffKind, localized_strings: &Localization, templat
| BuffKind::Frenzied
| BuffKind::Hastened => {
tracing::error!("Player was killed by a positive buff!");
localized_strings.get("hud.outcome.mysterious")
"hud-outcome-mysterious"
},
BuffKind::Wet | BuffKind::Ensnared => {
BuffKind::Wet | BuffKind::Ensnared | BuffKind::Poisoned => {
tracing::error!("Player was killed by a debuff that doesn't do damage!");
localized_strings.get("hud.outcome.mysterious")
"hud-outcome-mysterious"
},
};
template.replace("{died_of_buff}", buff_outcome)
template.replace("{died_from_buff}", &localized_strings.get_msg(buff_outcome))
}
fn get_chat_template_key(chat_type: &ChatType<String>) -> Option<&str> {
Some(match chat_type {
ChatType::Online(_) => "hud.chat.online_msg",
ChatType::Offline(_) => "hud.chat.offline_msg",
ChatType::Online(_) => "hud-chat-online_msg",
ChatType::Offline(_) => "hud-chat-offline_msg",
ChatType::Kill(kill_source, _) => match kill_source {
KillSource::Player(_, KillType::Buff(_)) => "hud.chat.died_of_pvp_buff_msg",
KillSource::Player(_, KillType::Melee) => "hud.chat.pvp_melee_kill_msg",
KillSource::Player(_, KillType::Projectile) => "hud.chat.pvp_ranged_kill_msg",
KillSource::Player(_, KillType::Explosion) => "hud.chat.pvp_explosion_kill_msg",
KillSource::Player(_, KillType::Energy) => "hud.chat.pvp_energy_kill_msg",
KillSource::Player(_, KillType::Other) => "hud.chat.pvp_other_kill_msg",
KillSource::NonExistent(KillType::Buff(_)) => "hud.chat.died_of_buff_nonexistent_msg",
KillSource::NonPlayer(_, KillType::Buff(_)) => "hud.chat.died_of_npc_buff_msg",
KillSource::NonPlayer(_, KillType::Melee) => "hud.chat.npc_melee_kill_msg",
KillSource::NonPlayer(_, KillType::Projectile) => "hud.chat.npc_ranged_kill_msg",
KillSource::NonPlayer(_, KillType::Explosion) => "hud.chat.npc_explosion_kill_msg",
KillSource::NonPlayer(_, KillType::Energy) => "hud.chat.npc_energy_kill_msg",
KillSource::NonPlayer(_, KillType::Other) => "hud.chat.npc_other_kill_msg",
KillSource::Environment(_) => "hud.chat.environmental_kill_msg",
KillSource::FallDamage => "hud.chat.fall_kill_msg",
KillSource::Suicide => "hud.chat.suicide_msg",
KillSource::NonExistent(_) | KillSource::Other => "hud.chat.default_death_msg",
KillSource::Player(_, KillType::Buff(_)) => "hud-chat-died_of_pvp_buff_msg",
KillSource::Player(_, KillType::Melee) => "hud-chat-pvp_melee_kill_msg",
KillSource::Player(_, KillType::Projectile) => "hud-chat-pvp_ranged_kill_msg",
KillSource::Player(_, KillType::Explosion) => "hud-chat-pvp_explosion_kill_msg",
KillSource::Player(_, KillType::Energy) => "hud-chat-pvp_energy_kill_msg",
KillSource::Player(_, KillType::Other) => "hud-chat-pvp_other_kill_msg",
KillSource::NonExistent(KillType::Buff(_)) => "hud-chat-died_of_buff_nonexistent_msg",
KillSource::NonPlayer(_, KillType::Buff(_)) => "hud-chat-died_of_npc_buff_msg",
KillSource::NonPlayer(_, KillType::Melee) => "hud-chat-npc_melee_kill_msg",
KillSource::NonPlayer(_, KillType::Projectile) => "hud-chat-npc_ranged_kill_msg",
KillSource::NonPlayer(_, KillType::Explosion) => "hud-chat-npc_explosion_kill_msg",
KillSource::NonPlayer(_, KillType::Energy) => "hud-chat-npc_energy_kill_msg",
KillSource::NonPlayer(_, KillType::Other) => "hud-chat-npc_other_kill_msg",
KillSource::Environment(_) => "hud-chat-environmental_kill_msg",
KillSource::FallDamage => "hud-chat-fall_kill_msg",
KillSource::Suicide => "hud-chat-suicide_msg",
KillSource::NonExistent(_) | KillSource::Other => "hud-chat-default_death_msg",
},
_ => return None,
})

View File

@ -36,7 +36,7 @@ use conrod_core::{
};
use hashbrown::HashMap;
use i18n::Localization;
use std::{collections::BTreeMap, sync::Arc};
use std::{borrow::Cow, collections::BTreeMap, sync::Arc};
use strum::{EnumIter, IntoEnumIterator};
use tracing::warn;
use vek::*;
@ -383,7 +383,7 @@ impl<'a> Widget for Crafting<'a> {
}
// Title
Text::new(self.localized_strings.get("hud.crafting"))
Text::new(&self.localized_strings.get("hud.crafting"))
.mid_top_with_margin_on(state.ids.window_frame, 9.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(20))
@ -459,7 +459,7 @@ impl<'a> Widget for Crafting<'a> {
})
.with_tooltip(
self.tooltip_manager,
self.localized_strings.get(crafting_tab.name_key()),
&self.localized_strings.get(crafting_tab.name_key()),
"",
&tabs_tooltip,
TEXT_COLOR,
@ -973,13 +973,15 @@ impl<'a> Widget for Crafting<'a> {
self.localized_strings
.get("hud.crafting.mod_comp_wood_prim_slot_desc"),
),
RecipeKind::Component(_) | RecipeKind::Simple => ("", ""),
RecipeKind::Component(_) | RecipeKind::Simple => {
(Cow::Borrowed(""), Cow::Borrowed(""))
},
};
primary_slot_widget
.with_tooltip(
self.tooltip_manager,
tooltip_title,
tooltip_desc,
&tooltip_title,
&tooltip_desc,
&tabs_tooltip,
TEXT_COLOR,
)
@ -1050,13 +1052,13 @@ impl<'a> Widget for Crafting<'a> {
self.localized_strings
.get("hud.crafting.mod_comp_sec_slot_desc"),
),
RecipeKind::Simple => ("", ""),
RecipeKind::Simple => (Cow::Borrowed(""), Cow::Borrowed("")),
};
secondary_slot_widget
.with_tooltip(
self.tooltip_manager,
tooltip_title,
tooltip_desc,
&tooltip_title,
&tooltip_desc,
&tabs_tooltip,
TEXT_COLOR,
)
@ -1211,7 +1213,7 @@ impl<'a> Widget for Crafting<'a> {
== recipe.craft_sprite,
)
} else {
Text::new(self.localized_strings.get("hud.crafting.modular_desc"))
Text::new(&self.localized_strings.get("hud.crafting.modular_desc"))
.mid_top_with_margin_on(state.ids.modular_art, -18.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(13))
@ -1306,7 +1308,7 @@ impl<'a> Widget for Crafting<'a> {
};
icon.with_tooltip(
self.tooltip_manager,
self.localized_strings.get(crafting_tab.name_key()),
&self.localized_strings.get(crafting_tab.name_key()),
"",
&tabs_tooltip,
TEXT_COLOR,
@ -1343,7 +1345,7 @@ impl<'a> Widget for Crafting<'a> {
.then_some(self.imgs.button_press)
.unwrap_or(self.imgs.button),
)
.label(self.localized_strings.get("hud.crafting.craft"))
.label(&self.localized_strings.get("hud.crafting.craft"))
.label_y(conrod_core::position::Relative::Scalar(1.0))
.label_color(can_perform.then_some(TEXT_COLOR).unwrap_or(TEXT_GRAY_COLOR))
.label_font_size(self.fonts.cyri.scale(12))
@ -1382,7 +1384,8 @@ impl<'a> Widget for Crafting<'a> {
// Crafting Station Info
if recipe.craft_sprite.is_some() {
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.crafting.req_crafting_station"),
)
.font_id(self.fonts.cyri.conrod_id)
@ -1433,7 +1436,7 @@ impl<'a> Widget for Crafting<'a> {
Some(SpriteKind::DismantlingBench) => "hud.crafting.salvaging_station",
_ => "",
};
Text::new(self.localized_strings.get(station_name))
Text::new(&self.localized_strings.get(station_name))
.right_from(state.ids.req_station_img, 10.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(14))
@ -1495,7 +1498,7 @@ impl<'a> Widget for Crafting<'a> {
let num_ingredients = ingredients.len();
if num_ingredients > 0 {
Text::new(self.localized_strings.get("hud.crafting.ingredients"))
Text::new(&self.localized_strings.get("hud.crafting.ingredients"))
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(18))
.color(TEXT_COLOR)
@ -1691,7 +1694,7 @@ impl<'a> Widget for Crafting<'a> {
} else {
state.ids.ingredient_frame[i - 1]
};
Text::new(self.localized_strings.get("hud.crafting.tool_cata"))
Text::new(&self.localized_strings.get("hud.crafting.tool_cata"))
.down_from(ref_widget, 20.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(14))
@ -1741,7 +1744,7 @@ impl<'a> Widget for Crafting<'a> {
}
} else if *sel_crafting_tab == CraftingTab::Dismantle {
// Title
Text::new(self.localized_strings.get("hud.crafting.dismantle_title"))
Text::new(&self.localized_strings.get("hud.crafting.dismantle_title"))
.mid_top_with_margin_on(state.ids.align_ing, 0.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(24))
@ -1765,7 +1768,8 @@ impl<'a> Widget for Crafting<'a> {
// Explanation
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.crafting.dismantle_explanation"),
)
.mid_bottom_with_margin_on(state.ids.dismantle_img, -60.0)
@ -1807,7 +1811,7 @@ impl<'a> Widget for Crafting<'a> {
events.push(Event::SearchRecipe(Some(string)));
}
} else {
Text::new(self.localized_strings.get("hud.crafting.recipes"))
Text::new(&self.localized_strings.get("hud.crafting.recipes"))
.mid_top_with_margin_on(state.ids.align_rec, -22.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(14))

File diff suppressed because it is too large Load Diff

View File

@ -87,7 +87,7 @@ impl<'a> Widget for EscMenu<'a> {
.w_h(210.0, 50.0)
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.label(self.localized_strings.get("common.resume"))
.label(&self.localized_strings.get("common.resume"))
.label_y(conrod_core::position::Relative::Scalar(3.0))
.label_color(TEXT_COLOR)
.label_font_size(self.fonts.cyri.scale(20))
@ -104,7 +104,7 @@ impl<'a> Widget for EscMenu<'a> {
.w_h(210.0, 50.0)
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.label(self.localized_strings.get("common.settings"))
.label(&self.localized_strings.get("common.settings"))
.label_y(conrod_core::position::Relative::Scalar(3.0))
.label_color(TEXT_COLOR)
.label_font_size(self.fonts.cyri.scale(20))
@ -120,7 +120,7 @@ impl<'a> Widget for EscMenu<'a> {
.w_h(210.0, 50.0)
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.label(self.localized_strings.get("common.controls"))
.label(&self.localized_strings.get("common.controls"))
.label_y(conrod_core::position::Relative::Scalar(3.0))
.label_color(TEXT_COLOR)
.label_font_size(self.fonts.cyri.scale(20))
@ -136,7 +136,7 @@ impl<'a> Widget for EscMenu<'a> {
.w_h(210.0, 50.0)
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.label(self.localized_strings.get("common.characters"))
.label(&self.localized_strings.get("common.characters"))
.label_y(conrod_core::position::Relative::Scalar(3.0))
.label_color(TEXT_COLOR)
.label_font_size(self.fonts.cyri.scale(20))
@ -152,7 +152,7 @@ impl<'a> Widget for EscMenu<'a> {
.w_h(210.0, 50.0)
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.label(self.localized_strings.get("esc_menu.logout"))
.label(&self.localized_strings.get("esc_menu.logout"))
.label_y(conrod_core::position::Relative::Scalar(3.0))
.label_color(TEXT_COLOR)
.label_font_size(self.fonts.cyri.scale(20))
@ -168,7 +168,7 @@ impl<'a> Widget for EscMenu<'a> {
.w_h(210.0, 50.0)
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.label(self.localized_strings.get("esc_menu.quit_game"))
.label(&self.localized_strings.get("esc_menu.quit_game"))
.label_y(conrod_core::position::Relative::Scalar(3.0))
.label_color(TEXT_COLOR)
.label_font_size(self.fonts.cyri.scale(20))

View File

@ -428,7 +428,7 @@ impl<'a> Widget for Group<'a> {
}
if health.is_dead {
// Death Text
Text::new(self.localized_strings.get("hud.group.dead"))
Text::new(&self.localized_strings.get("hud.group.dead"))
.mid_top_with_margin_on(state.ids.member_panels_bg[i], 1.0)
.font_size(20)
.font_id(self.fonts.cyri.conrod_id)
@ -575,7 +575,7 @@ impl<'a> Widget for Group<'a> {
.middle_of(id)
.with_tooltip(
self.tooltip_manager,
title,
&title,
&desc,
&buffs_tooltip,
if buff.is_buff {
@ -611,7 +611,7 @@ impl<'a> Widget for Group<'a> {
.color(Some(UI_HIGHLIGHT_0))
.set(state.ids.member_panels_frame[i], ui);
// Panel Text
Text::new(self.localized_strings.get("hud.group.out_of_range"))
Text::new(&self.localized_strings.get("hud.group.out_of_range"))
.mid_top_with_margin_on(state.ids.member_panels_bg[i], 3.0)
.font_size(16)
.font_id(self.fonts.cyri.conrod_id)
@ -630,7 +630,7 @@ impl<'a> Widget for Group<'a> {
.press_image(self.imgs.button)
.label_color(TEXT_COLOR_GREY)
.image_color(TEXT_COLOR_GREY)
.label(self.localized_strings.get("hud.group.add_friend"))
.label(&self.localized_strings.get("hud.group.add_friend"))
.label_font_id(self.fonts.cyri.conrod_id)
.label_font_size(self.fonts.cyri.scale(10))
.set(state.ids.btn_friend, ui)
@ -641,7 +641,7 @@ impl<'a> Widget for Group<'a> {
.bottom_right_with_margins_on(state.ids.bg, 5.0, 5.0)
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.label(self.localized_strings.get("hud.group.leave"))
.label(&self.localized_strings.get("hud.group.leave"))
.label_color(TEXT_COLOR)
.label_font_id(self.fonts.cyri.conrod_id)
.label_font_size(self.fonts.cyri.scale(10))
@ -659,7 +659,7 @@ impl<'a> Widget for Group<'a> {
.mid_bottom_with_margin_on(state.ids.btn_friend, -27.0)
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.label(self.localized_strings.get("hud.group.assign_leader"))
.label(&self.localized_strings.get("hud.group.assign_leader"))
.label_color(if state.selected_member.is_some() {
TEXT_COLOR
} else {
@ -682,7 +682,7 @@ impl<'a> Widget for Group<'a> {
.mid_bottom_with_margin_on(state.ids.btn_leader, -27.0)
.hover_image(self.imgs.button)
.press_image(self.imgs.button)
.label(self.localized_strings.get("hud.group.link_group"))
.label(&self.localized_strings.get("hud.group.link_group"))
.hover_image(self.imgs.button)
.press_image(self.imgs.button)
.label_color(TEXT_COLOR_GREY)
@ -698,7 +698,7 @@ impl<'a> Widget for Group<'a> {
.down_from(state.ids.btn_link, 5.0)
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.label(self.localized_strings.get("hud.group.kick"))
.label(&self.localized_strings.get("hud.group.kick"))
.label_color(if state.selected_member.is_some() {
TEXT_COLOR
} else {
@ -792,14 +792,18 @@ impl<'a> Widget for Group<'a> {
let name = uid_to_name_text(invite_uid, self.client);
let invite_text = match kind {
InviteKind::Group => self
.localized_strings
.get("hud.group.invite_to_join")
.replace("{name}", &name),
InviteKind::Trade => self
.localized_strings
.get("hud.group.invite_to_trade")
.replace("{name}", &name),
InviteKind::Group => self.localized_strings.get_msg_ctx(
"hud-group-invite_to_join",
&i18n::fluent_args! {
"name" => name,
},
),
InviteKind::Trade => self.localized_strings.get_msg_ctx(
"hud-group-invite_to_trade",
&i18n::fluent_args! {
"name" => &name,
},
),
};
Text::new(&invite_text)
.mid_top_with_margin_on(state.ids.bg, 5.0)

View File

@ -22,6 +22,7 @@ use conrod_core::{
};
use i18n::Localization;
use specs::{saveload::MarkerAllocator, WorldExt};
use std::borrow::Cow;
use vek::*;
use winit::event::MouseButton;
@ -277,7 +278,7 @@ impl<'a> Widget for Map<'a> {
.set(state.ids.icon, ui);
// Map Title
Text::new(i18n.get("hud.map.map_title"))
Text::new(&i18n.get("hud.map.map_title"))
.mid_top_with_margin_on(state.ids.frame, 3.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(29))
@ -285,7 +286,7 @@ impl<'a> Widget for Map<'a> {
.set(state.ids.map_title, ui);
// Questlog Title
Text::new(i18n.get("hud.map.qlog_title"))
Text::new(&i18n.get("hud.map.qlog_title"))
.mid_top_with_margin_on(state.ids.qlog_align, 6.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(21))
@ -505,7 +506,7 @@ impl<'a> Widget for Map<'a> {
{
events.push(Event::SettingsChange(MapShowDifficulty(!show_difficulty)));
}
Text::new(i18n.get("hud.map.difficulty"))
Text::new(&i18n.get("hud.map.difficulty"))
.right_from(state.ids.show_difficulty_box, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -539,7 +540,7 @@ impl<'a> Widget for Map<'a> {
{
events.push(Event::SettingsChange(MapShowTowns(!show_towns)));
}
Text::new(i18n.get("hud.map.towns"))
Text::new(&i18n.get("hud.map.towns"))
.right_from(state.ids.show_towns_box, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -573,7 +574,7 @@ impl<'a> Widget for Map<'a> {
{
events.push(Event::SettingsChange(MapShowCastles(!show_castles)));
}
Text::new(i18n.get("hud.map.castles"))
Text::new(&i18n.get("hud.map.castles"))
.right_from(state.ids.show_castles_box, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -607,7 +608,7 @@ impl<'a> Widget for Map<'a> {
{
events.push(Event::SettingsChange(MapShowDungeons(!show_dungeons)));
}
Text::new(i18n.get("hud.map.dungeons"))
Text::new(&i18n.get("hud.map.dungeons"))
.right_from(state.ids.show_dungeons_box, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -641,7 +642,7 @@ impl<'a> Widget for Map<'a> {
{
events.push(Event::SettingsChange(MapShowCaves(!show_caves)));
}
Text::new(i18n.get("hud.map.caves"))
Text::new(&i18n.get("hud.map.caves"))
.right_from(state.ids.show_caves_box, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -675,7 +676,7 @@ impl<'a> Widget for Map<'a> {
{
events.push(Event::SettingsChange(MapShowTrees(!show_trees)));
}
Text::new(i18n.get("hud.map.trees"))
Text::new(&i18n.get("hud.map.trees"))
.right_from(state.ids.show_trees_box, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -709,7 +710,7 @@ impl<'a> Widget for Map<'a> {
{
events.push(Event::SettingsChange(MapShowBiomes(!show_biomes)));
}
Text::new(i18n.get("hud.map.biomes"))
Text::new(&i18n.get("hud.map.biomes"))
.right_from(state.ids.show_biomes_box, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -743,7 +744,7 @@ impl<'a> Widget for Map<'a> {
{
events.push(Event::SettingsChange(MapShowPeaks(!show_peaks)));
}
Text::new(i18n.get("hud.map.peaks"))
Text::new(&i18n.get("hud.map.peaks"))
.right_from(state.ids.show_peaks_box, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -780,7 +781,7 @@ impl<'a> Widget for Map<'a> {
{
events.push(Event::SettingsChange(MapShowVoxelMap(!show_voxel_map)));
}
Text::new(i18n.get("hud.map.voxel_map"))
Text::new(&i18n.get("hud.map.voxel_map"))
.right_from(state.ids.show_voxel_map_box, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -866,37 +867,43 @@ impl<'a> Widget for Map<'a> {
None => continue,
};
let title = site.name.as_deref().unwrap_or_else(|| match &site.kind {
SiteKind::Town => i18n.get("hud.map.town"),
SiteKind::Dungeon { .. } => i18n.get("hud.map.dungeon"),
SiteKind::Castle => i18n.get("hud.map.castle"),
SiteKind::Cave => i18n.get("hud.map.cave"),
SiteKind::Tree => i18n.get("hud.map.tree"),
SiteKind::Gnarling => i18n.get("hud.map.gnarling"),
});
let title =
site.name
.as_deref()
.map(Cow::Borrowed)
.unwrap_or_else(|| match &site.kind {
SiteKind::Town => i18n.get("hud.map.town"),
SiteKind::Dungeon { .. } => i18n.get("hud.map.dungeon"),
SiteKind::Castle => i18n.get("hud.map.castle"),
SiteKind::Cave => i18n.get("hud.map.cave"),
SiteKind::Tree => i18n.get("hud.map.tree"),
SiteKind::Gnarling => i18n.get("hud.map.gnarling"),
});
let (difficulty, desc) = match &site.kind {
SiteKind::Town => (None, i18n.get("hud.map.town").to_string()),
SiteKind::Town => (None, i18n.get("hud.map.town")),
SiteKind::Dungeon { difficulty } => {
if *difficulty < 5 {
(
Some(*difficulty),
i18n.get("hud.map.difficulty_dungeon")
.replace("{difficulty}", (difficulty + 1).to_string().as_str()),
i18n.get_msg_ctx("hud-map-difficulty_dungeon", &i18n::fluent_args! {
"difficulty" => difficulty + 1
}),
)
} else {
(
Some(*difficulty),
i18n.get("hud.map.difficulty_dungeon")
.replace("{difficulty}", (difficulty).to_string().as_str()),
i18n.get_msg_ctx("hud-map-difficulty_dungeon", &i18n::fluent_args! {
"difficulty" => difficulty
}),
)
}
},
SiteKind::Castle => (None, i18n.get("hud.map.castle").to_string()),
SiteKind::Cave => (None, i18n.get("hud.map.cave").to_string()),
SiteKind::Tree => (None, i18n.get("hud.map.tree").to_string()),
SiteKind::Gnarling => (Some(0), i18n.get("hud.map.gnarling").to_string()),
SiteKind::Castle => (None, i18n.get("hud.map.castle")),
SiteKind::Cave => (None, i18n.get("hud.map.cave")),
SiteKind::Tree => (None, i18n.get("hud.map.tree")),
SiteKind::Gnarling => (Some(0), i18n.get("hud.map.gnarling")),
};
let desc = desc + &get_site_economy(site_rich);
let desc = desc.into_owned() + &get_site_economy(site_rich);
let site_btn = Button::image(match &site.kind {
SiteKind::Town => self.imgs.mmap_site_town,
SiteKind::Castle => self.imgs.mmap_site_castle,
@ -930,7 +937,7 @@ impl<'a> Widget for Map<'a> {
.image_color(UI_HIGHLIGHT_0.alpha(fade))
.with_tooltip(
self.tooltip_manager,
title,
&title,
&desc,
&site_tooltip,
match &site.kind {
@ -1267,12 +1274,14 @@ impl<'a> Widget for Map<'a> {
.floating(true)
.with_tooltip(
self.tooltip_manager,
i18n.get("hud.map.marked_location"),
&i18n.get("hud.map.marked_location"),
&format!(
"X: {}, Y: {}\n\n{}",
lm.x as i32,
lm.y as i32,
i18n.get("hud.map.placed_by").replace("{name}", name),
i18n.get_msg_ctx("hud-map-placed_by", &i18n::fluent_args! {
"name" => name
}),
),
&site_tooltip,
TEXT_VELORITE,
@ -1307,7 +1316,7 @@ impl<'a> Widget for Map<'a> {
.floating(true)
.with_tooltip(
self.tooltip_manager,
i18n.get("hud.map.marked_location"),
&i18n.get("hud.map.marked_location"),
&format!(
"X: {}, Y: {}\n\n{}",
lm.x as i32,
@ -1380,7 +1389,7 @@ impl<'a> Widget for Map<'a> {
} else {
self.imgs.button
})
.label(i18n.get("hud.map.recenter"))
.label(&i18n.get("hud.map.recenter"))
.label_y(position::Relative::Scalar(1.0))
.label_color(if recenter {
TEXT_COLOR
@ -1405,7 +1414,7 @@ impl<'a> Widget for Map<'a> {
.w_h(icon_size.x, icon_size.y)
.color(Some(UI_HIGHLIGHT_0))
.set(state.ids.drag_ico, ui);
Text::new(i18n.get("hud.map.drag"))
Text::new(&i18n.get("hud.map.drag"))
.right_from(state.ids.drag_ico, 5.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -1417,7 +1426,7 @@ impl<'a> Widget for Map<'a> {
.w_h(icon_size.x, icon_size.y)
.color(Some(UI_HIGHLIGHT_0))
.set(state.ids.zoom_ico, ui);
Text::new(i18n.get("hud.map.zoom"))
Text::new(&i18n.get("hud.map.zoom"))
.right_from(state.ids.zoom_ico, 5.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -1433,7 +1442,7 @@ impl<'a> Widget for Map<'a> {
.color(TEXT_COLOR)
.set(state.ids.waypoint_binding_txt, ui);
Text::new(i18n.get("hud.map.mid_click"))
Text::new(&i18n.get("hud.map.mid_click"))
.right_from(state.ids.waypoint_binding_txt, 5.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -1449,7 +1458,7 @@ impl<'a> Widget for Map<'a> {
.bottom_right_with_margins_on(state.ids.map_layers[0], -36.0, 0.0)
.with_tooltip(
self.tooltip_manager,
i18n.get("hud.map.change_map_mode"),
&i18n.get("hud.map.change_map_mode"),
"",
&site_tooltip,
TEXT_COLOR,
@ -1473,8 +1482,8 @@ impl<'a> Widget for Map<'a> {
.left_from(state.ids.map_mode_btn, 5.0)
.with_tooltip(
self.tooltip_manager,
i18n.get("hud.map.toggle_minimap_voxel"),
i18n.get("hud.map.zoom_minimap_explanation"),
&i18n.get("hud.map.toggle_minimap_voxel"),
&i18n.get("hud.map.zoom_minimap_explanation"),
&site_tooltip,
TEXT_COLOR,
)

View File

@ -1555,10 +1555,11 @@ impl Hud {
if floater.exp_change > 0 {
let xp_pool = &floater.xp_pools;
// Don't show 0 Exp
let exp_string = &i18n
.get("hud.sct.experience")
.replace("{amount}", &floater.exp_change.max(1).to_string());
let exp_string =
&i18n.get_msg_ctx("hud-sct-experience", &i18n::fluent_args! {
// Don't show 0 Exp
"amount" => &floater.exp_change.max(1),
});
Text::new(exp_string)
.font_size(font_size_xp)
.font_id(self.fonts.cyri.conrod_id)
@ -1636,13 +1637,13 @@ impl Hud {
.mid_top_with_margin_on(self.ids.player_rank_up, fontsize.1)
.set(self.ids.player_rank_up_txt_number, ui_widgets);
// Static "New Rank!" text
Text::new(i18n.get("hud.rank_up"))
Text::new(&i18n.get("hud.rank_up"))
.font_size(40)
.font_id(self.fonts.cyri.conrod_id)
.color(Color::Rgba(0.0, 0.0, 0.0, fade))
.mid_bottom_with_margin_on(self.ids.player_rank_up, 20.0)
.set(self.ids.player_rank_up_txt_0_bg, ui_widgets);
Text::new(i18n.get("hud.rank_up"))
Text::new(&i18n.get("hud.rank_up"))
.font_size(40)
.font_id(self.fonts.cyri.conrod_id)
.color(Color::Rgba(1.0, 1.0, 1.0, fade))
@ -1658,15 +1659,15 @@ impl Hud {
Weapon(ToolKind::Bow) => i18n.get("common.weapons.bow"),
Weapon(ToolKind::Staff) => i18n.get("common.weapons.staff"),
Weapon(ToolKind::Pick) => i18n.get("common.tool.mining"),
_ => "Unknown",
_ => Cow::Borrowed("Unknown"),
};
Text::new(skill)
Text::new(&skill)
.font_size(20)
.font_id(self.fonts.cyri.conrod_id)
.color(Color::Rgba(0.0, 0.0, 0.0, fade))
.mid_top_with_margin_on(self.ids.player_rank_up, 45.0)
.set(self.ids.player_rank_up_txt_1_bg, ui_widgets);
Text::new(skill)
Text::new(&skill)
.font_size(20)
.font_id(self.fonts.cyri.conrod_id)
.color(Color::Rgba(1.0, 1.0, 1.0, fade))
@ -1716,7 +1717,7 @@ impl Hud {
1.0
};
Text::new(i18n.get("hud.sct.block"))
Text::new(&i18n.get("hud.sct.block"))
.font_size(font_size)
.font_id(self.fonts.cyri.conrod_id)
.color(Color::Rgba(0.0, 0.0, 0.0, fade))
@ -1725,7 +1726,7 @@ impl Hud {
ui_widgets.win_h * (-0.3) + y - 3.0,
)
.set(player_sct_bg_id, ui_widgets);
Text::new(i18n.get("hud.sct.block"))
Text::new(&i18n.get("hud.sct.block"))
.font_size(font_size)
.font_id(self.fonts.cyri.conrod_id)
.color(Color::Rgba(0.69, 0.82, 0.88, fade))
@ -1924,7 +1925,7 @@ impl Hud {
let over_pos = pos + Vec3::unit_z() * 1.5;
overitem::Overitem::new(
i18n.get("hud.crafting.campfire").into(),
i18n.get("hud.crafting.campfire"),
overitem::TEXT_COLOR,
pos.distance_squared(player_pos),
&self.fonts,
@ -2550,11 +2551,12 @@ impl Hud {
if global_state.settings.interface.toggle_hotkey_hints {
// Help Window
if let Some(help_key) = global_state.settings.controls.get_binding(GameInput::Help) {
Text::new(
&i18n
.get("hud.press_key_to_show_keybindings_fmt")
.replace("{key}", help_key.display_string(key_layout).as_str()),
)
Text::new(&i18n.get_msg_ctx(
"hud-press_key_to_show_keybindings_fmt",
&i18n::fluent_args! {
"key" => help_key.display_string(key_layout),
},
))
.color(TEXT_COLOR)
.bottom_left_with_margins_on(ui_widgets.window, 210.0, 10.0)
.font_id(self.fonts.cyri.conrod_id)
@ -2567,9 +2569,11 @@ impl Hud {
.controls
.get_binding(GameInput::ToggleLantern)
{
Text::new(&i18n.get("hud.press_key_to_toggle_lantern_fmt").replace(
"{key}",
toggle_lantern_key.display_string(key_layout).as_str(),
Text::new(&i18n.get_msg_ctx(
"hud-press_key_to_toggle_lantern_fmt",
&i18n::fluent_args! {
"key" => toggle_lantern_key.display_string(key_layout),
},
))
.color(TEXT_COLOR)
.up_from(self.ids.help_info, 2.0)
@ -3289,9 +3293,9 @@ impl Hud {
.get_binding(GameInput::FreeLook)
{
if self.show.free_look {
let msg = i18n
.get("hud.free_look_indicator")
.replace("{key}", freelook_key.display_string(key_layout).as_str());
let msg = i18n.get_msg_ctx("hud-free_look_indicator", &i18n::fluent_args! {
"key" => freelook_key.display_string(key_layout),
});
Text::new(&msg)
.color(TEXT_BG)
.mid_top_with_margin_on(ui_widgets.window, indicator_offset)
@ -3310,14 +3314,14 @@ impl Hud {
// Auto walk indicator
if self.show.auto_walk {
Text::new(i18n.get("hud.auto_walk_indicator"))
Text::new(&i18n.get("hud.auto_walk_indicator"))
.color(TEXT_BG)
.mid_top_with_margin_on(ui_widgets.window, indicator_offset)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(20))
.set(self.ids.auto_walk_bg, ui_widgets);
indicator_offset += 30.0;
Text::new(i18n.get("hud.auto_walk_indicator"))
Text::new(&i18n.get("hud.auto_walk_indicator"))
.color(KILL_COLOR)
.top_left_with_margins_on(self.ids.auto_walk_bg, -1.0, -1.0)
.font_id(self.fonts.cyri.conrod_id)
@ -3332,9 +3336,9 @@ impl Hud {
.get_binding(GameInput::CameraClamp)
{
if self.show.camera_clamp {
let msg = i18n
.get("hud.camera_clamp_indicator")
.replace("{key}", cameraclamp_key.display_string(key_layout).as_str());
let msg = i18n.get_msg_ctx("hud-camera_clamp_indicator", &i18n::fluent_args! {
"key" => cameraclamp_key.display_string(key_layout),
});
Text::new(&msg)
.color(TEXT_BG)
.mid_top_with_margin_on(ui_widgets.window, indicator_offset)
@ -3767,7 +3771,7 @@ impl Hud {
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.bottom_left_with_margins_on(ui_widgets.window, 350.0, 150.0)
.label(i18n.get("hud.tutorial_btn"))
.label(&i18n.get("hud.tutorial_btn"))
.label_font_id(self.fonts.cyri.conrod_id)
.label_font_size(self.fonts.cyri.scale(18))
.label_color(TEXT_COLOR)
@ -3824,27 +3828,27 @@ impl Hud {
.middle_of(ui_widgets.window)
.set(self.ids.quest_bg, ui_widgets);
Text::new(quest_headline)
Text::new(&quest_headline)
.mid_top_with_margin_on(self.ids.quest_bg, 310.0)
.font_size(self.fonts.cyri.scale(30))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_BG)
.set(self.ids.q_headline_bg, ui_widgets);
Text::new(quest_headline)
Text::new(&quest_headline)
.bottom_left_with_margins_on(self.ids.q_headline_bg, 1.0, 1.0)
.font_size(self.fonts.cyri.scale(30))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(self.ids.q_headline, ui_widgets);
Text::new(quest_text)
Text::new(&quest_text)
.mid_top_with_margin_on(self.ids.quest_bg, 360.0)
.w(350.0)
.font_size(self.fonts.cyri.scale(17))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_BG)
.set(self.ids.q_text_bg, ui_widgets);
Text::new(quest_text)
Text::new(&quest_text)
.bottom_left_with_margins_on(self.ids.q_text_bg, 1.0, 1.0)
.w(350.0)
.font_size(self.fonts.cyri.scale(17))
@ -3857,7 +3861,7 @@ impl Hud {
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.mid_bottom_with_margin_on(self.ids.q_text_bg, -80.0)
.label(i18n.get("common.close"))
.label(&i18n.get("common.close"))
.label_font_id(self.fonts.cyri.conrod_id)
.label_font_size(self.fonts.cyri.scale(22))
.label_color(TEXT_COLOR)
@ -3881,14 +3885,14 @@ impl Hud {
)
.color(Some(QUALITY_LEGENDARY))
.set(self.ids.tut_arrow, ui_widgets);
Text::new(i18n.get("hud.tutorial_elements"))
Text::new(&i18n.get("hud.tutorial_elements"))
.mid_top_with_margin_on(self.ids.tut_arrow, -50.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(40))
.color(BLACK)
.floating(true)
.set(self.ids.tut_arrow_txt_bg, ui_widgets);
Text::new(i18n.get("hud.tutorial_elements"))
Text::new(&i18n.get("hud.tutorial_elements"))
.bottom_right_with_margins_on(self.ids.tut_arrow_txt_bg, 1.0, 1.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(40))
@ -4587,7 +4591,7 @@ pub fn get_buff_image(buff: BuffKind, imgs: &Imgs) -> conrod_core::image::Id {
}
}
pub fn get_buff_title(buff: BuffKind, localized_strings: &Localization) -> &str {
pub fn get_buff_title(buff: BuffKind, localized_strings: &Localization) -> Cow<str> {
match buff {
// Buffs
BuffKind::Regeneration { .. } => localized_strings.get("buff.title.heal"),
@ -4615,37 +4619,29 @@ pub fn get_buff_title(buff: BuffKind, localized_strings: &Localization) -> &str
pub fn get_buff_desc(buff: BuffKind, data: BuffData, localized_strings: &Localization) -> Cow<str> {
match buff {
// Buffs
BuffKind::Regeneration { .. } => Cow::Borrowed(localized_strings.get("buff.desc.heal")),
BuffKind::Saturation { .. } => Cow::Borrowed(localized_strings.get("buff.desc.saturation")),
BuffKind::Potion { .. } => Cow::Borrowed(localized_strings.get("buff.desc.potion")),
BuffKind::CampfireHeal { .. } => Cow::Owned(
localized_strings
.get("buff.desc.campfire_heal")
.replace("{rate}", &format!("{:.0}", data.strength * 100.0)),
),
BuffKind::IncreaseMaxHealth { .. } => {
Cow::Borrowed(localized_strings.get("buff.desc.IncreaseMaxHealth"))
BuffKind::Regeneration { .. } => localized_strings.get("buff.desc.heal"),
BuffKind::Saturation { .. } => localized_strings.get("buff.desc.saturation"),
BuffKind::Potion { .. } => localized_strings.get("buff.desc.potion"),
BuffKind::CampfireHeal { .. } => {
localized_strings.get_msg_ctx("buff-desc-campfire_heal", &i18n::fluent_args! {
"rate" => data.strength * 100.0
})
},
BuffKind::IncreaseMaxEnergy { .. } => {
Cow::Borrowed(localized_strings.get("buff.desc.IncreaseMaxEnergy"))
},
BuffKind::Invulnerability => {
Cow::Borrowed(localized_strings.get("buff.desc.invulnerability"))
},
BuffKind::ProtectingWard => {
Cow::Borrowed(localized_strings.get("buff.desc.protectingward"))
},
BuffKind::Frenzied => Cow::Borrowed(localized_strings.get("buff.desc.frenzied")),
BuffKind::Hastened => Cow::Borrowed(localized_strings.get("buff.desc.hastened")),
BuffKind::IncreaseMaxHealth { .. } => localized_strings.get("buff.desc.IncreaseMaxHealth"),
BuffKind::IncreaseMaxEnergy { .. } => localized_strings.get("buff.desc.IncreaseMaxEnergy"),
BuffKind::Invulnerability => localized_strings.get("buff.desc.invulnerability"),
BuffKind::ProtectingWard => localized_strings.get("buff.desc.protectingward"),
BuffKind::Frenzied => localized_strings.get("buff.desc.frenzied"),
BuffKind::Hastened => localized_strings.get("buff.desc.hastened"),
// Debuffs
BuffKind::Bleeding { .. } => Cow::Borrowed(localized_strings.get("buff.desc.bleed")),
BuffKind::Cursed { .. } => Cow::Borrowed(localized_strings.get("buff.desc.cursed")),
BuffKind::Burning { .. } => Cow::Borrowed(localized_strings.get("buff.desc.burn")),
BuffKind::Crippled { .. } => Cow::Borrowed(localized_strings.get("buff.desc.crippled")),
BuffKind::Frozen { .. } => Cow::Borrowed(localized_strings.get("buff.desc.frozen")),
BuffKind::Wet { .. } => Cow::Borrowed(localized_strings.get("buff.desc.wet")),
BuffKind::Ensnared { .. } => Cow::Borrowed(localized_strings.get("buff.desc.ensnared")),
BuffKind::Poisoned { .. } => Cow::Borrowed(localized_strings.get("buff.desc.poisoned")),
BuffKind::Bleeding { .. } => localized_strings.get("buff.desc.bleed"),
BuffKind::Cursed { .. } => localized_strings.get("buff.desc.cursed"),
BuffKind::Burning { .. } => localized_strings.get("buff.desc.burn"),
BuffKind::Crippled { .. } => localized_strings.get("buff.desc.crippled"),
BuffKind::Frozen { .. } => localized_strings.get("buff.desc.frozen"),
BuffKind::Wet { .. } => localized_strings.get("buff.desc.wet"),
BuffKind::Ensnared { .. } => localized_strings.get("buff.desc.ensnared"),
BuffKind::Poisoned { .. } => localized_strings.get("buff.desc.poisoned"),
}
}
@ -4671,7 +4667,7 @@ pub fn get_sprite_desc(sprite: SpriteKind, localized_strings: &Localization) ->
| SpriteKind::DungeonChest5 => "common.sprite.chest",
sprite => return Some(Cow::Owned(format!("{:?}", sprite))),
};
Some(Cow::Borrowed(localized_strings.get(i18n_key)))
Some(localized_strings.get(i18n_key))
}
pub fn get_buff_time(buff: BuffInfo) -> String {

View File

@ -230,22 +230,21 @@ impl<'a> Widget for Overitem<'a> {
let text = match collect_failed_data.reason {
HudCollectFailedReason::InventoryFull => {
self.localized_strings.get("hud.inventory_full").to_string()
self.localized_strings.get("hud.inventory_full")
},
HudCollectFailedReason::LootOwned { owner, expiry_secs } => {
let owner_name = match owner {
HudLootOwner::Name(name) => name,
HudLootOwner::Group => {
self.localized_strings.get("hud.another_group").to_string()
},
HudLootOwner::Unknown => {
self.localized_strings.get("hud.someone_else").to_string()
},
HudLootOwner::Name(name) => Cow::Owned(name),
HudLootOwner::Group => self.localized_strings.get("hud.another_group"),
HudLootOwner::Unknown => self.localized_strings.get("hud.someone_else"),
};
self.localized_strings
.get("hud.owned_by_for_secs")
.replace("{name}", &owner_name)
.replace("{secs}", format!("{}", expiry_secs).as_str())
self.localized_strings.get_msg_ctx(
"hud-owned_by_for_secs",
&i18n::fluent_args! {
"name" => owner_name,
"secs" => expiry_secs,
},
)
},
};

View File

@ -141,7 +141,7 @@ impl<'a> Widget for Chat<'a> {
.set(state.ids.window_r, ui);
// General Title
Text::new(self.localized_strings.get("hud.settings.general"))
Text::new(&self.localized_strings.get("hud.settings.general"))
.top_left_with_margins_on(state.ids.window, 5.0, 5.0)
.font_size(self.fonts.cyri.scale(18))
.font_id(self.fonts.cyri.conrod_id)
@ -150,7 +150,8 @@ impl<'a> Widget for Chat<'a> {
// Chat Transp
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.background_opacity"),
)
.down_from(state.ids.general_txt, 20.0)
@ -185,7 +186,8 @@ impl<'a> Widget for Chat<'a> {
// "Show character names in chat" toggle button
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.chat_character_name"),
)
.down_from(state.ids.transp_slider, 10.0)
@ -217,7 +219,7 @@ impl<'a> Widget for Chat<'a> {
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.down_from(state.ids.char_name_text, 20.0)
.label(self.localized_strings.get("hud.settings.reset_chat"))
.label(&self.localized_strings.get("hud.settings.reset_chat"))
.label_font_size(self.fonts.cyri.scale(14))
.label_color(TEXT_COLOR)
.label_font_id(self.fonts.cyri.conrod_id)
@ -229,7 +231,7 @@ impl<'a> Widget for Chat<'a> {
}
// Tabs Title
Text::new(self.localized_strings.get("hud.settings.chat_tabs"))
Text::new(&self.localized_strings.get("hud.settings.chat_tabs"))
.top_left_with_margins_on(state.ids.window_r, 5.0, 5.0)
.font_size(self.fonts.cyri.scale(18))
.font_id(self.fonts.cyri.conrod_id)
@ -333,7 +335,7 @@ impl<'a> Widget for Chat<'a> {
{
let mut updated_chat_tab = chat_tab.clone();
Text::new(self.localized_strings.get("hud.settings.label"))
Text::new(&self.localized_strings.get("hud.settings.label"))
.top_left_with_margins_on(state.ids.tab_content_align, 5.0, 25.0)
.font_size(self.fonts.cyri.scale(16))
.font_id(self.fonts.cyri.conrod_id)
@ -361,7 +363,7 @@ impl<'a> Widget for Chat<'a> {
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.w_h(100.0, 30.0)
.label(self.localized_strings.get("hud.settings.delete"))
.label(&self.localized_strings.get("hud.settings.delete"))
.label_font_size(self.fonts.cyri.scale(14))
.label_font_id(self.fonts.cyri.conrod_id)
.label_color(TEXT_COLOR)
@ -416,7 +418,7 @@ impl<'a> Widget for Chat<'a> {
};
//Messages
Text::new(self.localized_strings.get("hud.settings.messages"))
Text::new(&self.localized_strings.get("hud.settings.messages"))
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(16))
.color(TEXT_COLOR)
@ -439,7 +441,7 @@ impl<'a> Widget for Chat<'a> {
updated_chat_tab.filter.message_all = !chat_tab.filter.message_all;
};
Text::new(self.localized_strings.get("hud.settings.show_all"))
Text::new(&self.localized_strings.get("hud.settings.show_all"))
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(16))
.color(TEXT_COLOR)
@ -456,12 +458,10 @@ impl<'a> Widget for Chat<'a> {
updated_chat_tab.filter.message_group = !chat_tab.filter.message_group;
}
create_toggle_text(
self.localized_strings.get("hud.settings.group"),
!chat_tab.filter.message_all,
)
.right_from(state.ids.btn_messages_group, 5.0)
.set(state.ids.text_messages_group, ui);
let group_text = self.localized_strings.get("hud.settings.group");
create_toggle_text(&group_text, !chat_tab.filter.message_all)
.right_from(state.ids.btn_messages_group, 5.0)
.set(state.ids.text_messages_group, ui);
create_toggle_icon(self.imgs.chat_group_small, !chat_tab.filter.message_all)
.right_from(state.ids.text_messages_group, 5.0)
@ -480,12 +480,10 @@ impl<'a> Widget for Chat<'a> {
updated_chat_tab.filter.message_faction = !chat_tab.filter.message_faction;
}
create_toggle_text(
self.localized_strings.get("hud.settings.faction"),
!chat_tab.filter.message_all,
)
.right_from(state.ids.btn_messages_faction, 5.0)
.set(state.ids.text_messages_faction, ui);
let faction_text = self.localized_strings.get("hud.settings.faction");
create_toggle_text(&faction_text, !chat_tab.filter.message_all)
.right_from(state.ids.btn_messages_faction, 5.0)
.set(state.ids.text_messages_faction, ui);
create_toggle_icon(self.imgs.chat_faction_small, !chat_tab.filter.message_all)
.right_from(state.ids.text_messages_faction, 5.0)
@ -501,12 +499,10 @@ impl<'a> Widget for Chat<'a> {
updated_chat_tab.filter.message_world = !chat_tab.filter.message_world;
}
create_toggle_text(
self.localized_strings.get("hud.settings.world"),
!chat_tab.filter.message_all,
)
.right_from(state.ids.btn_messages_world, 5.0)
.set(state.ids.text_messages_world, ui);
let world_text = self.localized_strings.get("hud.settings.world");
create_toggle_text(&world_text, !chat_tab.filter.message_all)
.right_from(state.ids.btn_messages_world, 5.0)
.set(state.ids.text_messages_world, ui);
create_toggle_icon(self.imgs.chat_world_small, !chat_tab.filter.message_all)
.right_from(state.ids.text_messages_world, 5.0)
@ -522,12 +518,10 @@ impl<'a> Widget for Chat<'a> {
updated_chat_tab.filter.message_region = !chat_tab.filter.message_region;
}
create_toggle_text(
self.localized_strings.get("hud.settings.region"),
!chat_tab.filter.message_all,
)
.right_from(state.ids.btn_messages_region, 5.0)
.set(state.ids.text_messages_region, ui);
let region_text = self.localized_strings.get("hud.settings.region");
create_toggle_text(&region_text, !chat_tab.filter.message_all)
.right_from(state.ids.btn_messages_region, 5.0)
.set(state.ids.text_messages_region, ui);
create_toggle_icon(self.imgs.chat_region_small, !chat_tab.filter.message_all)
.right_from(state.ids.text_messages_region, 5.0)
@ -543,19 +537,17 @@ impl<'a> Widget for Chat<'a> {
updated_chat_tab.filter.message_say = !chat_tab.filter.message_say;
}
create_toggle_text(
self.localized_strings.get("hud.settings.say"),
!chat_tab.filter.message_all,
)
.right_from(state.ids.btn_messages_say, 5.0)
.set(state.ids.text_messages_say, ui);
let say_text = self.localized_strings.get("hud.settings.say");
create_toggle_text(&say_text, !chat_tab.filter.message_all)
.right_from(state.ids.btn_messages_say, 5.0)
.set(state.ids.text_messages_say, ui);
create_toggle_icon(self.imgs.chat_say_small, !chat_tab.filter.message_all)
.right_from(state.ids.text_messages_say, 5.0)
.set(state.ids.icon_messages_say, ui);
//Activity
Text::new(self.localized_strings.get("hud.settings.activity"))
Text::new(&self.localized_strings.get("hud.settings.activity"))
.top_left_with_margins_on(state.ids.tab_content_align_r, 0.0, 5.0)
.align_middle_y_of(state.ids.text_messages)
.font_size(self.fonts.cyri.scale(16))
@ -606,7 +598,7 @@ impl<'a> Widget for Chat<'a> {
}
//Death
Text::new(self.localized_strings.get("hud.settings.death"))
Text::new(&self.localized_strings.get("hud.settings.death"))
.down_from(state.ids.list_activity, 20.0)
.font_size(self.fonts.cyri.scale(16))
.font_id(self.fonts.cyri.conrod_id)

View File

@ -126,7 +126,7 @@ impl<'a> Widget for Controls<'a> {
(
self.localized_strings
.get("hud.settings.awaitingkey")
.to_owned(),
.into_owned(),
TEXT_COLOR,
)
} else if let Some(key) = controls.get_binding(game_input) {
@ -147,14 +147,14 @@ impl<'a> Widget for Controls<'a> {
(
self.localized_strings
.get("hud.settings.unbound")
.to_owned(),
.into_owned(),
ERROR_COLOR,
)
};
let loc_key = self
.localized_strings
.get(game_input.get_localization_key());
let text_widget = Text::new(loc_key)
let text_widget = Text::new(&loc_key)
.color(TEXT_COLOR)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(18));
@ -196,7 +196,7 @@ impl<'a> Widget for Controls<'a> {
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.down_from(prev_id, 20.0)
.label(self.localized_strings.get("hud.settings.reset_keybinds"))
.label(&self.localized_strings.get("hud.settings.reset_keybinds"))
.label_font_size(self.fonts.cyri.scale(14))
.label_color(TEXT_COLOR)
.label_font_id(self.fonts.cyri.conrod_id)

View File

@ -124,7 +124,7 @@ impl<'a> Widget for Gameplay<'a> {
let display_clamp = self.global_state.settings.gameplay.camera_clamp_angle;
// Mouse Pan Sensitivity
Text::new(self.localized_strings.get("hud.settings.pan_sensitivity"))
Text::new(&self.localized_strings.get("hud.settings.pan_sensitivity"))
.top_left_with_margins_on(state.ids.window, 10.0, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -156,7 +156,7 @@ impl<'a> Widget for Gameplay<'a> {
.set(state.ids.mouse_pan_value, ui);
// Mouse Zoom Sensitivity
Text::new(self.localized_strings.get("hud.settings.zoom_sensitivity"))
Text::new(&self.localized_strings.get("hud.settings.zoom_sensitivity"))
.down_from(state.ids.mouse_pan_slider, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -189,7 +189,8 @@ impl<'a> Widget for Gameplay<'a> {
// Camera clamp angle
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.camera_clamp_angle"),
)
.down_from(state.ids.mouse_zoom_slider, 10.0)
@ -241,7 +242,8 @@ impl<'a> Widget for Gameplay<'a> {
}
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.invert_scroll_zoom"),
)
.right_from(state.ids.mouse_zoom_invert_button, 10.0)
@ -270,7 +272,8 @@ impl<'a> Widget for Gameplay<'a> {
}
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.invert_mouse_y_axis"),
)
.right_from(state.ids.mouse_y_invert_button, 10.0)
@ -299,7 +302,8 @@ impl<'a> Widget for Gameplay<'a> {
}
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.invert_controller_y_axis"),
)
.right_from(state.ids.controller_y_invert_button, 10.0)
@ -328,7 +332,8 @@ impl<'a> Widget for Gameplay<'a> {
}
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.enable_mouse_smoothing"),
)
.right_from(state.ids.smooth_pan_toggle_button, 10.0)
@ -340,7 +345,8 @@ impl<'a> Widget for Gameplay<'a> {
// Free look behaviour
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.free_look_behavior"),
)
.down_from(state.ids.mouse_zoom_invert_button, 10.0)
@ -376,7 +382,8 @@ impl<'a> Widget for Gameplay<'a> {
// Auto walk behavior
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.auto_walk_behavior"),
)
.down_from(state.ids.mouse_zoom_invert_button, 10.0)
@ -405,7 +412,8 @@ impl<'a> Widget for Gameplay<'a> {
// Camera clamp behavior
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.camera_clamp_behavior"),
)
.down_from(state.ids.free_look_behavior_list, 10.0)
@ -434,7 +442,8 @@ impl<'a> Widget for Gameplay<'a> {
// Player physics behavior
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.player_physics_behavior"),
)
.down_from(state.ids.auto_walk_behavior_list, 10.0)
@ -489,7 +498,8 @@ impl<'a> Widget for Gameplay<'a> {
}
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.stop_auto_walk_on_input"),
)
.right_from(state.ids.stop_auto_walk_on_input_button, 10.0)
@ -517,7 +527,7 @@ impl<'a> Widget for Gameplay<'a> {
));
}
Text::new(self.localized_strings.get("hud.settings.auto_camera"))
Text::new(&self.localized_strings.get("hud.settings.auto_camera"))
.right_from(state.ids.auto_camera_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -541,7 +551,7 @@ impl<'a> Widget for Gameplay<'a> {
events.push(ChangeBowZoom(!self.global_state.settings.gameplay.bow_zoom));
}
Text::new(self.localized_strings.get("hud.settings.bow_zoom"))
Text::new(&self.localized_strings.get("hud.settings.bow_zoom"))
.right_from(state.ids.bow_zoom_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -555,7 +565,7 @@ impl<'a> Widget for Gameplay<'a> {
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.down_from(state.ids.camera_clamp_behavior_list, 12.0)
.label(self.localized_strings.get("hud.settings.reset_gameplay"))
.label(&self.localized_strings.get("hud.settings.reset_gameplay"))
.label_font_size(self.fonts.cyri.scale(14))
.label_color(TEXT_COLOR)
.label_font_id(self.fonts.cyri.conrod_id)

View File

@ -174,7 +174,7 @@ impl<'a> Widget for Interface<'a> {
let crosshair_type = self.global_state.settings.interface.crosshair_type;
let ui_scale = self.global_state.settings.interface.ui_scale;
Text::new(self.localized_strings.get("hud.settings.general"))
Text::new(&self.localized_strings.get("hud.settings.general"))
.top_left_with_margins_on(state.ids.window, 5.0, 5.0)
.font_size(self.fonts.cyri.scale(18))
.font_id(self.fonts.cyri.conrod_id)
@ -197,7 +197,7 @@ impl<'a> Widget for Interface<'a> {
events.push(ToggleHelp(show_help));
}
Text::new(self.localized_strings.get("hud.settings.help_window"))
Text::new(&self.localized_strings.get("hud.settings.help_window"))
.right_from(state.ids.button_help, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -223,7 +223,7 @@ impl<'a> Widget for Interface<'a> {
));
}
Text::new(self.localized_strings.get("hud.settings.loading_tips"))
Text::new(&self.localized_strings.get("hud.settings.loading_tips"))
.right_from(state.ids.load_tips_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -247,7 +247,7 @@ impl<'a> Widget for Interface<'a> {
events.push(ToggleDebug(show_debug));
}
Text::new(self.localized_strings.get("hud.settings.debug_info"))
Text::new(&self.localized_strings.get("hud.settings.debug_info"))
.right_from(state.ids.debug_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -271,7 +271,7 @@ impl<'a> Widget for Interface<'a> {
events.push(ToggleHitboxes(show_hitboxes));
}
Text::new(self.localized_strings.get("hud.settings.show_hitboxes"))
Text::new(&self.localized_strings.get("hud.settings.show_hitboxes"))
.right_from(state.ids.hitboxes_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -295,7 +295,7 @@ impl<'a> Widget for Interface<'a> {
events.push(ToggleChat(show_chat));
}
Text::new(self.localized_strings.get("hud.settings.show_chat"))
Text::new(&self.localized_strings.get("hud.settings.show_chat"))
.right_from(state.ids.chat_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -319,7 +319,7 @@ impl<'a> Widget for Interface<'a> {
events.push(ToggleHotkeyHints(show_hotkey_hints));
}
Text::new(self.localized_strings.get("hud.settings.show_hotkey_hints"))
Text::new(&self.localized_strings.get("hud.settings.show_hotkey_hints"))
.right_from(state.ids.hotkey_hints_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -328,7 +328,7 @@ impl<'a> Widget for Interface<'a> {
.set(state.ids.hotkey_hints_button_label, ui);
// Ui Scale
Text::new(self.localized_strings.get("hud.settings.ui_scale"))
Text::new(&self.localized_strings.get("hud.settings.ui_scale"))
.down_from(state.ids.hotkey_hints_button, 20.0)
.font_size(self.fonts.cyri.scale(18))
.font_id(self.fonts.cyri.conrod_id)
@ -362,7 +362,7 @@ impl<'a> Widget for Interface<'a> {
events.push(UiScale(ScaleChange::ToRelative));
}
Text::new(self.localized_strings.get("hud.settings.relative_scaling"))
Text::new(&self.localized_strings.get("hud.settings.relative_scaling"))
.right_from(state.ids.relative_to_win_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -397,7 +397,7 @@ impl<'a> Widget for Interface<'a> {
events.push(UiScale(ScaleChange::ToAbsolute));
}
Text::new(self.localized_strings.get("hud.settings.custom_scaling"))
Text::new(&self.localized_strings.get("hud.settings.custom_scaling"))
.right_from(state.ids.absolute_scale_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -574,13 +574,13 @@ impl<'a> Widget for Interface<'a> {
.graphics_for(state.ids.ch_3_bg)
.set(state.ids.crosshair_inner_3, ui);
// Crosshair Transparency Text and Slider
Text::new(self.localized_strings.get("hud.settings.crosshair"))
Text::new(&self.localized_strings.get("hud.settings.crosshair"))
.down_from(state.ids.absolute_scale_button, 20.0)
.font_size(self.fonts.cyri.scale(18))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.ch_title, ui);
Text::new(self.localized_strings.get("hud.settings.opacity"))
Text::new(&self.localized_strings.get("hud.settings.opacity"))
.right_from(state.ids.ch_3_bg, 20.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -613,7 +613,7 @@ impl<'a> Widget for Interface<'a> {
.set(state.ids.ch_transp_value, ui);
// Hotbar text
Text::new(self.localized_strings.get("hud.settings.hotbar"))
Text::new(&self.localized_strings.get("hud.settings.hotbar"))
.down_from(state.ids.ch_1_bg, 20.0)
.font_size(self.fonts.cyri.scale(18))
.font_id(self.fonts.cyri.conrod_id)
@ -648,7 +648,7 @@ impl<'a> Widget for Interface<'a> {
ShortcutNumbers::Off => events.push(ToggleShortcutNumbers(ShortcutNumbers::On)),
}
}
Text::new(self.localized_strings.get("hud.settings.toggle_shortcuts"))
Text::new(&self.localized_strings.get("hud.settings.toggle_shortcuts"))
.right_from(state.ids.show_shortcuts_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -676,7 +676,7 @@ impl<'a> Widget for Interface<'a> {
{
events.push(BuffPosition(BuffPosition::Bar))
}
Text::new(self.localized_strings.get("hud.settings.buffs_skillbar"))
Text::new(&self.localized_strings.get("hud.settings.buffs_skillbar"))
.right_from(state.ids.buff_pos_bar_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -703,7 +703,7 @@ impl<'a> Widget for Interface<'a> {
{
events.push(BuffPosition(BuffPosition::Map))
}
Text::new(self.localized_strings.get("hud.settings.buffs_mmap"))
Text::new(&self.localized_strings.get("hud.settings.buffs_mmap"))
.right_from(state.ids.buff_pos_map_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -725,7 +725,8 @@ impl<'a> Widget for Interface<'a> {
*/
// SCT/ Scrolling Combat Text
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.scrolling_combat_text"),
)
.top_left_with_margins_on(state.ids.window_r, 5.0, 5.0)
@ -749,7 +750,8 @@ impl<'a> Widget for Interface<'a> {
events.push(Sct(!self.global_state.settings.interface.sct))
}
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.scrolling_combat_text"),
)
.right_from(state.ids.sct_show_radio, 10.0)
@ -768,7 +770,8 @@ impl<'a> Widget for Interface<'a> {
.sct_inc_dmg_accum_duration;
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.damage_accumulation_duration"),
)
.down_from(state.ids.sct_show_radio, 8.0)
@ -820,7 +823,7 @@ impl<'a> Widget for Interface<'a> {
!self.global_state.settings.interface.sct_inc_dmg,
))
}
Text::new(self.localized_strings.get("hud.settings.incoming_damage"))
Text::new(&self.localized_strings.get("hud.settings.incoming_damage"))
.right_from(state.ids.sct_show_inc_dmg_radio, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -829,7 +832,8 @@ impl<'a> Widget for Interface<'a> {
.set(state.ids.sct_show_inc_dmg_text, ui);
if self.global_state.settings.interface.sct_inc_dmg {
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.incoming_damage_accumulation_duration"),
)
.down_from(state.ids.sct_show_inc_dmg_radio, 8.0)
@ -891,7 +895,7 @@ impl<'a> Widget for Interface<'a> {
!self.global_state.settings.interface.sct_damage_rounding,
))
}
Text::new(self.localized_strings.get("hud.settings.round_damage"))
Text::new(&self.localized_strings.get("hud.settings.round_damage"))
.right_from(state.ids.sct_round_dmg_radio, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -901,7 +905,7 @@ impl<'a> Widget for Interface<'a> {
}
// Speech bubbles
Text::new(self.localized_strings.get("hud.settings.speech_bubble"))
Text::new(&self.localized_strings.get("hud.settings.speech_bubble"))
.down_from(
if self.global_state.settings.interface.sct {
state.ids.sct_round_dmg_radio
@ -932,7 +936,8 @@ impl<'a> Widget for Interface<'a> {
events.push(SpeechBubbleSelf(speech_bubble_self));
}
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.speech_bubble_self"),
)
.right_from(state.ids.speech_bubble_self_button, 10.0)
@ -956,7 +961,8 @@ impl<'a> Widget for Interface<'a> {
events.push(SpeechBubbleDarkMode(speech_bubble_dark_mode));
}
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.speech_bubble_dark_mode"),
)
.right_from(state.ids.speech_bubble_dark_mode_button, 10.0)
@ -979,7 +985,8 @@ impl<'a> Widget for Interface<'a> {
events.push(SpeechBubbleIcon(speech_bubble_icon));
}
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.speech_bubble_icon"),
)
.right_from(state.ids.speech_bubble_icon_button, 10.0)
@ -990,7 +997,7 @@ impl<'a> Widget for Interface<'a> {
// Energybars Numbers
// Hotbar text
Text::new(self.localized_strings.get("hud.settings.energybar_numbers"))
Text::new(&self.localized_strings.get("hud.settings.energybar_numbers"))
.down_from(state.ids.speech_bubble_icon_button, 20.0)
.font_size(self.fonts.cyri.scale(18))
.font_id(self.fonts.cyri.conrod_id)
@ -1020,7 +1027,7 @@ impl<'a> Widget for Interface<'a> {
{
events.push(ToggleBarNumbers(BarNumbers::Off))
}
Text::new(self.localized_strings.get("hud.settings.none"))
Text::new(&self.localized_strings.get("hud.settings.none"))
.right_from(state.ids.show_bar_numbers_none_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -1051,7 +1058,7 @@ impl<'a> Widget for Interface<'a> {
{
events.push(ToggleBarNumbers(BarNumbers::Values))
}
Text::new(self.localized_strings.get("hud.settings.values"))
Text::new(&self.localized_strings.get("hud.settings.values"))
.right_from(state.ids.show_bar_numbers_values_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -1082,7 +1089,7 @@ impl<'a> Widget for Interface<'a> {
{
events.push(ToggleBarNumbers(BarNumbers::Percent))
}
Text::new(self.localized_strings.get("hud.settings.percentages"))
Text::new(&self.localized_strings.get("hud.settings.percentages"))
.right_from(state.ids.show_bar_numbers_percentage_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -1106,7 +1113,7 @@ impl<'a> Widget for Interface<'a> {
events.push(ToggleAlwaysShowBars(always_show_bars));
}
Text::new(self.localized_strings.get("hud.settings.always_show_bars"))
Text::new(&self.localized_strings.get("hud.settings.always_show_bars"))
.right_from(state.ids.always_show_bars_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -1116,7 +1123,8 @@ impl<'a> Widget for Interface<'a> {
// Experience Numbers
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.experience_numbers"),
)
.down_from(state.ids.always_show_bars_button, 20.0)
@ -1144,7 +1152,8 @@ impl<'a> Widget for Interface<'a> {
}
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.accumulate_experience"),
)
.right_from(state.ids.accum_experience_button, 10.0)
@ -1160,7 +1169,7 @@ impl<'a> Widget for Interface<'a> {
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.down_from(state.ids.buff_pos_map_button, 12.0)
.label(self.localized_strings.get("hud.settings.reset_interface"))
.label(&self.localized_strings.get("hud.settings.reset_interface"))
.label_font_size(self.fonts.cyri.scale(14))
.label_color(TEXT_COLOR)
.label_font_id(self.fonts.cyri.conrod_id)

View File

@ -149,7 +149,7 @@ impl<'a> Widget for Language<'a> {
events.push(ToggleEnglishFallback(show_english_fallback));
}
Text::new(self.localized_strings.get("hud.settings.english_fallback"))
Text::new(&self.localized_strings.get("hud.settings.english_fallback"))
.right_from(state.ids.english_fallback_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)

View File

@ -184,7 +184,8 @@ impl<'a> Widget for SettingsWindow<'a> {
.set(state.ids.icon, ui);
// Title
Text::new(
self.localized_strings
&self
.localized_strings
.get(self.show.settings_tab.title_key()),
)
.mid_top_with_margin_on(state.ids.frame, 3.0)
@ -214,6 +215,7 @@ impl<'a> Widget for SettingsWindow<'a> {
});
}
for (i, settings_tab) in SettingsTab::iter().enumerate() {
let tab_name = self.localized_strings.get(settings_tab.name_key());
let mut button = Button::image(if self.show.settings_tab == settings_tab {
self.imgs.selection
} else {
@ -223,7 +225,7 @@ impl<'a> Widget for SettingsWindow<'a> {
.hover_image(self.imgs.selection_hover)
.press_image(self.imgs.selection_press)
.image_color(color::rgba(1.0, 0.82, 0.27, 1.0))
.label(self.localized_strings.get(settings_tab.name_key()))
.label(&tab_name)
.label_font_size(self.fonts.cyri.scale(tab_font_scale))
.label_font_id(self.fonts.cyri.conrod_id)
.label_color(TEXT_COLOR);

View File

@ -108,7 +108,7 @@ impl<'a> Widget for Sound<'a> {
.set(state.ids.window_scrollbar, ui);
// Master Volume
Text::new(self.localized_strings.get("hud.settings.master_volume"))
Text::new(&self.localized_strings.get("hud.settings.master_volume"))
.top_left_with_margins_on(state.ids.window, 10.0, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -144,7 +144,8 @@ impl<'a> Widget for Sound<'a> {
// Master Volume (inactive window)
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.inactive_master_volume_perc"),
)
.down_from(state.ids.master_volume_slider, 10.0)
@ -181,7 +182,7 @@ impl<'a> Widget for Sound<'a> {
.set(state.ids.inactive_master_volume_number, ui);
// Music Volume
Text::new(self.localized_strings.get("hud.settings.music_volume"))
Text::new(&self.localized_strings.get("hud.settings.music_volume"))
.down_from(state.ids.inactive_master_volume_slider, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -217,7 +218,8 @@ impl<'a> Widget for Sound<'a> {
// SFX Volume
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.sound_effect_volume"),
)
.down_from(state.ids.music_volume_slider, 10.0)
@ -253,7 +255,7 @@ impl<'a> Widget for Sound<'a> {
.color(TEXT_COLOR)
.set(state.ids.sfx_volume_number, ui);
// Ambience Volume
Text::new(self.localized_strings.get("hud.settings.ambience_volume"))
Text::new(&self.localized_strings.get("hud.settings.ambience_volume"))
.down_from(state.ids.sfx_volume_slider, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -288,7 +290,7 @@ impl<'a> Widget for Sound<'a> {
.set(state.ids.ambience_volume_number, ui);
// Music frequency (actually gap between songs)
Text::new(self.localized_strings.get("hud.settings.music_frequency"))
Text::new(&self.localized_strings.get("hud.settings.music_frequency"))
.down_from(state.ids.ambience_volume_slider, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -354,8 +356,8 @@ impl<'a> Widget for Sound<'a> {
.w_h(RESET_BUTTONS_WIDTH, RESET_BUTTONS_HEIGHT)
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.down_from(state.ids.music_frequency_slider, 12.0)
.label(self.localized_strings.get("hud.settings.reset_sound"))
.down_from(state.ids.ambience_volume_slider, 12.0)
.label(&self.localized_strings.get("hud.settings.reset_sound"))
.label_font_size(self.fonts.cyri.scale(14))
.label_color(TEXT_COLOR)
.label_font_id(self.fonts.cyri.conrod_id)

View File

@ -279,7 +279,7 @@ impl<'a> Widget for Video<'a> {
}
// View Distance
Text::new(self.localized_strings.get("hud.settings.view_distance"))
Text::new(&self.localized_strings.get("hud.settings.view_distance"))
.top_left_with_margins_on(state.ids.window, 10.0, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -314,7 +314,7 @@ impl<'a> Widget for Video<'a> {
.set(state.ids.vd_value, ui);
// LoD Distance
Text::new(self.localized_strings.get("hud.settings.lod_distance"))
Text::new(&self.localized_strings.get("hud.settings.lod_distance"))
.down_from(state.ids.vd_slider, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -349,7 +349,7 @@ impl<'a> Widget for Video<'a> {
.set(state.ids.ld_value, ui);
// Max FPS
Text::new(self.localized_strings.get("hud.settings.maximum_fps"))
Text::new(&self.localized_strings.get("hud.settings.maximum_fps"))
.down_from(state.ids.ld_slider, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -384,7 +384,7 @@ impl<'a> Widget for Video<'a> {
.set(state.ids.max_fps_value, ui);
// Max Background FPS
Text::new(self.localized_strings.get("hud.settings.background_fps"))
Text::new(&self.localized_strings.get("hud.settings.background_fps"))
.down_from(state.ids.ld_slider, 10.0)
.right_from(state.ids.max_fps_value, 30.0)
.font_size(self.fonts.cyri.scale(14))
@ -432,7 +432,7 @@ impl<'a> Widget for Video<'a> {
let render_mode = &self.global_state.settings.graphics.render_mode;
// Present Mode
Text::new(self.localized_strings.get("hud.settings.present_mode"))
Text::new(&self.localized_strings.get("hud.settings.present_mode"))
.down_from(state.ids.ld_slider, 10.0)
.right_from(state.ids.max_background_fps_value, 30.0)
.font_size(self.fonts.cyri.scale(14))
@ -476,7 +476,7 @@ impl<'a> Widget for Video<'a> {
}
// FOV
Text::new(self.localized_strings.get("hud.settings.fov"))
Text::new(&self.localized_strings.get("hud.settings.fov"))
.down_from(state.ids.max_fps_slider, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -508,7 +508,7 @@ impl<'a> Widget for Video<'a> {
.set(state.ids.fov_value, ui);
// LoD detail
Text::new(self.localized_strings.get("hud.settings.lod_detail"))
Text::new(&self.localized_strings.get("hud.settings.lod_detail"))
.down_from(state.ids.fov_slider, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -546,7 +546,7 @@ impl<'a> Widget for Video<'a> {
.set(state.ids.lod_detail_value, ui);
// Gamma
Text::new(self.localized_strings.get("hud.settings.gamma"))
Text::new(&self.localized_strings.get("hud.settings.gamma"))
.down_from(state.ids.lod_detail_slider, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -597,7 +597,7 @@ impl<'a> Widget for Video<'a> {
events.push(GraphicsChange::ChangeExposure(new_val as f32 / 16.0));
}
Text::new(self.localized_strings.get("hud.settings.exposure"))
Text::new(&self.localized_strings.get("hud.settings.exposure"))
.up_from(state.ids.exposure_slider, 8.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -631,7 +631,7 @@ impl<'a> Widget for Video<'a> {
{
events.push(GraphicsChange::ChangeAmbiance(new_val as f32 / 100.0));
}
Text::new(self.localized_strings.get("hud.settings.ambiance"))
Text::new(&self.localized_strings.get("hud.settings.ambiance"))
.up_from(state.ids.ambiance_slider, 8.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -665,7 +665,8 @@ impl<'a> Widget for Video<'a> {
events.push(GraphicsChange::AdjustSpriteRenderDistance(new_val));
}
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.sprites_view_distance"),
)
.up_from(state.ids.sprite_dist_slider, 8.0)
@ -704,7 +705,8 @@ impl<'a> Widget for Video<'a> {
events.push(GraphicsChange::AdjustFigureLoDRenderDistance(new_val));
}
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.figures_view_distance"),
)
.up_from(state.ids.figure_dist_slider, 8.0)
@ -727,7 +729,7 @@ impl<'a> Widget for Video<'a> {
.set(state.ids.figure_dist_value, ui);
// AaMode
Text::new(self.localized_strings.get("hud.settings.antialiasing_mode"))
Text::new(&self.localized_strings.get("hud.settings.antialiasing_mode"))
.down_from(state.ids.gamma_slider, 8.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -775,7 +777,7 @@ impl<'a> Widget for Video<'a> {
};
let max_bloom = 0.3;
Text::new(self.localized_strings.get("hud.settings.bloom"))
Text::new(&self.localized_strings.get("hud.settings.bloom"))
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
.down_from(state.ids.aa_mode_list, 10.0)
@ -827,7 +829,7 @@ impl<'a> Widget for Video<'a> {
.set(state.ids.bloom_intensity_value, ui);
// Point Glow
Text::new(self.localized_strings.get("hud.settings.point_glow"))
Text::new(&self.localized_strings.get("hud.settings.point_glow"))
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
.down_from(state.ids.aa_mode_list, 10.0)
@ -866,7 +868,7 @@ impl<'a> Widget for Video<'a> {
.set(state.ids.point_glow_value, ui);
// Upscaling factor
Text::new(self.localized_strings.get("hud.settings.upscale_factor"))
Text::new(&self.localized_strings.get("hud.settings.upscale_factor"))
.down_from(state.ids.bloom_intensity_slider, 8.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -909,7 +911,8 @@ impl<'a> Widget for Video<'a> {
// CloudMode
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.cloud_rendering_mode"),
)
.down_from(state.ids.upscale_factor_list, 8.0)
@ -959,7 +962,8 @@ impl<'a> Widget for Video<'a> {
// FluidMode
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.fluid_rendering_mode"),
)
.down_from(state.ids.cloud_mode_list, 8.0)
@ -995,7 +999,8 @@ impl<'a> Widget for Video<'a> {
// LightingMode
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.lighting_rendering_mode"),
)
.down_from(state.ids.fluid_mode_list, 8.0)
@ -1037,7 +1042,8 @@ impl<'a> Widget for Video<'a> {
// ShadowMode
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.shadow_rendering_mode"),
)
.down_from(state.ids.lighting_mode_list, 8.0)
@ -1081,7 +1087,8 @@ impl<'a> Widget for Video<'a> {
if let Some(shadow_map_mode) = shadow_map_mode {
// Display the shadow map mode if selected.
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.shadow_rendering_mode.map.resolution"),
)
.right_from(state.ids.shadow_mode_list, 10.0)
@ -1125,7 +1132,8 @@ impl<'a> Widget for Video<'a> {
// Rain occlusion texture size
// Display the shadow map mode if selected.
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.rain_occlusion.resolution"),
)
.down_from(state.ids.shadow_mode_list, 10.0)
@ -1163,7 +1171,7 @@ impl<'a> Widget for Video<'a> {
.set(state.ids.rain_map_resolution_value, ui);
// GPU Profiler
Text::new(self.localized_strings.get("hud.settings.gpu_profiler"))
Text::new(&self.localized_strings.get("hud.settings.gpu_profiler"))
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
.down_from(state.ids.rain_map_resolution_text, 8.0)
@ -1189,7 +1197,7 @@ impl<'a> Widget for Video<'a> {
}
// Particles
Text::new(self.localized_strings.get("hud.settings.particles"))
Text::new(&self.localized_strings.get("hud.settings.particles"))
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
.down_from(state.ids.gpu_profiler_label, 8.0)
@ -1213,7 +1221,8 @@ impl<'a> Widget for Video<'a> {
// Lossy terrain compression
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.lossy_terrain_compression"),
)
.font_size(self.fonts.cyri.scale(14))
@ -1249,7 +1258,7 @@ impl<'a> Widget for Video<'a> {
}
// Weapon trails
Text::new(self.localized_strings.get("hud.settings.weapon_trails"))
Text::new(&self.localized_strings.get("hud.settings.weapon_trails"))
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
.right_from(state.ids.lossy_terrain_compression_label, 64.0)
@ -1274,7 +1283,7 @@ impl<'a> Widget for Video<'a> {
}
// Disable flashing lights
Text::new(self.localized_strings.get("hud.settings.flashing_lights"))
Text::new(&self.localized_strings.get("hud.settings.flashing_lights"))
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
.down_from(state.ids.particles_label, 25.0)
@ -1297,7 +1306,8 @@ impl<'a> Widget for Video<'a> {
.set(state.ids.flashing_lights_button, ui);
Text::new(
self.localized_strings
&self
.localized_strings
.get("hud.settings.flashing_lights_info"),
)
.font_size(self.fonts.cyri.scale(14))
@ -1330,7 +1340,7 @@ impl<'a> Widget for Video<'a> {
.dedup()
.collect();
Text::new(self.localized_strings.get("hud.settings.resolution"))
Text::new(&self.localized_strings.get("hud.settings.resolution"))
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
.down_from(state.ids.flashing_lights_label, 25.0)
@ -1389,7 +1399,7 @@ impl<'a> Widget for Video<'a> {
.dedup()
.collect();
Text::new(self.localized_strings.get("hud.settings.bit_depth"))
Text::new(&self.localized_strings.get("hud.settings.bit_depth"))
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
.down_from(state.ids.flashing_lights_label, 25.0)
@ -1443,7 +1453,7 @@ impl<'a> Widget for Video<'a> {
.dedup()
.collect();
Text::new(self.localized_strings.get("hud.settings.refresh_rate"))
Text::new(&self.localized_strings.get("hud.settings.refresh_rate"))
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
.down_from(state.ids.flashing_lights_label, 25.0)
@ -1483,7 +1493,7 @@ impl<'a> Widget for Video<'a> {
}
// Fullscreen
Text::new(self.localized_strings.get("hud.settings.fullscreen"))
Text::new(&self.localized_strings.get("hud.settings.fullscreen"))
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
.down_from(state.ids.resolution, 8.0)
@ -1509,7 +1519,7 @@ impl<'a> Widget for Video<'a> {
}
// Fullscreen Mode
Text::new(self.localized_strings.get("hud.settings.fullscreen_mode"))
Text::new(&self.localized_strings.get("hud.settings.fullscreen_mode"))
.down_from(state.ids.fullscreen_label, 8.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -1551,7 +1561,7 @@ impl<'a> Widget for Video<'a> {
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.down_from(state.ids.fullscreen_mode_list, 12.0)
.label(self.localized_strings.get("hud.settings.save_window_size"))
.label(&self.localized_strings.get("hud.settings.save_window_size"))
.label_font_size(self.fonts.cyri.scale(14))
.label_color(TEXT_COLOR)
.label_font_id(self.fonts.cyri.conrod_id)
@ -1575,7 +1585,7 @@ impl<'a> Widget for Video<'a> {
.press_image(self.imgs.button_press)
.down_from(state.ids.fullscreen_mode_list, 12.0)
.right_from(state.ids.save_window_size_button, 12.0)
.label(self.localized_strings.get("hud.settings.reset_graphics"))
.label(&self.localized_strings.get("hud.settings.reset_graphics"))
.label_font_size(self.fonts.cyri.scale(14))
.label_color(TEXT_COLOR)
.label_font_id(self.fonts.cyri.conrod_id)

View File

@ -17,6 +17,7 @@ use crate::{
GlobalState,
};
use i18n::Localization;
use std::borrow::Cow;
use client::{self, Client};
use common::comp::{
@ -329,38 +330,34 @@ impl<'a> Skillbar<'a> {
.controls
.get_binding(GameInput::Respawn)
{
Text::new(localized_strings.get("hud.you_died"))
Text::new(&localized_strings.get("hud.you_died"))
.middle_of(ui.window)
.font_size(self.fonts.cyri.scale(50))
.font_id(self.fonts.cyri.conrod_id)
.color(Color::Rgba(0.0, 0.0, 0.0, 1.0))
.set(state.ids.death_message_1_bg, ui);
Text::new(
&localized_strings
.get("hud.press_key_to_respawn")
.replace("{key}", key.display_string(key_layout).as_str()),
)
.mid_bottom_with_margin_on(state.ids.death_message_1_bg, -120.0)
.font_size(self.fonts.cyri.scale(30))
.font_id(self.fonts.cyri.conrod_id)
.color(Color::Rgba(0.0, 0.0, 0.0, 1.0))
.set(state.ids.death_message_2_bg, ui);
Text::new(localized_strings.get("hud.you_died"))
let respawn_msg =
localized_strings.get_msg_ctx("hud-press_key_to_respawn", &i18n::fluent_args! {
"key" => key.display_string(key_layout)
});
Text::new(&respawn_msg)
.mid_bottom_with_margin_on(state.ids.death_message_1_bg, -120.0)
.font_size(self.fonts.cyri.scale(30))
.font_id(self.fonts.cyri.conrod_id)
.color(Color::Rgba(0.0, 0.0, 0.0, 1.0))
.set(state.ids.death_message_2_bg, ui);
Text::new(&localized_strings.get("hud.you_died"))
.bottom_left_with_margins_on(state.ids.death_message_1_bg, 2.0, 2.0)
.font_size(self.fonts.cyri.scale(50))
.font_id(self.fonts.cyri.conrod_id)
.color(CRITICAL_HP_COLOR)
.set(state.ids.death_message_1, ui);
Text::new(
&localized_strings
.get("hud.press_key_to_respawn")
.replace("{key}", key.display_string(key_layout).as_str()),
)
.bottom_left_with_margins_on(state.ids.death_message_2_bg, 2.0, 2.0)
.font_size(self.fonts.cyri.scale(30))
.font_id(self.fonts.cyri.conrod_id)
.color(CRITICAL_HP_COLOR)
.set(state.ids.death_message_2, ui);
Text::new(&respawn_msg)
.bottom_left_with_margins_on(state.ids.death_message_2_bg, 2.0, 2.0)
.font_size(self.fonts.cyri.scale(30))
.font_id(self.fonts.cyri.conrod_id)
.color(CRITICAL_HP_COLOR)
.set(state.ids.death_message_2, ui);
}
}
@ -455,8 +452,8 @@ impl<'a> Skillbar<'a> {
// Bar Text
let bar_text = if self.health.is_dead {
Some((
self.localized_strings.get("hud.group.dead").to_owned(),
self.localized_strings.get("hud.group.dead").to_owned(),
self.localized_strings.get("hud.group.dead").into_owned(),
self.localized_strings.get("hud.group.dead").into_owned(),
))
} else if let BarNumbers::Values = bar_values {
Some((
@ -605,7 +602,7 @@ impl<'a> Skillbar<'a> {
hotbar.get(slot).and_then(|content| match content {
hotbar::SlotContents::Inventory(i, _) => inventory
.get_by_hash(i)
.map(|item| (item.name(), item.description())),
.map(|item| (item.name(), Cow::Borrowed(item.description()))),
hotbar::SlotContents::Ability(i) => active_abilities
.and_then(|a| {
a.auxiliary_set(Some(inventory), Some(skill_set))
@ -636,7 +633,7 @@ impl<'a> Skillbar<'a> {
.set(entry.widget_id, ui);
// if we can gather some text to display, show it
} else if let Some((title, desc)) = tooltip_text(entry.slot) {
slot.with_tooltip(self.tooltip_manager, &title, desc, &tooltip, TEXT_COLOR)
slot.with_tooltip(self.tooltip_manager, &title, &desc, &tooltip, TEXT_COLOR)
.set(entry.widget_id, ui);
// if not, just set slot
} else {

View File

@ -159,7 +159,7 @@ impl<'a> Widget for Social<'a> {
Rectangle::fill_with([212.0, 42.0], color::TRANSPARENT)
.top_left_with_margins_on(state.ids.frame, 2.0, 44.0)
.set(state.ids.title_align, ui);
Text::new(self.localized_strings.get("hud.social"))
Text::new(&self.localized_strings.get("hud.social"))
.middle_of(state.ids.title_align)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(20))
@ -184,7 +184,7 @@ impl<'a> Widget for Social<'a> {
.set(state.ids.scrollbar, ui);
// Online Text
Text::new(self.localized_strings.get("hud.social.online"))
Text::new(&self.localized_strings.get("hud.social.online"))
.bottom_left_with_margins_on(state.ids.frame, 18.0, 10.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(14))
@ -347,6 +347,7 @@ impl<'a> Widget for Social<'a> {
})
.flatten();
let invite_text = self.localized_strings.get("hud.group.invite");
let invite_button = Button::image(self.imgs.button)
.w_h(106.0, 26.0)
.bottom_right_with_margins_on(state.ids.frame, 9.0, 7.0)
@ -360,7 +361,7 @@ impl<'a> Widget for Social<'a> {
} else {
self.imgs.button
})
.label(self.localized_strings.get("hud.group.invite"))
.label(&invite_text)
.label_y(conrod_core::position::Relative::Scalar(3.0))
.label_color(if selected_to_invite.is_some() {
TEXT_COLOR

View File

@ -137,13 +137,13 @@ impl<'a> Trade<'a> {
}
fn title(&mut self, state: &mut ConrodState<'_, State>, ui: &mut UiCell<'_>) {
Text::new(self.localized_strings.get("hud.trade.trade_window"))
Text::new(&self.localized_strings.get("hud.trade.trade_window"))
.mid_top_with_margin_on(state.ids.bg_frame, 9.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(20))
.color(Color::Rgba(0.0, 0.0, 0.0, 1.0))
.set(state.ids.trade_title_bg, ui);
Text::new(self.localized_strings.get("hud.trade.trade_window"))
Text::new(&self.localized_strings.get("hud.trade.trade_window"))
.top_left_with_margins_on(state.ids.trade_title_bg, 2.0, 2.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(20))
@ -163,7 +163,7 @@ impl<'a> Trade<'a> {
TradePhase::Complete => self.localized_strings.get("hud.trade.phase3_description"),
};
Text::new(phase_text)
Text::new(&phase_text)
.mid_top_with_margin_on(state.ids.bg, 70.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(20))
@ -236,10 +236,11 @@ impl<'a> Trade<'a> {
.set(state.ids.offer_headers[who], ui);
let has_accepted = trade.accept_flags[who];
let accept_indicator = self
.localized_strings
.get("hud.trade.has_accepted")
.replace("{playername}", &name);
let accept_indicator =
self.localized_strings
.get_msg_ctx("hud-trade-has_accepted", &i18n::fluent_args! {
"playername" => &name,
});
Text::new(&accept_indicator)
.down_from(state.ids.inv_alignment[who], 50.0)
.font_id(self.fonts.cyri.conrod_id)
@ -510,7 +511,7 @@ impl<'a> Trade<'a> {
.press_image(press_img)
.image_color(accept_button_luminance)
.bottom_left_with_margins_on(state.ids.bg, 90.0, 47.0)
.label(self.localized_strings.get("hud.trade.accept"))
.label(&self.localized_strings.get("hud.trade.accept"))
.label_font_size(self.fonts.cyri.scale(14))
.label_color(TEXT_COLOR)
.label_font_id(self.fonts.cyri.conrod_id)
@ -526,7 +527,7 @@ impl<'a> Trade<'a> {
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.right_from(state.ids.accept_button, 20.0)
.label(self.localized_strings.get("hud.trade.decline"))
.label(&self.localized_strings.get("hud.trade.decline"))
.label_font_size(self.fonts.cyri.scale(14))
.label_color(TEXT_COLOR)
.label_font_id(self.fonts.cyri.conrod_id)
@ -657,7 +658,7 @@ impl<'a> Trade<'a> {
}
} else {
// placeholder text when no trade slot is selected
Text::new(self.localized_strings.get("hud.trade.amount_input"))
Text::new(&self.localized_strings.get("hud.trade.amount_input"))
.middle_of(state.ids.amount_bg)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(14))

View File

@ -72,7 +72,7 @@ pub fn price_desc(
pub fn kind_text<'a>(kind: &ItemKind, i18n: &'a Localization) -> Cow<'a, str> {
match kind {
ItemKind::Armor(armor) => Cow::Borrowed(armor_kind(armor, i18n)),
ItemKind::Armor(armor) => armor_kind(armor, i18n),
ItemKind::Tool(tool) => Cow::Owned(format!(
"{} ({})",
tool_kind(tool, i18n),
@ -86,20 +86,20 @@ pub fn kind_text<'a>(kind: &ItemKind, i18n: &'a Localization) -> Cow<'a, str> {
i18n.get("common.kind.modular_component_partial")
))
} else {
Cow::Borrowed(i18n.get("common.kind.modular_component"))
i18n.get("common.kind.modular_component")
}
},
ItemKind::Glider => Cow::Borrowed(i18n.get("common.kind.glider")),
ItemKind::Consumable { .. } => Cow::Borrowed(i18n.get("common.kind.consumable")),
ItemKind::Throwable { .. } => Cow::Borrowed(i18n.get("common.kind.throwable")),
ItemKind::Utility { .. } => Cow::Borrowed(i18n.get("common.kind.utility")),
ItemKind::Ingredient { .. } => Cow::Borrowed(i18n.get("common.kind.ingredient")),
ItemKind::Lantern { .. } => Cow::Borrowed(i18n.get("common.kind.lantern")),
ItemKind::Glider => i18n.get("common.kind.glider"),
ItemKind::Consumable { .. } => i18n.get("common.kind.consumable"),
ItemKind::Throwable { .. } => i18n.get("common.kind.throwable"),
ItemKind::Utility { .. } => i18n.get("common.kind.utility"),
ItemKind::Ingredient { .. } => i18n.get("common.kind.ingredient"),
ItemKind::Lantern { .. } => i18n.get("common.kind.lantern"),
ItemKind::TagExamples { .. } => Cow::Borrowed(""),
}
}
pub fn material_kind_text<'a>(kind: &MaterialKind, i18n: &'a Localization) -> &'a str {
pub fn material_kind_text<'a>(kind: &MaterialKind, i18n: &'a Localization) -> Cow<'a, str> {
match kind {
MaterialKind::Metal { .. } => i18n.get("common.material.metal"),
MaterialKind::Wood { .. } => i18n.get("common.material.wood"),
@ -148,15 +148,20 @@ pub fn consumable_desc(effects: &[Effect], i18n: &Localization) -> Vec<String> {
let buff_desc = match buff.kind {
BuffKind::Saturation | BuffKind::Regeneration | BuffKind::Potion => i18n
.get("buff.stat.health")
.replace("{str_total}", &format_float(str_total)),
BuffKind::IncreaseMaxEnergy => i18n
.get("buff.stat.increase_max_energy")
.replace("{strength}", &format_float(strength)),
BuffKind::IncreaseMaxHealth => i18n
.get("buff.stat.increase_max_health")
.replace("{strength}", &format_float(strength)),
BuffKind::Invulnerability => i18n.get("buff.stat.invulnerability").to_string(),
.get_msg_ctx("buff-stat-health", &i18n::fluent_args! {
"str_total" => format_float(str_total),
}),
BuffKind::IncreaseMaxEnergy => {
i18n.get_msg_ctx("buff-stat-increase_max_energy", &i18n::fluent_args! {
"strength" => format_float(strength),
})
},
BuffKind::IncreaseMaxHealth => {
i18n.get_msg_ctx("buff-stat-increase_max_health", &i18n::fluent_args! {
"strength" => format_float(strength),
})
},
BuffKind::Invulnerability => i18n.get("buff.stat.invulnerability"),
BuffKind::Bleeding
| BuffKind::Burning
| BuffKind::CampfireHeal
@ -168,21 +173,25 @@ pub fn consumable_desc(effects: &[Effect], i18n: &Localization) -> Vec<String> {
| BuffKind::Wet
| BuffKind::Ensnared
| BuffKind::Poisoned
| BuffKind::Hastened => "".to_owned(),
| BuffKind::Hastened => Cow::Borrowed(""),
};
write!(&mut description, "{}", buff_desc).unwrap();
let dur_desc = if let Some(dur_secs) = dur_secs {
match buff.kind {
BuffKind::Saturation | BuffKind::Regeneration => i18n
.get("buff.text.over_seconds")
.replace("{dur_secs}", &format_float(dur_secs)),
BuffKind::Saturation | BuffKind::Regeneration => {
i18n.get_msg_ctx("buff-text-over_seconds", &i18n::fluent_args! {
"dur_secs" => dur_secs
})
},
BuffKind::IncreaseMaxEnergy
| BuffKind::IncreaseMaxHealth
| BuffKind::Invulnerability => i18n
.get("buff.text.for_seconds")
.replace("{dur_secs}", &format_float(dur_secs)),
| BuffKind::Invulnerability => {
i18n.get_msg_ctx("buff-text-for_seconds", &i18n::fluent_args! {
"dur_secs" => dur_secs
})
},
BuffKind::Bleeding
| BuffKind::Burning
| BuffKind::Potion
@ -195,12 +204,12 @@ pub fn consumable_desc(effects: &[Effect], i18n: &Localization) -> Vec<String> {
| BuffKind::Wet
| BuffKind::Ensnared
| BuffKind::Poisoned
| BuffKind::Hastened => "".to_owned(),
| BuffKind::Hastened => Cow::Borrowed(""),
}
} else if let BuffKind::Saturation | BuffKind::Regeneration = buff.kind {
i18n.get("buff.text.every_second").to_string()
i18n.get("buff.text.every_second")
} else {
"".to_owned()
Cow::Borrowed("")
};
write!(&mut description, " {}", dur_desc).unwrap();
@ -212,7 +221,7 @@ pub fn consumable_desc(effects: &[Effect], i18n: &Localization) -> Vec<String> {
}
// Armor
fn armor_kind<'a>(armor: &Armor, i18n: &'a Localization) -> &'a str {
fn armor_kind<'a>(armor: &Armor, i18n: &'a Localization) -> Cow<'a, str> {
let kind = match armor.kind {
ArmorKind::Shoulder => i18n.get("hud.bag.shoulders"),
ArmorKind::Chest => i18n.get("hud.bag.chest"),
@ -231,7 +240,7 @@ fn armor_kind<'a>(armor: &Armor, i18n: &'a Localization) -> &'a str {
}
// Tool
fn tool_kind<'a>(tool: &Tool, i18n: &'a Localization) -> &'a str {
fn tool_kind<'a>(tool: &Tool, i18n: &'a Localization) -> Cow<'a, str> {
let kind = match tool.kind {
ToolKind::Sword => i18n.get("common.weapons.sword"),
ToolKind::Axe => i18n.get("common.weapons.axe"),
@ -253,7 +262,7 @@ fn tool_kind<'a>(tool: &Tool, i18n: &'a Localization) -> &'a str {
}
/// Output the number of hands needed to hold a tool
pub fn tool_hands<'a>(tool: &Tool, i18n: &'a Localization) -> &'a str {
pub fn tool_hands<'a>(tool: &Tool, i18n: &'a Localization) -> Cow<'a, str> {
let hands = match tool.hands {
Hands::One => i18n.get("common.hands.one"),
Hands::Two => i18n.get("common.hands.two"),
@ -347,19 +356,14 @@ pub fn ability_image(imgs: &img_ids::Imgs, ability_id: &str) -> image::Id {
}
pub fn ability_description<'a>(
ability_id: &'a str,
ability_id: &str,
loc: &'a Localization,
) -> (Cow<'a, str>, &'a str) {
) -> (Cow<'a, str>, Cow<'a, str>) {
// TODO: Use attribute mechanic
let (name, desc) = (
format!("{}.name", ability_id),
format!("{}.desc", ability_id),
);
(
Cow::Borrowed(
loc.get_or(&name, "common.abilities.unknown.name")
.unwrap_or(ability_id),
),
loc.get_or(&desc, "common.abilities.unknown.desc")
.unwrap_or(ability_id),
)
(loc.get(&name), loc.get(&desc))
}

View File

@ -249,7 +249,6 @@ fn main() {
settings.language.selected_language = i18n::REFERENCE_LANG.to_owned();
LocalizationHandle::load_expect(&settings.language.selected_language)
});
i18n.read().log_missing_entries();
i18n.set_english_fallback(settings.language.use_english_fallback);
// Create window

View File

@ -210,7 +210,7 @@ impl PlayState for CharSelectionState {
global_state.info_message = Some(
localized_strings
.get("main.login.server_shut_down")
.to_owned(),
.into_owned(),
);
return PlayStateResult::Pop;
},
@ -226,7 +226,7 @@ impl PlayState for CharSelectionState {
},
Err(err) => {
global_state.info_message =
Some(localized_strings.get("common.connection_lost").to_owned());
Some(localized_strings.get("common.connection_lost").into_owned());
error!(?err, "[char_selection] Failed to tick the client");
return PlayStateResult::Pop;
},

View File

@ -553,7 +553,9 @@ impl Controls {
.size(fonts.cyri.scale(26))
.into(),
Text::new(
i18n.get("char_selection.uncanny_valley"), // TODO: Add actual location here
// TODO: Add actual location here
i18n.get("char_selection.uncanny_valley")
.into_owned(),
)
.into(),
]),
@ -599,7 +601,7 @@ impl Controls {
let button = Button::new(
new_character_button,
Container::new(Text::new(
i18n.get("char_selection.create_new_character"),
i18n.get("char_selection.create_new_character").to_owned(),
))
.width(Length::Fill)
.height(Length::Fill)
@ -678,7 +680,7 @@ impl Controls {
let logout = neat_button(
logout_button,
i18n.get("char_selection.logout"),
i18n.get("char_selection.logout").into_owned(),
FILL_FRAC_ONE,
button_style,
Some(Message::Logout),
@ -686,7 +688,7 @@ impl Controls {
let enter_world = neat_button(
enter_world_button,
i18n.get("char_selection.enter_world"),
i18n.get("char_selection.enter_world").into_owned(),
FILL_FRAC_TWO,
button_style,
selected.map(|_| Message::EnterWorld),
@ -715,20 +717,20 @@ impl Controls {
if let Some(info_content) = info_content {
let over_content: Element<_> = match &info_content {
InfoContent::Deletion(_) => Column::with_children(vec![
Text::new(i18n.get("char_selection.delete_permanently"))
Text::new(i18n.get("char_selection.delete_permanently").into_owned())
.size(fonts.cyri.scale(24))
.into(),
Row::with_children(vec![
neat_button(
no_button,
i18n.get("common.no"),
i18n.get("common.no").into_owned(),
FILL_FRAC_ONE,
button_style,
Some(Message::CancelDeletion),
),
neat_button(
yes_button,
i18n.get("common.yes"),
i18n.get("common.yes").into_owned(),
FILL_FRAC_ONE,
button_style,
Some(Message::ConfirmDeletion),
@ -742,22 +744,22 @@ impl Controls {
.spacing(10)
.into(),
InfoContent::LoadingCharacters => {
Text::new(i18n.get("char_selection.loading_characters"))
Text::new(i18n.get("char_selection.loading_characters").into_owned())
.size(fonts.cyri.scale(24))
.into()
},
InfoContent::CreatingCharacter => {
Text::new(i18n.get("char_selection.creating_character"))
Text::new(i18n.get("char_selection.creating_character").into_owned())
.size(fonts.cyri.scale(24))
.into()
},
InfoContent::EditingCharacter => {
Text::new(i18n.get("char_selection.editing_character"))
Text::new(i18n.get("char_selection.editing_character").into_owned())
.size(fonts.cyri.scale(24))
.into()
},
InfoContent::DeletingCharacter => {
Text::new(i18n.get("char_selection.deleting_character"))
Text::new(i18n.get("char_selection.deleting_character").into_owned())
.size(fonts.cyri.scale(24))
.into()
},
@ -765,7 +767,7 @@ impl Controls {
Text::new(error).size(fonts.cyri.scale(24)).into(),
Row::with_children(vec![neat_button(
no_button,
i18n.get("common.close"),
i18n.get("common.close").into_owned(),
FILL_FRAC_ONE,
button_style,
Some(Message::ClearCharacterListError),
@ -846,10 +848,13 @@ impl Controls {
.style(style::container::Style::image(img))
};
let icon_button_tooltip = |button, selected, msg, img, tooltip_i18n_key| {
icon_button(button, selected, msg, img)
.with_tooltip(tooltip_manager, move || {
tooltip::text(i18n.get(tooltip_i18n_key), tooltip_style)
})
icon_button(button, selected, msg, img).with_tooltip(
tooltip_manager,
move || {
let tooltip_text = i18n.get(tooltip_i18n_key);
tooltip::text(&tooltip_text, tooltip_style)
},
)
};
// TODO: tooltips
@ -1112,7 +1117,7 @@ impl Controls {
let slider_options = Column::with_children(vec![
char_slider(
i18n.get("char_selection.hair_style"),
&i18n.get("char_selection.hair_style"),
&mut sliders.hair_style,
body.species.num_hair_styles(body.body_type) - 1,
body.hair_style,
@ -1120,7 +1125,7 @@ impl Controls {
(fonts, imgs),
),
char_slider(
i18n.get("char_selection.hair_color"),
&i18n.get("char_selection.hair_color"),
&mut sliders.hair_color,
body.species.num_hair_colors() - 1,
body.hair_color,
@ -1128,7 +1133,7 @@ impl Controls {
(fonts, imgs),
),
char_slider(
i18n.get("char_selection.skin"),
&i18n.get("char_selection.skin"),
&mut sliders.skin,
body.species.num_skin_colors() - 1,
body.skin,
@ -1136,7 +1141,7 @@ impl Controls {
(fonts, imgs),
),
char_slider(
i18n.get("char_selection.eyeshape"),
&i18n.get("char_selection.eyeshape"),
&mut sliders.eyes,
body.species.num_eyes(body.body_type) - 1,
body.eyes,
@ -1144,7 +1149,7 @@ impl Controls {
(fonts, imgs),
),
char_slider(
i18n.get("char_selection.eye_color"),
&i18n.get("char_selection.eye_color"),
&mut sliders.eye_color,
body.species.num_eye_colors() - 1,
body.eye_color,
@ -1153,7 +1158,7 @@ impl Controls {
),
char_slider_greyable(
body.species.num_accessories(body.body_type) > 1,
i18n.get("char_selection.accessories"),
&i18n.get("char_selection.accessories"),
&mut sliders.accessory,
body.species.num_accessories(body.body_type) - 1,
body.accessory,
@ -1162,7 +1167,7 @@ impl Controls {
),
char_slider_greyable(
body.species.num_beards(body.body_type) > 1,
i18n.get("char_selection.beard"),
&i18n.get("char_selection.beard"),
&mut sliders.beard,
body.species.num_beards(body.body_type) - 1,
body.beard,
@ -1185,7 +1190,8 @@ impl Controls {
)
.on_press(Message::RandomizeCharacter)
.with_tooltip(tooltip_manager, move || {
tooltip::text(i18n.get("common.rand_appearance"), tooltip_style)
let tooltip_text = i18n.get("common.rand_appearance");
tooltip::text(&tooltip_text, tooltip_style)
});
let column_content = vec![
@ -1244,7 +1250,7 @@ impl Controls {
let back = neat_button(
back_button,
i18n.get("common.back"),
i18n.get("common.back").into_owned(),
FILL_FRAC_ONE,
button_style,
Some(Message::Back),
@ -1262,7 +1268,8 @@ impl Controls {
)
.on_press(Message::RandomizeName)
.with_tooltip(tooltip_manager, move || {
tooltip::text(i18n.get("common.rand_name"), tooltip_style)
let tooltip_text = i18n.get("common.rand_name");
tooltip::text(&tooltip_text, tooltip_style)
});
let confirm_msg = if let Some(character_id) = character_id {
@ -1277,7 +1284,7 @@ impl Controls {
.fix_aspect_ratio(),
TextInput::new(
name_input,
i18n.get("character_window.character_name"),
&i18n.get("character_window.character_name"),
name,
Message::Name,
)
@ -1314,10 +1321,8 @@ impl Controls {
let create: Element<Message> = if name.is_empty() {
create
.with_tooltip(tooltip_manager, move || {
tooltip::text(
i18n.get("char_selection.create_info_name"),
tooltip_style,
)
let tooltip_text = i18n.get("char_selection.create_info_name");
tooltip::text(&tooltip_text, tooltip_style)
})
.into()
} else {

View File

@ -115,35 +115,51 @@ impl PlayState for MainMenuState {
self.main_menu_ui.cancel_connection();
let server_err = match e {
server::Error::NetworkErr(e) => localized_strings
.get("main.servers.network_error")
.to_owned()
.replace("{raw_error}", e.to_string().as_str()),
.get_msg_ctx("main-servers-network_error", &i18n::fluent_args! {
"raw_error" => e.to_string()
})
.into_owned(),
server::Error::ParticipantErr(e) => localized_strings
.get("main.servers.participant_error")
.to_owned()
.replace("{raw_error}", e.to_string().as_str()),
.get_msg_ctx(
"main-servers-participant_error",
&i18n::fluent_args! {
"raw_error" => e.to_string()
},
)
.into_owned(),
server::Error::StreamErr(e) => localized_strings
.get("main.servers.stream_error")
.to_owned()
.replace("{raw_error}", e.to_string().as_str()),
.get_msg_ctx("main-servers-stream_error", &i18n::fluent_args! {
"raw_error" => e.to_string()
})
.into_owned(),
server::Error::DatabaseErr(e) => localized_strings
.get("main.servers.database_error")
.to_owned()
.replace("{raw_error}", e.to_string().as_str()),
.get_msg_ctx("main-servers-database_error", &i18n::fluent_args! {
"raw_error" => e.to_string()
})
.into_owned(),
server::Error::PersistenceErr(e) => localized_strings
.get("main.servers.persistence_error")
.to_owned()
.replace("{raw_error}", e.to_string().as_str()),
.get_msg_ctx(
"main-servers-persistence_error",
&i18n::fluent_args! {
"raw_error" => e.to_string()
},
)
.into_owned(),
server::Error::Other(e) => localized_strings
.get("main.servers.other_error")
.to_owned()
.replace("{raw_error}", e.as_str()),
.get_msg_ctx("main-servers-other_error", &i18n::fluent_args! {
"raw_error" => e,
})
.into_owned(),
};
global_state.info_message = Some(
localized_strings
.get("main.servers.singleplayer_error")
.to_owned()
.replace("{sp_error}", server_err.as_str()),
.get_msg_ctx(
"main-servers-singleplayer_error",
&i18n::fluent_args! {
"sp_error" => server_err
},
)
.into_owned(),
);
},
Err(_) => (),
@ -179,9 +195,10 @@ impl PlayState for MainMenuState {
error!(?e, "Client Init failed");
global_state.info_message = Some(
localized_strings
.get("main.login.client_init_failed")
.to_owned()
.replace("{init_fail_reason}", e.as_str()),
.get_msg_ctx("main-login-client_init_failed", &i18n::fluent_args! {
"init_fail_reason" => e
})
.into_owned(),
);
},
Some(InitMsg::IsAuthTrusted(auth_server)) => {
@ -221,7 +238,7 @@ impl PlayState for MainMenuState {
global_state.info_message = Some(
localized_strings
.get("main.login.server_shut_down")
.to_owned(),
.into_owned(),
);
self.init = InitState::None;
},
@ -231,7 +248,7 @@ impl PlayState for MainMenuState {
},
Err(err) => {
global_state.info_message =
Some(localized_strings.get("common.connection_lost").to_owned());
Some(localized_strings.get("common.connection_lost").into_owned());
error!(?err, "[main menu] Failed to tick the client");
self.init = InitState::None;
},
@ -320,7 +337,6 @@ impl PlayState for MainMenuState {
global_state.i18n = LocalizationHandle::load_expect(
&global_state.settings.language.selected_language,
);
global_state.i18n.read().log_missing_entries();
global_state
.i18n
.set_english_fallback(global_state.settings.language.use_english_fallback);
@ -449,7 +465,7 @@ fn get_client_msg_error(
))) => net_error(
localization
.get("main.login.network_wrong_version")
.to_owned(),
.into_owned(),
mismatched_server_info,
),
Error::NetworkErr(e) => net_error(e.to_string(), mismatched_server_info),
@ -507,15 +523,16 @@ fn attempt_login(
*info_message = Some(
localization
.get("main.login.username_bad_characters")
.to_owned(),
.into_owned(),
);
},
comp::AliasError::TooLong => {
*info_message = Some(
localization
.get("main.login.username_too_long")
.to_owned()
.replace("{max_len}", comp::MAX_ALIAS_LEN.to_string().as_str()),
.get_msg_ctx("main-login-username_too_long", &i18n::fluent_args! {
"max_len" => comp::MAX_ALIAS_LEN
})
.into_owned(),
);
},
}

View File

@ -102,38 +102,33 @@ impl Screen {
let children = match connection_state {
ConnectionState::InProgress => {
let tip = if show_tip {
let tip = &i18n.get_variation("loading.tips", self.tip_number);
let mut new_tip = String::with_capacity(tip.len());
let mut last_index = 0;
// This could be done with regex instead, but adding new dependencies is
// scary...
tip.match_indices("{gameinput.").for_each(|(start, s)| {
if let Some(end) = tip[start + s.len()..].find('}') {
let end = start + s.len() + end;
if let Ok(game_input) = GameInput::from_str(&tip[start + 1..end]) {
new_tip.push_str(&tip[last_index..start]);
new_tip.push_str(
match controls.keybindings.get(&game_input) {
Some(Some(key_mouse)) => {
key_mouse.display_string(key_layout)
},
Some(None) => i18n.get("main.unbound_key_tip").to_string(),
None => ControlSettings::default_binding(game_input)
.display_string(key_layout),
}
.as_str(),
);
last_index = end + 1;
let key = |code| {
if let Ok(game_input) = GameInput::from_str(code) {
match controls.keybindings.get(&game_input) {
Some(Some(key_mouse)) => key_mouse.display_string(key_layout),
Some(None) => i18n.get("main.unbound_key_tip").into_owned(),
None => ControlSettings::default_binding(game_input)
.display_string(key_layout),
}
} else {
"code".to_owned()
}
});
// If there is any text left over append it
if last_index < tip.len() {
new_tip.push_str(&tip[last_index..]);
}
};
let keys = i18n::fluent_args! {
"gameinput-togglelantern" => key("gameinput.togglelantern"),
"gameinput-help" => key("gameinput.help"),
"gameinput-settings" => key("gameinput.settings"),
"gameinput-social" => key("gameinput.social"),
"gameinput-dance" => key("gameinput.dance"),
"gameinput-glide" => key("gameinput.glide"),
"gameinput-sit" => key("gameinput.sit"),
"gameinput-crafting" => key("gameinput.crafting"),
"gameinput-roll" => key("gameinput.roll"),
"gameinput-screenshot" => key("gameinput.screenshot"),
};
let tip = &i18n.get_variation_ctx("loading-tips", self.tip_number, &keys);
let tip = format!("{} {}", i18n.get("main.tip"), tip);
let tip = format!("{} {}", i18n.get("main.tip"), new_tip.as_str());
Container::new(Text::new(tip).size(fonts.cyri.scale(25)))
.width(Length::Fill)
.height(Length::Fill)

View File

@ -363,7 +363,7 @@ impl LoginBanner {
.fix_aspect_ratio(),
TextInput::new(
&mut self.username,
i18n.get("main.username"),
&i18n.get("main.username"),
&login_info.username,
Message::Username,
)
@ -378,7 +378,7 @@ impl LoginBanner {
.fix_aspect_ratio(),
TextInput::new(
&mut self.password,
i18n.get("main.password"),
&i18n.get("main.password"),
&login_info.password,
Message::Password,
)
@ -394,7 +394,7 @@ impl LoginBanner {
.fix_aspect_ratio(),
TextInput::new(
&mut self.server,
i18n.get("main.server"),
&i18n.get("main.server"),
&login_info.server,
Message::Server,
)

View File

@ -321,8 +321,10 @@ impl SessionState {
let message = match time {
0 => String::from(i18n.get("hud.chat.goodbye")),
_ => i18n
.get("hud.chat.connection_lost")
.replace("{time}", time.to_string().as_str()),
.get_msg_ctx("hud-chat-connection_lost", &i18n::fluent_args! {
"time" => time
})
.into_owned(),
};
self.hud.new_message(ChatMsg {
@ -835,8 +837,13 @@ impl PlayState for SessionState {
let msg = global_state
.i18n
.read()
.get("hud.trade.invite_sent")
.replace("{playername}", &name);
.get_msg_ctx(
"hud-trade-invite_sent",
&i18n::fluent_args! {
"playername" => &name
},
)
.into_owned();
self.hud
.new_message(ChatType::Meta.chat_msg(msg));
client.send_invite(uid, InviteKind::Trade)
@ -1079,7 +1086,7 @@ impl PlayState for SessionState {
.i18n
.read()
.get("common.connection_lost")
.to_owned(),
.into_owned(),
);
error!("[session] Failed to tick the scene: {:?}", err);

View File

@ -600,7 +600,6 @@ impl SettingsChange {
settings.language.selected_language = new_language.language_identifier;
global_state.i18n =
LocalizationHandle::load_expect(&settings.language.selected_language);
global_state.i18n.read().log_missing_entries();
global_state
.i18n
.set_english_fallback(settings.language.use_english_fallback);

View File

@ -15,7 +15,7 @@ pub struct Style {
}
/// Tooltip that is just text
pub fn text<'a, M: 'a>(text: &'a str, style: Style) -> Element<'a, M, ui::IcedRenderer> {
pub fn text<'a, M: 'a>(text: &str, style: Style) -> Element<'a, M, ui::IcedRenderer> {
Container::new(
Text::new(text)
.color(style.text_color)

View File

@ -1260,8 +1260,8 @@ impl<'a> Widget for ItemTooltip<'a> {
item.item_definition_id(),
self.localized_strings,
) {
//Get localized tooltip strings (gotten here because these should only show if
// in a trade- aka if buy/sell prices are present)
// Get localized tooltip strings (gotten here because these should
// only show if in a trade- aka if buy/sell prices are present)
let tt_hint_1 = self.localized_strings.get("hud.trade.tooltip_hint_1");
let tt_hint_2 = self.localized_strings.get("hud.trade.tooltip_hint_2");