mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Add several new i18n lines
This commit is contained in:
parent
d1e734b9b1
commit
508e35ca17
@ -24,6 +24,14 @@
|
||||
"buff.desc.bleed": "Inflicts regular damage.",
|
||||
"buff.title.cursed": "Cursed",
|
||||
"buff.desc.cursed": "You are cursed.",
|
||||
// Buffs stats
|
||||
"buff.stat.health": "Restores {str_total} Health",
|
||||
"buff.stat.increase_max_stamina": "Raises Maximum Stamina by {strength}",
|
||||
"buff.stat.increase_max_health": "Raises Maximum Health by {strength}",
|
||||
"buff.stat.invulenrability": "Grants invulnerability",
|
||||
// Text
|
||||
"buff.text.over_seconds": "over {dur_secs} seconds",
|
||||
"buff.text.for_seconds": "for {dur_secs} seconds",
|
||||
},
|
||||
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
"common.you": "You",
|
||||
"common.automatic": "Auto",
|
||||
"common.random": "Random",
|
||||
"common.empty": "Empty",
|
||||
|
||||
// Settings Window title
|
||||
"common.interface_settings": "Interface Settings",
|
||||
@ -64,8 +65,39 @@ Is the client up to date?"#,
|
||||
"common.weapons.hammer": "Hammer",
|
||||
"common.weapons.general": "General Combat",
|
||||
"common.weapons.sceptre": "Healing Sceptre",
|
||||
"common.weapons.sceptre": "Shield",
|
||||
"common.weapons.spear": "Spear",
|
||||
"common.weapons.hammer_simple": "Simple Hammer",
|
||||
"common.weapons.sword_simple": "Simple Sword",
|
||||
"common.weapons.staff_simple": "Simple Staff",
|
||||
"common.weapons.axe_simple": "Simple Axe",
|
||||
"common.weapons.bow_simple": "Simple Bow",
|
||||
"common.weapons.unique": "Unique",
|
||||
"common.tool.debug": "Debug",
|
||||
"common.tool.faming": "Farming Tool",
|
||||
"common.tool.pick": "Pickaxe",
|
||||
"common.kind.modular_component": "Modular Component",
|
||||
"common.kind.glider": "Glider",
|
||||
"common.kind.consumable": "Consumable",
|
||||
"common.kind.throwable": "Can be thrown",
|
||||
"common.kind.utility": "Utility",
|
||||
"common.kind.ingredient": "Ingredient",
|
||||
"common.kind.lantern": "Lantern",
|
||||
"common.hands.one": "One-Handed",
|
||||
"common.hands.two": "Two-Handed",
|
||||
|
||||
"common.rand_appearance": "Random appearance",
|
||||
"common.rand_name": "Random name",
|
||||
|
||||
"common.stats.dps": "DPS",
|
||||
"common.stats.power": "Power",
|
||||
"common.stats.speed": "Speed",
|
||||
"common.stats.poise": "Poise",
|
||||
"common.stats.crit_chance": "Crit Chance",
|
||||
"common.stats.crit_mult": "Crit Mult",
|
||||
"common.stats.armor": "Armor",
|
||||
"common.stats.poise_res": "Poise res",
|
||||
"common.stats.slots": "Slots",
|
||||
},
|
||||
|
||||
|
||||
|
@ -25,6 +25,12 @@
|
||||
"hud.bag.mainhand": "Mainhand",
|
||||
"hud.bag.offhand": "Offhand",
|
||||
"hud.bag.bag": "Bag",
|
||||
"hud.bag.health": "Health",
|
||||
"hud.bag.stamina": "Stamina",
|
||||
"hud.bag.combat_rating": "Combat Rating",
|
||||
"hud.bag.protection": "Protection",
|
||||
"hud.bag.combat_rating_desc": "Calculated from your\nequipment and health.",
|
||||
"hud.bag.protection": "Damage reduction through armor",
|
||||
},
|
||||
|
||||
|
||||
|
@ -24,6 +24,15 @@
|
||||
"buff.desc.bleed": "Inflige régulièrement des dommages.",
|
||||
"buff.title.cursed": "Maudit",
|
||||
"buff.desc.cursed": "Vous êtes maudit.",
|
||||
// Buffs stats
|
||||
"buff.stat.health": "Restaure {str_total} points de vie",
|
||||
"buff.stat.increase_max_stamina": "Augmente la vigueur maximale de {strength}",
|
||||
"buff.stat.increase_max_health": "Augmente la santé maximale de {strength}",
|
||||
"buff.stat.invulenrability": "Rend invincible",
|
||||
// Text
|
||||
"buff.text.over_seconds": "pendant {dur_secs} secondes",
|
||||
"buff.text.for_seconds": "pour {dur_secs} secondes",
|
||||
"buff.text.every_second": "chaque seconde",
|
||||
},
|
||||
|
||||
|
||||
|
@ -34,6 +34,8 @@
|
||||
"common.you": "Toi",
|
||||
"common.automatic": "Auto",
|
||||
"common.random": "Aléatoire",
|
||||
"common.empty": "Vide",
|
||||
|
||||
// Settings Window title
|
||||
"common.interface_settings": "Options de l'interface",
|
||||
"common.gameplay_settings": "Options de gameplay",
|
||||
@ -62,7 +64,38 @@ Le client est-il à jour?"#,
|
||||
"common.weapons.bow": "Arc",
|
||||
"common.weapons.hammer": "Marteau",
|
||||
"common.weapons.sceptre": "Sceptre de soin",
|
||||
"common.weapons.sceptre": "Bouclier",
|
||||
"common.weapons.spear": "Lance",
|
||||
"common.weapons.hammer_simple": "Marteau Simple",
|
||||
"common.weapons.sword_simple": "Épée Simple",
|
||||
"common.weapons.staff_simple": "Bâton Simple",
|
||||
"common.weapons.axe_simple": "Hache Simple",
|
||||
"common.weapons.bow_simple": "Arc Simple",
|
||||
"common.weapons.unique": "Unique",
|
||||
"common.tool.debug": "Debug",
|
||||
"common.tool.faming": "Outil agricole",
|
||||
"common.tool.pick": "Pioche",
|
||||
"common.kind.modular_component": "Composant Modulaire",
|
||||
"common.kind.glider": "Planeur",
|
||||
"common.kind.consumable": "Consommable",
|
||||
"common.kind.throwable": "Peut être lancé",
|
||||
"common.kind.utility": "Utilitaire",
|
||||
"common.kind.ingredient": "Ingrédient",
|
||||
"common.kind.lantern": "Lanterne",
|
||||
"common.hands.one": "Une main",
|
||||
"common.hands.two": "Deux mains",
|
||||
|
||||
"common.rand_appearance": "Apparence et nom aléatoire",
|
||||
|
||||
"common.stats.dps": "DPS",
|
||||
"common.stats.power": "Puissance",
|
||||
"common.stats.speed": "Vitesse",
|
||||
"common.stats.poise": "Impact",
|
||||
"common.stats.crit_chance": "Chance Crit",
|
||||
"common.stats.crit_mult": "Mult Crit",
|
||||
"common.stats.armor": "Armure",
|
||||
"common.stats.poise_res": "Res Impact",
|
||||
"common.stats.slots": "Emplacements",
|
||||
},
|
||||
|
||||
|
||||
|
@ -25,6 +25,12 @@
|
||||
"hud.bag.mainhand": "Main Dominante",
|
||||
"hud.bag.offhand": "Main Secondaire",
|
||||
"hud.bag.bag": "Sac",
|
||||
"hud.bag.health": "Santé",
|
||||
"hud.bag.stamina": "Vigueur",
|
||||
"hud.bag.combat_rating": "Niveau de Combat",
|
||||
"hud.bag.protection": "Protection",
|
||||
"hud.bag.combat_rating_desc": "Calculé depuis votre\néquipement et votre santé",
|
||||
"hud.bag.protection_desc": "Réduction des dégats de votre armure",
|
||||
},
|
||||
|
||||
|
||||
|
@ -299,7 +299,8 @@ impl<'a> InventoryScroller<'a> {
|
||||
}
|
||||
|
||||
if let Some(item) = item {
|
||||
let (title, desc) = super::util::item_text(item, &self.msm);
|
||||
let (title, desc) =
|
||||
super::util::item_text(item, &self.msm, &self.localized_strings);
|
||||
let quality_col = get_quality_col(item);
|
||||
let quality_col_img = match item.quality() {
|
||||
Quality::Low => self.imgs.inv_slot_grey,
|
||||
@ -609,6 +610,7 @@ impl<'a> Widget for Bag<'a> {
|
||||
self.item_imgs,
|
||||
self.pulse,
|
||||
self.msm,
|
||||
self.localized_strings,
|
||||
)
|
||||
.title_font_size(self.fonts.cyri.scale(20))
|
||||
.parent(ui.window)
|
||||
@ -757,18 +759,16 @@ impl<'a> Widget for Bag<'a> {
|
||||
} else {
|
||||
btn.down_from(state.ids.stat_icons[i.0 - 1], 7.0)
|
||||
};
|
||||
// TODO: Translation
|
||||
let tooltip_head = match i.1 {
|
||||
"Health" => "Health",
|
||||
"Stamina" => "Stamina",
|
||||
"Combat Rating" => "Combat Rating",
|
||||
"Protection" => "Protection",
|
||||
"Health" => i18n.get("hud.bag.health"),
|
||||
"Stamina" => i18n.get("hud.bag.stamina"),
|
||||
"Combat Rating" => i18n.get("hud.bag.combat_rating"),
|
||||
"Protection" => i18n.get("hud.bag.protection"),
|
||||
_ => "",
|
||||
};
|
||||
// TODO: Translation
|
||||
let tooltip_txt = match i.1 {
|
||||
"Combat Rating" => "Calculated from your\nequipment and health.",
|
||||
"Protection" => "Damage reduction through armor",
|
||||
"Combat Rating" => i18n.get("hud.bag.combat_rating_desc"),
|
||||
"Protection" => i18n.get("hud.bag.protection_desc"),
|
||||
_ => "",
|
||||
};
|
||||
btn.with_tooltip(
|
||||
|
@ -179,6 +179,7 @@ impl<'a> Widget for Crafting<'a> {
|
||||
self.item_imgs,
|
||||
self.pulse,
|
||||
self.msm,
|
||||
self.localized_strings,
|
||||
)
|
||||
.title_font_size(self.fonts.cyri.scale(20))
|
||||
.parent(ui.window)
|
||||
@ -332,7 +333,6 @@ impl<'a> Widget for Crafting<'a> {
|
||||
{
|
||||
let output_text = format!("x{}", &recipe.output.1.to_string());
|
||||
// Output Image
|
||||
let (title, desc) = super::util::item_text(&*recipe.output.0, self.msm);
|
||||
let quality_col = get_quality_col(&*recipe.output.0);
|
||||
Button::image(animate_by_pulse(
|
||||
&self
|
||||
@ -526,7 +526,6 @@ impl<'a> Widget for Crafting<'a> {
|
||||
};
|
||||
frame.set(state.ids.ingredient_frame[i], ui);
|
||||
//Item Image
|
||||
let (title, desc) = super::util::item_text(&*item_def, self.msm);
|
||||
Button::image(animate_by_pulse(
|
||||
&self.item_imgs.img_ids_or_not_found_img((&*item_def).into()),
|
||||
self.pulse,
|
||||
|
@ -462,7 +462,7 @@ impl<'a> Widget for Diary<'a> {
|
||||
Image::new(self.imgs.diary_exp_frame)
|
||||
.w_h(480.0, 76.0)
|
||||
.color(Some(UI_HIGHLIGHT_0))
|
||||
.align_middle_x_of(state.exp_bar_bg)
|
||||
.middle_of(state.exp_bar_bg)
|
||||
.set(state.exp_bar_frame, ui);
|
||||
// Show EXP bar text on hover
|
||||
self.hovering_exp_bar = ui
|
||||
|
@ -305,6 +305,7 @@ impl<'a> Trade<'a> {
|
||||
self.item_imgs,
|
||||
self.pulse,
|
||||
self.msm,
|
||||
self.localized_strings,
|
||||
)
|
||||
.title_font_size(self.fonts.cyri.scale(20))
|
||||
.parent(ui.window)
|
||||
@ -386,7 +387,6 @@ impl<'a> Trade<'a> {
|
||||
);
|
||||
let slot_id = state.ids.inv_slots[i + who * MAX_TRADE_SLOTS];
|
||||
if let Some(Some(item)) = slot.invslot.and_then(|slotid| inventory.slot(slotid)) {
|
||||
let (title, desc) = super::util::item_text(item, self.msm);
|
||||
let quality_col = get_quality_col(item);
|
||||
let quality_col_img = match item.quality() {
|
||||
Quality::Low => self.imgs.inv_slot_grey,
|
||||
|
@ -13,33 +13,41 @@ use common::{
|
||||
};
|
||||
use std::{borrow::Cow, fmt::Write};
|
||||
|
||||
use crate::i18n::Localization;
|
||||
|
||||
pub fn loadout_slot_text<'a>(
|
||||
item: Option<&'a impl ItemDesc>,
|
||||
mut empty: impl FnMut() -> (&'a str, &'a str),
|
||||
msm: &'a MaterialStatManifest,
|
||||
i18n: &'a Localization,
|
||||
) -> (&'a str, Cow<'a, str>) {
|
||||
item.map_or_else(
|
||||
|| {
|
||||
let (title, desc) = empty();
|
||||
(title, Cow::Borrowed(desc))
|
||||
},
|
||||
|item| item_text(item, msm),
|
||||
|item| item_text(item, msm, i18n),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn item_text<'a>(
|
||||
item: &'a dyn ItemDesc,
|
||||
msm: &'a MaterialStatManifest,
|
||||
i18n: &'a Localization,
|
||||
) -> (&'a str, Cow<'a, str>) {
|
||||
let desc: Cow<str> = match item.kind() {
|
||||
ItemKind::Armor(armor) => {
|
||||
Cow::Owned(armor_desc(armor, item.description(), item.num_slots()))
|
||||
},
|
||||
ItemKind::Armor(armor) => Cow::Owned(armor_desc(
|
||||
armor,
|
||||
item.description(),
|
||||
item.num_slots(),
|
||||
i18n,
|
||||
)),
|
||||
ItemKind::Tool(tool) => Cow::Owned(tool_desc(
|
||||
&tool,
|
||||
item.components(),
|
||||
&msm,
|
||||
item.description(),
|
||||
i18n,
|
||||
)),
|
||||
ItemKind::ModularComponent(mc) => Cow::Owned(modular_component_desc(
|
||||
mc,
|
||||
@ -47,16 +55,16 @@ pub fn item_text<'a>(
|
||||
&msm,
|
||||
item.description(),
|
||||
)),
|
||||
ItemKind::Glider(_glider) => Cow::Owned(generic_desc(item)),
|
||||
ItemKind::Consumable { effect, .. } => Cow::Owned(consumable_desc(effect)),
|
||||
ItemKind::Throwable { .. } => Cow::Owned(generic_desc(item)),
|
||||
ItemKind::Utility { .. } => Cow::Owned(generic_desc(item)),
|
||||
ItemKind::Glider(_glider) => Cow::Owned(generic_desc(item, i18n)),
|
||||
ItemKind::Consumable { effect, .. } => Cow::Owned(consumable_desc(effect, i18n)),
|
||||
ItemKind::Throwable { .. } => Cow::Owned(generic_desc(item, i18n)),
|
||||
ItemKind::Utility { .. } => Cow::Owned(generic_desc(item, i18n)),
|
||||
ItemKind::Ingredient { .. } => Cow::Owned(ingredient_desc(
|
||||
item.description(),
|
||||
item.item_definition_id(),
|
||||
msm,
|
||||
)),
|
||||
ItemKind::Lantern { .. } => Cow::Owned(generic_desc(item)),
|
||||
ItemKind::Lantern { .. } => Cow::Owned(generic_desc(item, i18n)),
|
||||
ItemKind::TagExamples { .. } => Cow::Borrowed(item.description()),
|
||||
//_ => Cow::Borrowed(item.description()),
|
||||
};
|
||||
@ -94,25 +102,27 @@ fn use_text(kind: &ItemKind) -> String {
|
||||
text.to_string()
|
||||
}
|
||||
|
||||
pub fn kind_text(kind: &ItemKind) -> String {
|
||||
pub fn kind_text(kind: &ItemKind, i18n: &Localization) -> String {
|
||||
match kind {
|
||||
ItemKind::Armor(armor) => format!("Armor ({})", armor_kind(&armor)),
|
||||
ItemKind::Tool(tool) => format!("{} {}", tool_hands(&tool), tool_kind(&tool)),
|
||||
ItemKind::ModularComponent(_mc) => "Modular Component".to_string(),
|
||||
ItemKind::Glider(_glider) => "Glider".to_string(),
|
||||
ItemKind::Consumable { .. } => "Consumable".to_string(),
|
||||
ItemKind::Throwable { .. } => "Can be thrown".to_string(),
|
||||
ItemKind::Utility { .. } => "Utility".to_string(),
|
||||
ItemKind::Ingredient { .. } => "Ingredient".to_string(),
|
||||
ItemKind::Lantern { .. } => "Lantern".to_string(),
|
||||
ItemKind::Armor(armor) => armor_kind(&armor, &i18n),
|
||||
ItemKind::Tool(tool) => {
|
||||
format!("{} ({})", tool_kind(&tool, &i18n), tool_hands(&tool, i18n))
|
||||
},
|
||||
ItemKind::ModularComponent(_mc) => i18n.get("common.bag.shoulders").to_string(),
|
||||
ItemKind::Glider(_glider) => i18n.get("common.kind.glider").to_string(),
|
||||
ItemKind::Consumable { .. } => i18n.get("common.kind.consumable").to_string(),
|
||||
ItemKind::Throwable { .. } => i18n.get("common.kind.throwable").to_string(),
|
||||
ItemKind::Utility { .. } => i18n.get("common.kind.utility").to_string(),
|
||||
ItemKind::Ingredient { .. } => i18n.get("common.kind.ingredient").to_string(),
|
||||
ItemKind::Lantern { .. } => i18n.get("common.kind.lantern").to_string(),
|
||||
ItemKind::TagExamples { .. } => "".to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
fn generic_desc(desc: &dyn ItemDesc) -> String {
|
||||
fn generic_desc(desc: &dyn ItemDesc, i18n: &Localization) -> String {
|
||||
format!(
|
||||
"{}\n\n{}\n\n{}",
|
||||
kind_text(desc.kind()),
|
||||
kind_text(desc.kind(), i18n),
|
||||
desc.description(),
|
||||
use_text(desc.kind())
|
||||
)
|
||||
@ -139,7 +149,7 @@ fn modular_component_desc(
|
||||
result
|
||||
}
|
||||
|
||||
pub fn consumable_desc(effects: &[Effect]) -> String {
|
||||
pub fn consumable_desc(effects: &[Effect], i18n: &Localization) -> String {
|
||||
let mut description = "".to_string();
|
||||
|
||||
for effect in effects {
|
||||
@ -149,16 +159,16 @@ pub fn consumable_desc(effects: &[Effect]) -> String {
|
||||
let str_total = dur_secs.map_or(strength, |secs| strength * secs);
|
||||
|
||||
let buff_desc = match buff.kind {
|
||||
BuffKind::Saturation | BuffKind::Regeneration | BuffKind::Potion => {
|
||||
format!("Restores {} Health", str_total)
|
||||
},
|
||||
BuffKind::IncreaseMaxEnergy => {
|
||||
format!("Raises Maximum Stamina by {}", strength)
|
||||
},
|
||||
BuffKind::IncreaseMaxHealth => {
|
||||
format!("Raises Maximum Health by {}", strength)
|
||||
},
|
||||
BuffKind::Invulnerability => "Grants invulnerability".to_string(),
|
||||
BuffKind::Saturation | BuffKind::Regeneration | BuffKind::Potion => i18n
|
||||
.get("buff.stat.health")
|
||||
.replace("{str_total}", &str_total.to_string()),
|
||||
BuffKind::IncreaseMaxEnergy => i18n
|
||||
.get("buff.stat.increase_max_stamina")
|
||||
.replace("{strength}", &strength.to_string()),
|
||||
BuffKind::IncreaseMaxHealth => i18n
|
||||
.get("buff.stat.increase_max_health")
|
||||
.replace("{strength}", &strength.to_string()),
|
||||
BuffKind::Invulnerability => i18n.get("buff.stat.invulenrability").to_string(),
|
||||
BuffKind::Bleeding
|
||||
| BuffKind::CampfireHeal
|
||||
| BuffKind::Cursed
|
||||
@ -167,16 +177,16 @@ pub fn consumable_desc(effects: &[Effect]) -> String {
|
||||
|
||||
write!(&mut description, "{}", buff_desc).unwrap();
|
||||
|
||||
let dur_desc = if dur_secs.is_some() {
|
||||
let dur_desc = if let Some(dur_secs) = dur_secs {
|
||||
match buff.kind {
|
||||
BuffKind::Saturation | BuffKind::Regeneration => {
|
||||
format!("over {} seconds", dur_secs.unwrap())
|
||||
},
|
||||
BuffKind::Saturation | BuffKind::Regeneration => i18n
|
||||
.get("buff.text.over_seconds")
|
||||
.replace("{dur_secs}", &dur_secs.to_string()),
|
||||
BuffKind::IncreaseMaxEnergy
|
||||
| BuffKind::IncreaseMaxHealth
|
||||
| BuffKind::Invulnerability => {
|
||||
format!("for {} seconds", dur_secs.unwrap())
|
||||
},
|
||||
| BuffKind::Invulnerability => i18n
|
||||
.get("buff.text.for_seconds")
|
||||
.replace("{dur_secs}", &dur_secs.to_string()),
|
||||
BuffKind::Bleeding
|
||||
| BuffKind::Potion
|
||||
| BuffKind::CampfireHeal
|
||||
@ -184,7 +194,7 @@ pub fn consumable_desc(effects: &[Effect]) -> String {
|
||||
| BuffKind::ProtectingWard => continue,
|
||||
}
|
||||
} else if let BuffKind::Saturation | BuffKind::Regeneration = buff.kind {
|
||||
"every second".to_string()
|
||||
i18n.get("buff.text.every_second").to_string()
|
||||
} else {
|
||||
continue;
|
||||
};
|
||||
@ -206,21 +216,20 @@ fn ingredient_desc(desc: &str, item_id: &str, msm: &MaterialStatManifest) -> Str
|
||||
}
|
||||
|
||||
// Armor
|
||||
|
||||
fn armor_kind(armor: &Armor) -> String {
|
||||
fn armor_kind(armor: &Armor, i18n: &Localization) -> String {
|
||||
let kind = match armor.kind {
|
||||
ArmorKind::Shoulder(_) => "Shoulders",
|
||||
ArmorKind::Chest(_) => "Chest",
|
||||
ArmorKind::Belt(_) => "Belt",
|
||||
ArmorKind::Hand(_) => "Hands",
|
||||
ArmorKind::Pants(_) => "Legs",
|
||||
ArmorKind::Foot(_) => "Feet",
|
||||
ArmorKind::Back(_) => "Back",
|
||||
ArmorKind::Ring(_) => "Ring",
|
||||
ArmorKind::Neck(_) => "Neck",
|
||||
ArmorKind::Head(_) => "Head",
|
||||
ArmorKind::Tabard(_) => "Tabard",
|
||||
ArmorKind::Bag(_) => "Bag",
|
||||
ArmorKind::Shoulder(_) => i18n.get("hud.bag.shoulders"),
|
||||
ArmorKind::Chest(_) => i18n.get("hud.bag.chest"),
|
||||
ArmorKind::Belt(_) => i18n.get("hud.bag.belt"),
|
||||
ArmorKind::Hand(_) => i18n.get("hud.bag.hands"),
|
||||
ArmorKind::Pants(_) => i18n.get("hud.bag.legs"),
|
||||
ArmorKind::Foot(_) => i18n.get("hud.bag.feet"),
|
||||
ArmorKind::Back(_) => i18n.get("hud.bag.back"),
|
||||
ArmorKind::Ring(_) => i18n.get("hud.bag.ring"),
|
||||
ArmorKind::Neck(_) => i18n.get("hud.bag.neck"),
|
||||
ArmorKind::Head(_) => i18n.get("hud.bag.head"),
|
||||
ArmorKind::Tabard(_) => i18n.get("hud.bag.tabard"),
|
||||
ArmorKind::Bag(_) => i18n.get("hud.bag.bag"),
|
||||
};
|
||||
kind.to_string()
|
||||
}
|
||||
@ -232,9 +241,9 @@ fn armor_protection(armor: &Armor) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn armor_desc(armor: &Armor, desc: &str, slots: u16) -> String {
|
||||
pub fn armor_desc(armor: &Armor, desc: &str, slots: u16, i18n: &Localization) -> String {
|
||||
// TODO: localization
|
||||
let kind = armor_kind(armor);
|
||||
let kind = armor_kind(armor, i18n);
|
||||
let armor_protection = armor_protection(armor);
|
||||
//let armor_poise_resilience = match armor.get_poise_resilience() {
|
||||
// Protection::Normal(a) => a.to_string(),
|
||||
@ -260,27 +269,27 @@ pub fn armor_desc(armor: &Armor, desc: &str, slots: u16) -> String {
|
||||
|
||||
//Tool
|
||||
|
||||
pub fn tool_kind(tool: &Tool) -> String {
|
||||
pub fn tool_kind(tool: &Tool, i18n: &Localization) -> String {
|
||||
let kind = match tool.kind {
|
||||
ToolKind::Sword => "Sword",
|
||||
ToolKind::Axe => "Axe",
|
||||
ToolKind::Hammer => "Hammer",
|
||||
ToolKind::Bow => "Bow",
|
||||
ToolKind::Dagger => "Dagger",
|
||||
ToolKind::Staff => "Staff",
|
||||
ToolKind::Sceptre => "Sceptre",
|
||||
ToolKind::Shield => "Shield",
|
||||
ToolKind::Spear => "Spear",
|
||||
ToolKind::HammerSimple => "HammerSimple",
|
||||
ToolKind::SwordSimple => "SwordSimple",
|
||||
ToolKind::StaffSimple => "StaffSimple",
|
||||
ToolKind::AxeSimple => "AxeSimple",
|
||||
ToolKind::BowSimple => "BowSimple",
|
||||
ToolKind::Unique(_) => "Unique",
|
||||
ToolKind::Debug => "Debug",
|
||||
ToolKind::Farming => "Farming Tool",
|
||||
ToolKind::Pick => "Pickaxe",
|
||||
ToolKind::Empty => "Empty",
|
||||
ToolKind::Sword => i18n.get("common.weapons.sword"),
|
||||
ToolKind::Axe => i18n.get("common.weapons.axe"),
|
||||
ToolKind::Hammer => i18n.get("common.weapons.hammer"),
|
||||
ToolKind::Bow => i18n.get("common.weapons.bow"),
|
||||
ToolKind::Dagger => i18n.get("common.weapons.dagger"),
|
||||
ToolKind::Staff => i18n.get("common.weapons.staff"),
|
||||
ToolKind::Sceptre => i18n.get("common.weapons.sceptre"),
|
||||
ToolKind::Shield => i18n.get("common.weapons.shield"),
|
||||
ToolKind::Spear => i18n.get("common.weapons.spear"),
|
||||
ToolKind::HammerSimple => i18n.get("common.weapons.hammer_simple"),
|
||||
ToolKind::SwordSimple => i18n.get("common.weapons.sword_simple"),
|
||||
ToolKind::StaffSimple => i18n.get("common.weapons.staff_simple"),
|
||||
ToolKind::AxeSimple => i18n.get("common.weapons.axe_simple"),
|
||||
ToolKind::BowSimple => i18n.get("common.weapons.bow_simple"),
|
||||
ToolKind::Unique(_) => i18n.get("common.weapons.unique_simple"),
|
||||
ToolKind::Debug => i18n.get("common.tool.debug"),
|
||||
ToolKind::Farming => i18n.get("common.tool.farming"),
|
||||
ToolKind::Pick => i18n.get("common.tool.pick"),
|
||||
ToolKind::Empty => i18n.get("common.empty"),
|
||||
};
|
||||
kind.to_string()
|
||||
}
|
||||
@ -290,10 +299,10 @@ pub fn tool_stats(tool: &Tool, components: &[Item], msm: &MaterialStatManifest)
|
||||
statblock_desc(&stats)
|
||||
}
|
||||
|
||||
pub fn tool_hands(tool: &Tool) -> String {
|
||||
pub fn tool_hands(tool: &Tool, i18n: &Localization) -> String {
|
||||
let hands = match tool.hands {
|
||||
Hands::One => "One-Handed",
|
||||
Hands::Two => "Two-Handed",
|
||||
Hands::One => i18n.get("common.hands.one"),
|
||||
Hands::Two => i18n.get("common.hands.two"),
|
||||
};
|
||||
hands.to_string()
|
||||
}
|
||||
@ -312,10 +321,11 @@ pub fn tool_desc(
|
||||
components: &[Item],
|
||||
msm: &MaterialStatManifest,
|
||||
desc: &str,
|
||||
i18n: &Localization,
|
||||
) -> String {
|
||||
let kind = tool_kind(tool);
|
||||
let kind = tool_kind(tool, i18n);
|
||||
//let poise_strength = tool.base_poise_strength();
|
||||
let hands = tool_hands(tool);
|
||||
let hands = tool_hands(tool, i18n);
|
||||
let stats = tool_stats(tool, components, msm);
|
||||
let usetext = use_text(&ItemKind::Tool(tool.clone()));
|
||||
let mut componentstext: String = "".to_string();
|
||||
|
@ -1,9 +1,12 @@
|
||||
use super::image_frame::ImageFrame;
|
||||
use crate::hud::{
|
||||
get_quality_col,
|
||||
img_ids::Imgs,
|
||||
item_imgs::{animate_by_pulse, ItemImgs, ItemKey},
|
||||
util,
|
||||
use crate::{
|
||||
hud::{
|
||||
get_quality_col,
|
||||
img_ids::Imgs,
|
||||
item_imgs::{animate_by_pulse, ItemImgs, ItemKey},
|
||||
util,
|
||||
},
|
||||
i18n::Localization,
|
||||
};
|
||||
use client::Client;
|
||||
use common::comp::item::{
|
||||
@ -277,6 +280,7 @@ pub struct ItemTooltip<'a> {
|
||||
imgs: &'a Imgs,
|
||||
item_imgs: &'a ItemImgs,
|
||||
pulse: f32,
|
||||
localized_strings: &'a Localization,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, WidgetStyle)]
|
||||
@ -335,6 +339,7 @@ impl<'a> ItemTooltip<'a> {
|
||||
item_imgs: &'a ItemImgs,
|
||||
pulse: f32,
|
||||
msm: &'a MaterialStatManifest,
|
||||
localized_strings: &'a Localization,
|
||||
) -> Self {
|
||||
ItemTooltip {
|
||||
common: widget::CommonBuilder::default(),
|
||||
@ -349,6 +354,7 @@ impl<'a> ItemTooltip<'a> {
|
||||
imgs: &imgs,
|
||||
item_imgs: &item_imgs,
|
||||
pulse,
|
||||
localized_strings,
|
||||
}
|
||||
}
|
||||
|
||||
@ -434,6 +440,8 @@ impl<'a> Widget for ItemTooltip<'a> {
|
||||
count as usize
|
||||
}
|
||||
|
||||
let i18n = &self.localized_strings;
|
||||
|
||||
let inventories = self.client.inventories();
|
||||
let inventory = match inventories.get(self.client.entity()) {
|
||||
Some(l) => l,
|
||||
@ -448,7 +456,7 @@ impl<'a> Widget for ItemTooltip<'a> {
|
||||
|
||||
let (title, desc) = (item.name().to_string(), item.description().to_string());
|
||||
|
||||
let subtitle = util::kind_text(item.kind());
|
||||
let subtitle = util::kind_text(item.kind(), i18n);
|
||||
|
||||
let text_color = conrod_core::color::WHITE;
|
||||
|
||||
@ -568,7 +576,7 @@ impl<'a> Widget for ItemTooltip<'a> {
|
||||
.right_from(state.ids.item_frame, V_PAD)
|
||||
.set(state.ids.main_stat, ui);
|
||||
|
||||
widget::Text::new(&"DPS".to_string())
|
||||
widget::Text::new(i18n.get("common.stats.dps"))
|
||||
.graphics_for(id)
|
||||
.parent(id)
|
||||
.with_style(self.style.desc)
|
||||
@ -578,50 +586,70 @@ impl<'a> Widget for ItemTooltip<'a> {
|
||||
.set(state.ids.main_stat_text, ui);
|
||||
|
||||
// Power
|
||||
widget::Text::new(&format!("- Power : {:.1}", power))
|
||||
.x_align_to(state.ids.item_frame, conrod_core::position::Align::Start)
|
||||
.graphics_for(id)
|
||||
.parent(id)
|
||||
.with_style(self.style.desc)
|
||||
.color(text_color)
|
||||
.down_from(state.ids.item_frame, V_PAD_STATS)
|
||||
.set(state.ids.stats[0], ui);
|
||||
widget::Text::new(&format!(
|
||||
"- {} : {:.1}",
|
||||
i18n.get("common.stats.power"),
|
||||
power
|
||||
))
|
||||
.x_align_to(state.ids.item_frame, conrod_core::position::Align::Start)
|
||||
.graphics_for(id)
|
||||
.parent(id)
|
||||
.with_style(self.style.desc)
|
||||
.color(text_color)
|
||||
.down_from(state.ids.item_frame, V_PAD_STATS)
|
||||
.set(state.ids.stats[0], ui);
|
||||
|
||||
// Speed
|
||||
widget::Text::new(&format!("- Speed : {:.1}", speed))
|
||||
.graphics_for(id)
|
||||
.parent(id)
|
||||
.with_style(self.style.desc)
|
||||
.color(text_color)
|
||||
.down_from(state.ids.stats[0], V_PAD_STATS)
|
||||
.set(state.ids.stats[1], ui);
|
||||
widget::Text::new(&format!(
|
||||
"- {} : {:.1}",
|
||||
i18n.get("common.stats.speed"),
|
||||
speed
|
||||
))
|
||||
.graphics_for(id)
|
||||
.parent(id)
|
||||
.with_style(self.style.desc)
|
||||
.color(text_color)
|
||||
.down_from(state.ids.stats[0], V_PAD_STATS)
|
||||
.set(state.ids.stats[1], ui);
|
||||
|
||||
// Poise
|
||||
widget::Text::new(&format!("- Poise : {:.1}", poise_str))
|
||||
.graphics_for(id)
|
||||
.parent(id)
|
||||
.with_style(self.style.desc)
|
||||
.color(text_color)
|
||||
.down_from(state.ids.stats[1], V_PAD_STATS)
|
||||
.set(state.ids.stats[2], ui);
|
||||
widget::Text::new(&format!(
|
||||
"- {} : {:.1}",
|
||||
i18n.get("common.stats.poise"),
|
||||
poise_str
|
||||
))
|
||||
.graphics_for(id)
|
||||
.parent(id)
|
||||
.with_style(self.style.desc)
|
||||
.color(text_color)
|
||||
.down_from(state.ids.stats[1], V_PAD_STATS)
|
||||
.set(state.ids.stats[2], ui);
|
||||
|
||||
// Crit chance
|
||||
widget::Text::new(&format!("- Crit Chance : {:.1}%", crit_chance))
|
||||
.graphics_for(id)
|
||||
.parent(id)
|
||||
.with_style(self.style.desc)
|
||||
.color(text_color)
|
||||
.down_from(state.ids.stats[2], V_PAD_STATS)
|
||||
.set(state.ids.stats[3], ui);
|
||||
widget::Text::new(&format!(
|
||||
"- {} : {:.1}%",
|
||||
i18n.get("common.stats.crit_chance"),
|
||||
crit_chance
|
||||
))
|
||||
.graphics_for(id)
|
||||
.parent(id)
|
||||
.with_style(self.style.desc)
|
||||
.color(text_color)
|
||||
.down_from(state.ids.stats[2], V_PAD_STATS)
|
||||
.set(state.ids.stats[3], ui);
|
||||
|
||||
// Crit mult
|
||||
widget::Text::new(&format!("- Crit Mult : x{:.1}", crit_mult))
|
||||
.graphics_for(id)
|
||||
.parent(id)
|
||||
.with_style(self.style.desc)
|
||||
.color(text_color)
|
||||
.down_from(state.ids.stats[3], V_PAD_STATS)
|
||||
.set(state.ids.stats[4], ui);
|
||||
widget::Text::new(&format!(
|
||||
"- {} : x{:.1}",
|
||||
i18n.get("common.stats.crit_mult"),
|
||||
crit_mult
|
||||
))
|
||||
.graphics_for(id)
|
||||
.parent(id)
|
||||
.with_style(self.style.desc)
|
||||
.color(text_color)
|
||||
.down_from(state.ids.stats[3], V_PAD_STATS)
|
||||
.set(state.ids.stats[4], ui);
|
||||
if let Some(equipped_item) = equip_slot.cloned().next() {
|
||||
if let ItemKind::Tool(equipped_tool) = equipped_item.kind() {
|
||||
let tool_stats = tool
|
||||
@ -756,7 +784,7 @@ impl<'a> Widget for ItemTooltip<'a> {
|
||||
.right_from(state.ids.item_frame, V_PAD)
|
||||
.set(state.ids.main_stat, ui);
|
||||
|
||||
widget::Text::new(&"Armor".to_string())
|
||||
widget::Text::new(i18n.get("common.stats.armor"))
|
||||
.graphics_for(id)
|
||||
.parent(id)
|
||||
.with_style(self.style.desc)
|
||||
@ -766,24 +794,32 @@ impl<'a> Widget for ItemTooltip<'a> {
|
||||
.set(state.ids.main_stat_text, ui);
|
||||
|
||||
// Poise res
|
||||
widget::Text::new(&format!("- Poise res : {}", util::protec2string(poise_res)))
|
||||
widget::Text::new(&format!(
|
||||
"- {} : {}",
|
||||
i18n.get("common.stats.poise_res"),
|
||||
util::protec2string(poise_res)
|
||||
))
|
||||
.graphics_for(id)
|
||||
.parent(id)
|
||||
.with_style(self.style.desc)
|
||||
.color(text_color)
|
||||
.x_align_to(state.ids.item_frame, conrod_core::position::Align::Start)
|
||||
.set(state.ids.stats[0], ui);
|
||||
|
||||
// Slots
|
||||
if item.num_slots() > 0 {
|
||||
widget::Text::new(&format!(
|
||||
"- {} : {}",
|
||||
i18n.get("common.stats.slots"),
|
||||
item.num_slots()
|
||||
))
|
||||
.graphics_for(id)
|
||||
.parent(id)
|
||||
.with_style(self.style.desc)
|
||||
.color(text_color)
|
||||
.x_align_to(state.ids.item_frame, conrod_core::position::Align::Start)
|
||||
.set(state.ids.stats[0], ui);
|
||||
|
||||
// Slots
|
||||
if item.num_slots() > 0 {
|
||||
widget::Text::new(&format!("- Slots : {}", item.num_slots()))
|
||||
.graphics_for(id)
|
||||
.parent(id)
|
||||
.with_style(self.style.desc)
|
||||
.color(text_color)
|
||||
.x_align_to(state.ids.item_frame, conrod_core::position::Align::Start)
|
||||
.down_from(state.ids.stats[0], V_PAD_STATS)
|
||||
.set(state.ids.stats[1], ui);
|
||||
.down_from(state.ids.stats[0], V_PAD_STATS)
|
||||
.set(state.ids.stats[1], ui);
|
||||
}
|
||||
|
||||
if let Some(equipped_item) = equip_slot.cloned().next() {
|
||||
@ -841,7 +877,7 @@ impl<'a> Widget for ItemTooltip<'a> {
|
||||
}
|
||||
},
|
||||
ItemKind::Consumable { effect, .. } => {
|
||||
widget::Text::new(&util::consumable_desc(effect))
|
||||
widget::Text::new(&util::consumable_desc(effect, i18n))
|
||||
.x_align_to(state.ids.item_frame, conrod_core::position::Align::Start)
|
||||
.graphics_for(id)
|
||||
.parent(id)
|
||||
|
Loading…
Reference in New Issue
Block a user