mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Rename ItemL10n to ItemI18n
This commit is contained in:
parent
db569513f3
commit
d3fcade857
@ -489,7 +489,7 @@ type I18nId = String;
|
|||||||
// TODO: probably make a Resource if used outside of voxygen
|
// TODO: probably make a Resource if used outside of voxygen
|
||||||
// TODO: add hot-reloading similar to how ItemImgs does it?
|
// TODO: add hot-reloading similar to how ItemImgs does it?
|
||||||
// TODO: make it work with plugins (via Concatenate?)
|
// TODO: make it work with plugins (via Concatenate?)
|
||||||
/// To be used with ItemDesc::l10n
|
/// To be used with ItemDesc::i18n
|
||||||
///
|
///
|
||||||
/// NOTE: there is a limitation to this manifest, as it uses ItemKey and
|
/// NOTE: there is a limitation to this manifest, as it uses ItemKey and
|
||||||
/// ItemKey isn't uniquely identifies Item, when it comes to modular items.
|
/// ItemKey isn't uniquely identifies Item, when it comes to modular items.
|
||||||
@ -501,19 +501,23 @@ type I18nId = String;
|
|||||||
/// Translations currently do the same, but *maybe* they shouldn't in which case
|
/// Translations currently do the same, but *maybe* they shouldn't in which case
|
||||||
/// we should either extend ItemKey or use new identifier. We could use
|
/// we should either extend ItemKey or use new identifier. We could use
|
||||||
/// ItemDefinitionId, but it's very generic and cumbersome.
|
/// ItemDefinitionId, but it's very generic and cumbersome.
|
||||||
pub struct ItemL10n {
|
pub struct ItemI18n {
|
||||||
/// maps ItemKey to i18n identifier
|
/// maps ItemKey to i18n identifier
|
||||||
map: HashMap<ItemKey, I18nId>,
|
map: HashMap<ItemKey, I18nId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl assets::Asset for ItemL10n {
|
impl assets::Asset for ItemI18n {
|
||||||
type Loader = assets::RonLoader;
|
type Loader = assets::RonLoader;
|
||||||
|
|
||||||
const EXTENSION: &'static str = "ron";
|
const EXTENSION: &'static str = "ron";
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ItemL10n {
|
impl ItemI18n {
|
||||||
pub fn new_expect() -> Self { ItemL10n::load_expect("common.item_l10n").read().clone() }
|
pub fn new_expect() -> Self {
|
||||||
|
ItemI18n::load_expect("common.item_i18n_manifest")
|
||||||
|
.read()
|
||||||
|
.clone()
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns (name, description) in Content form.
|
/// Returns (name, description) in Content form.
|
||||||
// TODO: after we remove legacy text from ItemDef, consider making this
|
// TODO: after we remove legacy text from ItemDef, consider making this
|
||||||
@ -1482,11 +1486,11 @@ pub trait ItemDesc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Return name's and description's localization descriptors
|
/// Return name's and description's localization descriptors
|
||||||
fn l10n(&self, l10n: &ItemL10n) -> (Content, Content) {
|
fn i18n(&self, i18n: &ItemI18n) -> (Content, Content) {
|
||||||
let item_key: ItemKey = self.into();
|
let item_key: ItemKey = self.into();
|
||||||
|
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
l10n.item_text_opt(item_key).unwrap_or_else(|| {
|
i18n.item_text_opt(item_key).unwrap_or_else(|| {
|
||||||
(
|
(
|
||||||
Content::Plain(self.name().to_string()),
|
Content::Plain(self.name().to_string()),
|
||||||
Content::Plain(self.description().to_string()),
|
Content::Plain(self.description().to_string()),
|
||||||
@ -1743,7 +1747,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_item_l10n() { let _ = ItemL10n::new_expect(); }
|
fn test_item_i18n() { let _ = ItemI18n::new_expect(); }
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
// Probably can't fail, but better safe than crashing production server
|
// Probably can't fail, but better safe than crashing production server
|
||||||
@ -1753,7 +1757,7 @@ mod tests {
|
|||||||
// All items in Veloren should have localization.
|
// All items in Veloren should have localization.
|
||||||
// If no, add some common dummy i18n id.
|
// If no, add some common dummy i18n id.
|
||||||
fn ensure_item_localization() {
|
fn ensure_item_localization() {
|
||||||
let manifest = ItemL10n::new_expect();
|
let manifest = ItemI18n::new_expect();
|
||||||
let items = all_items_expect();
|
let items = all_items_expect();
|
||||||
for item in items {
|
for item in items {
|
||||||
let item_key: ItemKey = (&item).into();
|
let item_key: ItemKey = (&item).into();
|
||||||
|
@ -21,7 +21,7 @@ use common::{
|
|||||||
combat::{combat_rating, perception_dist_multiplier_from_stealth, Damage},
|
combat::{combat_rating, perception_dist_multiplier_from_stealth, Damage},
|
||||||
comp::{
|
comp::{
|
||||||
inventory::InventorySortOrder,
|
inventory::InventorySortOrder,
|
||||||
item::{ItemDef, ItemDesc, ItemL10n, MaterialStatManifest, Quality},
|
item::{ItemDef, ItemDesc, ItemI18n, MaterialStatManifest, Quality},
|
||||||
Body, Energy, Health, Inventory, Poise, SkillSet, Stats,
|
Body, Energy, Health, Inventory, Poise, SkillSet, Stats,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -81,7 +81,7 @@ pub struct InventoryScroller<'a> {
|
|||||||
slot_manager: &'a mut SlotManager,
|
slot_manager: &'a mut SlotManager,
|
||||||
pulse: f32,
|
pulse: f32,
|
||||||
localized_strings: &'a Localization,
|
localized_strings: &'a Localization,
|
||||||
item_l10n: &'a ItemL10n,
|
item_i18n: &'a ItemI18n,
|
||||||
show_stats: bool,
|
show_stats: bool,
|
||||||
show_bag_inv: bool,
|
show_bag_inv: bool,
|
||||||
on_right: bool,
|
on_right: bool,
|
||||||
@ -106,7 +106,7 @@ impl<'a> InventoryScroller<'a> {
|
|||||||
slot_manager: &'a mut SlotManager,
|
slot_manager: &'a mut SlotManager,
|
||||||
pulse: f32,
|
pulse: f32,
|
||||||
localized_strings: &'a Localization,
|
localized_strings: &'a Localization,
|
||||||
item_l10n: &'a ItemL10n,
|
item_i18n: &'a ItemI18n,
|
||||||
show_stats: bool,
|
show_stats: bool,
|
||||||
show_bag_inv: bool,
|
show_bag_inv: bool,
|
||||||
on_right: bool,
|
on_right: bool,
|
||||||
@ -129,7 +129,7 @@ impl<'a> InventoryScroller<'a> {
|
|||||||
slot_manager,
|
slot_manager,
|
||||||
pulse,
|
pulse,
|
||||||
localized_strings,
|
localized_strings,
|
||||||
item_l10n,
|
item_i18n,
|
||||||
show_stats,
|
show_stats,
|
||||||
show_bag_inv,
|
show_bag_inv,
|
||||||
on_right,
|
on_right,
|
||||||
@ -374,7 +374,7 @@ impl<'a> InventoryScroller<'a> {
|
|||||||
{
|
{
|
||||||
// TODO: we do double the work here, optimize?
|
// TODO: we do double the work here, optimize?
|
||||||
let (name, _) =
|
let (name, _) =
|
||||||
util::item_text(i, self.localized_strings, self.item_l10n);
|
util::item_text(i, self.localized_strings, self.item_i18n);
|
||||||
name
|
name
|
||||||
},
|
},
|
||||||
i.amount(),
|
i.amount(),
|
||||||
@ -470,7 +470,7 @@ impl<'a> InventoryScroller<'a> {
|
|||||||
.set(state.ids.inv_slots[i], ui);
|
.set(state.ids.inv_slots[i], ui);
|
||||||
}
|
}
|
||||||
if self.details_mode {
|
if self.details_mode {
|
||||||
let (name, _) = util::item_text(item, self.localized_strings, self.item_l10n);
|
let (name, _) = util::item_text(item, self.localized_strings, self.item_i18n);
|
||||||
Text::new(&name)
|
Text::new(&name)
|
||||||
.top_left_with_margins_on(
|
.top_left_with_margins_on(
|
||||||
state.ids.inv_alignment,
|
state.ids.inv_alignment,
|
||||||
@ -652,7 +652,7 @@ pub struct Bag<'a> {
|
|||||||
slot_manager: &'a mut SlotManager,
|
slot_manager: &'a mut SlotManager,
|
||||||
pulse: f32,
|
pulse: f32,
|
||||||
localized_strings: &'a Localization,
|
localized_strings: &'a Localization,
|
||||||
item_l10n: &'a ItemL10n,
|
item_i18n: &'a ItemI18n,
|
||||||
stats: &'a Stats,
|
stats: &'a Stats,
|
||||||
skill_set: &'a SkillSet,
|
skill_set: &'a SkillSet,
|
||||||
health: &'a Health,
|
health: &'a Health,
|
||||||
@ -678,7 +678,7 @@ impl<'a> Bag<'a> {
|
|||||||
slot_manager: &'a mut SlotManager,
|
slot_manager: &'a mut SlotManager,
|
||||||
pulse: f32,
|
pulse: f32,
|
||||||
localized_strings: &'a Localization,
|
localized_strings: &'a Localization,
|
||||||
item_l10n: &'a ItemL10n,
|
item_i18n: &'a ItemI18n,
|
||||||
stats: &'a Stats,
|
stats: &'a Stats,
|
||||||
skill_set: &'a SkillSet,
|
skill_set: &'a SkillSet,
|
||||||
health: &'a Health,
|
health: &'a Health,
|
||||||
@ -702,7 +702,7 @@ impl<'a> Bag<'a> {
|
|||||||
slot_manager,
|
slot_manager,
|
||||||
pulse,
|
pulse,
|
||||||
localized_strings,
|
localized_strings,
|
||||||
item_l10n,
|
item_i18n,
|
||||||
stats,
|
stats,
|
||||||
skill_set,
|
skill_set,
|
||||||
energy,
|
energy,
|
||||||
@ -822,7 +822,7 @@ impl<'a> Widget for Bag<'a> {
|
|||||||
self.pulse,
|
self.pulse,
|
||||||
self.msm,
|
self.msm,
|
||||||
self.localized_strings,
|
self.localized_strings,
|
||||||
self.item_l10n,
|
self.item_i18n,
|
||||||
)
|
)
|
||||||
.title_font_size(self.fonts.cyri.scale(20))
|
.title_font_size(self.fonts.cyri.scale(20))
|
||||||
.parent(ui.window)
|
.parent(ui.window)
|
||||||
@ -839,7 +839,7 @@ impl<'a> Widget for Bag<'a> {
|
|||||||
self.slot_manager,
|
self.slot_manager,
|
||||||
self.pulse,
|
self.pulse,
|
||||||
self.localized_strings,
|
self.localized_strings,
|
||||||
self.item_l10n,
|
self.item_i18n,
|
||||||
self.show.stats,
|
self.show.stats,
|
||||||
self.show.bag_inv,
|
self.show.bag_inv,
|
||||||
true,
|
true,
|
||||||
|
@ -19,7 +19,7 @@ use common::{
|
|||||||
item_key::ItemKey,
|
item_key::ItemKey,
|
||||||
modular::{self, ModularComponent},
|
modular::{self, ModularComponent},
|
||||||
tool::{AbilityMap, ToolKind},
|
tool::{AbilityMap, ToolKind},
|
||||||
Item, ItemBase, ItemDef, ItemDesc, ItemKind, ItemL10n, ItemTag, MaterialStatManifest,
|
Item, ItemBase, ItemDef, ItemDesc, ItemI18n, ItemKind, ItemTag, MaterialStatManifest,
|
||||||
Quality, TagExampleInfo,
|
Quality, TagExampleInfo,
|
||||||
},
|
},
|
||||||
slot::{InvSlotId, Slot},
|
slot::{InvSlotId, Slot},
|
||||||
@ -151,7 +151,7 @@ pub struct Crafting<'a> {
|
|||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
fonts: &'a Fonts,
|
fonts: &'a Fonts,
|
||||||
localized_strings: &'a Localization,
|
localized_strings: &'a Localization,
|
||||||
item_l10n: &'a ItemL10n,
|
item_i18n: &'a ItemI18n,
|
||||||
pulse: f32,
|
pulse: f32,
|
||||||
rot_imgs: &'a ImgsRot,
|
rot_imgs: &'a ImgsRot,
|
||||||
item_tooltip_manager: &'a mut ItemTooltipManager,
|
item_tooltip_manager: &'a mut ItemTooltipManager,
|
||||||
@ -172,7 +172,7 @@ impl<'a> Crafting<'a> {
|
|||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
fonts: &'a Fonts,
|
fonts: &'a Fonts,
|
||||||
localized_strings: &'a Localization,
|
localized_strings: &'a Localization,
|
||||||
item_l10n: &'a ItemL10n,
|
item_i18n: &'a ItemI18n,
|
||||||
pulse: f32,
|
pulse: f32,
|
||||||
rot_imgs: &'a ImgsRot,
|
rot_imgs: &'a ImgsRot,
|
||||||
item_tooltip_manager: &'a mut ItemTooltipManager,
|
item_tooltip_manager: &'a mut ItemTooltipManager,
|
||||||
@ -189,7 +189,7 @@ impl<'a> Crafting<'a> {
|
|||||||
imgs,
|
imgs,
|
||||||
fonts,
|
fonts,
|
||||||
localized_strings,
|
localized_strings,
|
||||||
item_l10n,
|
item_i18n,
|
||||||
pulse,
|
pulse,
|
||||||
rot_imgs,
|
rot_imgs,
|
||||||
item_tooltip_manager,
|
item_tooltip_manager,
|
||||||
@ -358,7 +358,7 @@ impl<'a> Widget for Crafting<'a> {
|
|||||||
self.pulse,
|
self.pulse,
|
||||||
self.msm,
|
self.msm,
|
||||||
self.localized_strings,
|
self.localized_strings,
|
||||||
self.item_l10n,
|
self.item_i18n,
|
||||||
)
|
)
|
||||||
.title_font_size(self.fonts.cyri.scale(20))
|
.title_font_size(self.fonts.cyri.scale(20))
|
||||||
.parent(ui.window)
|
.parent(ui.window)
|
||||||
@ -745,7 +745,7 @@ impl<'a> Widget for Crafting<'a> {
|
|||||||
(title, _) = util::item_text(
|
(title, _) = util::item_text(
|
||||||
recipe.output.0.as_ref(),
|
recipe.output.0.as_ref(),
|
||||||
self.localized_strings,
|
self.localized_strings,
|
||||||
self.item_l10n,
|
self.item_i18n,
|
||||||
);
|
);
|
||||||
&title
|
&title
|
||||||
};
|
};
|
||||||
@ -874,7 +874,7 @@ impl<'a> Widget for Crafting<'a> {
|
|||||||
(title, _) = util::item_text(
|
(title, _) = util::item_text(
|
||||||
recipe.output.0.as_ref(),
|
recipe.output.0.as_ref(),
|
||||||
self.localized_strings,
|
self.localized_strings,
|
||||||
self.item_l10n,
|
self.item_i18n,
|
||||||
);
|
);
|
||||||
&title
|
&title
|
||||||
};
|
};
|
||||||
@ -1239,7 +1239,7 @@ impl<'a> Widget for Crafting<'a> {
|
|||||||
|
|
||||||
if let Some(output_item) = output_item {
|
if let Some(output_item) = output_item {
|
||||||
let (name, _) =
|
let (name, _) =
|
||||||
util::item_text(&output_item, self.localized_strings, self.item_l10n);
|
util::item_text(&output_item, self.localized_strings, self.item_i18n);
|
||||||
Button::image(animate_by_pulse(
|
Button::image(animate_by_pulse(
|
||||||
&self
|
&self
|
||||||
.item_imgs
|
.item_imgs
|
||||||
@ -1994,7 +1994,7 @@ impl<'a> Widget for Crafting<'a> {
|
|||||||
let (name, _) = util::item_text(
|
let (name, _) = util::item_text(
|
||||||
item_def.as_ref(),
|
item_def.as_ref(),
|
||||||
self.localized_strings,
|
self.localized_strings,
|
||||||
self.item_l10n,
|
self.item_i18n,
|
||||||
);
|
);
|
||||||
Text::new(&name)
|
Text::new(&name)
|
||||||
.right_from(state.ids.ingredient_frame[i], 10.0)
|
.right_from(state.ids.ingredient_frame[i], 10.0)
|
||||||
@ -2009,7 +2009,7 @@ impl<'a> Widget for Crafting<'a> {
|
|||||||
let (name, _) = util::item_text(
|
let (name, _) = util::item_text(
|
||||||
item_def.as_ref(),
|
item_def.as_ref(),
|
||||||
self.localized_strings,
|
self.localized_strings,
|
||||||
self.item_l10n,
|
self.item_i18n,
|
||||||
);
|
);
|
||||||
|
|
||||||
name
|
name
|
||||||
@ -2028,7 +2028,7 @@ impl<'a> Widget for Crafting<'a> {
|
|||||||
let (name, _) = util::item_text(
|
let (name, _) = util::item_text(
|
||||||
def.as_ref(),
|
def.as_ref(),
|
||||||
self.localized_strings,
|
self.localized_strings,
|
||||||
self.item_l10n,
|
self.item_i18n,
|
||||||
);
|
);
|
||||||
|
|
||||||
name
|
name
|
||||||
|
@ -6,7 +6,7 @@ use super::{
|
|||||||
};
|
};
|
||||||
use crate::ui::{fonts::Fonts, ImageFrame, ItemTooltip, ItemTooltipManager, ItemTooltipable};
|
use crate::ui::{fonts::Fonts, ImageFrame, ItemTooltip, ItemTooltipManager, ItemTooltipable};
|
||||||
use client::Client;
|
use client::Client;
|
||||||
use common::comp::inventory::item::{Item, ItemDesc, ItemL10n, MaterialStatManifest, Quality};
|
use common::comp::inventory::item::{Item, ItemDesc, ItemI18n, MaterialStatManifest, Quality};
|
||||||
use conrod_core::{
|
use conrod_core::{
|
||||||
color,
|
color,
|
||||||
position::Dimension,
|
position::Dimension,
|
||||||
@ -58,7 +58,7 @@ pub struct LootScroller<'a> {
|
|||||||
rot_imgs: &'a ImgsRot,
|
rot_imgs: &'a ImgsRot,
|
||||||
fonts: &'a Fonts,
|
fonts: &'a Fonts,
|
||||||
localized_strings: &'a Localization,
|
localized_strings: &'a Localization,
|
||||||
item_l10n: &'a ItemL10n,
|
item_i18n: &'a ItemI18n,
|
||||||
msm: &'a MaterialStatManifest,
|
msm: &'a MaterialStatManifest,
|
||||||
item_tooltip_manager: &'a mut ItemTooltipManager,
|
item_tooltip_manager: &'a mut ItemTooltipManager,
|
||||||
pulse: f32,
|
pulse: f32,
|
||||||
@ -77,7 +77,7 @@ impl<'a> LootScroller<'a> {
|
|||||||
rot_imgs: &'a ImgsRot,
|
rot_imgs: &'a ImgsRot,
|
||||||
fonts: &'a Fonts,
|
fonts: &'a Fonts,
|
||||||
localized_strings: &'a Localization,
|
localized_strings: &'a Localization,
|
||||||
item_l10n: &'a ItemL10n,
|
item_i18n: &'a ItemI18n,
|
||||||
msm: &'a MaterialStatManifest,
|
msm: &'a MaterialStatManifest,
|
||||||
item_tooltip_manager: &'a mut ItemTooltipManager,
|
item_tooltip_manager: &'a mut ItemTooltipManager,
|
||||||
pulse: f32,
|
pulse: f32,
|
||||||
@ -92,7 +92,7 @@ impl<'a> LootScroller<'a> {
|
|||||||
rot_imgs,
|
rot_imgs,
|
||||||
fonts,
|
fonts,
|
||||||
localized_strings,
|
localized_strings,
|
||||||
item_l10n,
|
item_i18n,
|
||||||
msm,
|
msm,
|
||||||
item_tooltip_manager,
|
item_tooltip_manager,
|
||||||
pulse,
|
pulse,
|
||||||
@ -156,7 +156,7 @@ impl<'a> Widget for LootScroller<'a> {
|
|||||||
self.pulse,
|
self.pulse,
|
||||||
self.msm,
|
self.msm,
|
||||||
self.localized_strings,
|
self.localized_strings,
|
||||||
self.item_l10n,
|
self.item_i18n,
|
||||||
)
|
)
|
||||||
.title_font_size(self.fonts.cyri.scale(20))
|
.title_font_size(self.fonts.cyri.scale(20))
|
||||||
.parent(ui.window)
|
.parent(ui.window)
|
||||||
@ -357,7 +357,7 @@ impl<'a> Widget for LootScroller<'a> {
|
|||||||
"amount" => amount,
|
"amount" => amount,
|
||||||
"item" => {
|
"item" => {
|
||||||
let (name, _) =
|
let (name, _) =
|
||||||
util::item_text(&item, self.localized_strings, self.item_l10n);
|
util::item_text(&item, self.localized_strings, self.item_i18n);
|
||||||
name
|
name
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -98,7 +98,7 @@ use common::{
|
|||||||
},
|
},
|
||||||
item::{
|
item::{
|
||||||
tool::{AbilityContext, ToolKind},
|
tool::{AbilityContext, ToolKind},
|
||||||
ItemDefinitionIdOwned, ItemDesc, ItemL10n, MaterialStatManifest, Quality,
|
ItemDefinitionIdOwned, ItemDesc, ItemI18n, MaterialStatManifest, Quality,
|
||||||
},
|
},
|
||||||
loot_owner::LootOwnerKind,
|
loot_owner::LootOwnerKind,
|
||||||
pet::is_mountable,
|
pet::is_mountable,
|
||||||
@ -1286,7 +1286,7 @@ pub struct Hud {
|
|||||||
world_map: (/* Id */ Vec<Rotations>, Vec2<u32>),
|
world_map: (/* Id */ Vec<Rotations>, Vec2<u32>),
|
||||||
imgs: Imgs,
|
imgs: Imgs,
|
||||||
item_imgs: ItemImgs,
|
item_imgs: ItemImgs,
|
||||||
item_l10n: ItemL10n,
|
item_i18n: ItemI18n,
|
||||||
fonts: Fonts,
|
fonts: Fonts,
|
||||||
rot_imgs: ImgsRot,
|
rot_imgs: ImgsRot,
|
||||||
failed_block_pickups: HashMap<VolumePos, CollectFailedData>,
|
failed_block_pickups: HashMap<VolumePos, CollectFailedData>,
|
||||||
@ -1343,7 +1343,7 @@ impl Hud {
|
|||||||
// Load item images.
|
// Load item images.
|
||||||
let item_imgs = ItemImgs::new(&mut ui, imgs.not_found);
|
let item_imgs = ItemImgs::new(&mut ui, imgs.not_found);
|
||||||
// Load item text ("reference" to name and description)
|
// Load item text ("reference" to name and description)
|
||||||
let item_l10n = ItemL10n::new_expect();
|
let item_i18n = ItemI18n::new_expect();
|
||||||
// Load fonts.
|
// Load fonts.
|
||||||
let fonts = Fonts::load(global_state.i18n.read().fonts(), &mut ui)
|
let fonts = Fonts::load(global_state.i18n.read().fonts(), &mut ui)
|
||||||
.expect("Impossible to load fonts!");
|
.expect("Impossible to load fonts!");
|
||||||
@ -1383,7 +1383,7 @@ impl Hud {
|
|||||||
world_map,
|
world_map,
|
||||||
rot_imgs,
|
rot_imgs,
|
||||||
item_imgs,
|
item_imgs,
|
||||||
item_l10n,
|
item_i18n,
|
||||||
fonts,
|
fonts,
|
||||||
ids,
|
ids,
|
||||||
failed_block_pickups: HashMap::default(),
|
failed_block_pickups: HashMap::default(),
|
||||||
@ -2012,7 +2012,7 @@ impl Hud {
|
|||||||
|
|
||||||
// Item
|
// Item
|
||||||
overitem::Overitem::new(
|
overitem::Overitem::new(
|
||||||
util::describe(item, i18n, &self.item_l10n).into(),
|
util::describe(item, i18n, &self.item_i18n).into(),
|
||||||
quality,
|
quality,
|
||||||
distance,
|
distance,
|
||||||
fonts,
|
fonts,
|
||||||
@ -2096,13 +2096,13 @@ impl Hud {
|
|||||||
},
|
},
|
||||||
BlockInteraction::Unlock(kind) => {
|
BlockInteraction::Unlock(kind) => {
|
||||||
let item_name = |item_id: &ItemDefinitionIdOwned| {
|
let item_name = |item_id: &ItemDefinitionIdOwned| {
|
||||||
// TODO: get ItemKey and use it with l10n?
|
// TODO: get ItemKey and use it with i18n?
|
||||||
item_id
|
item_id
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.itemdef_id()
|
.itemdef_id()
|
||||||
.map(|id| {
|
.map(|id| {
|
||||||
let item = Item::new_from_asset_expect(id);
|
let item = Item::new_from_asset_expect(id);
|
||||||
util::describe(&item, i18n, &self.item_l10n)
|
util::describe(&item, i18n, &self.item_i18n)
|
||||||
})
|
})
|
||||||
.unwrap_or_else(|| "modular item".to_string())
|
.unwrap_or_else(|| "modular item".to_string())
|
||||||
};
|
};
|
||||||
@ -3178,7 +3178,7 @@ impl Hud {
|
|||||||
item_tooltip_manager,
|
item_tooltip_manager,
|
||||||
&mut self.slot_manager,
|
&mut self.slot_manager,
|
||||||
i18n,
|
i18n,
|
||||||
&self.item_l10n,
|
&self.item_i18n,
|
||||||
&msm,
|
&msm,
|
||||||
self.floaters.combo_floater,
|
self.floaters.combo_floater,
|
||||||
&context,
|
&context,
|
||||||
@ -3226,7 +3226,7 @@ impl Hud {
|
|||||||
&mut self.slot_manager,
|
&mut self.slot_manager,
|
||||||
self.pulse,
|
self.pulse,
|
||||||
i18n,
|
i18n,
|
||||||
&self.item_l10n,
|
&self.item_i18n,
|
||||||
player_stats,
|
player_stats,
|
||||||
skill_set,
|
skill_set,
|
||||||
health,
|
health,
|
||||||
@ -3271,7 +3271,7 @@ impl Hud {
|
|||||||
item_tooltip_manager,
|
item_tooltip_manager,
|
||||||
&mut self.slot_manager,
|
&mut self.slot_manager,
|
||||||
i18n,
|
i18n,
|
||||||
&self.item_l10n,
|
&self.item_i18n,
|
||||||
&msm,
|
&msm,
|
||||||
self.pulse,
|
self.pulse,
|
||||||
&mut self.show,
|
&mut self.show,
|
||||||
@ -3352,7 +3352,7 @@ impl Hud {
|
|||||||
&self.imgs,
|
&self.imgs,
|
||||||
&self.fonts,
|
&self.fonts,
|
||||||
i18n,
|
i18n,
|
||||||
&self.item_l10n,
|
&self.item_i18n,
|
||||||
self.pulse,
|
self.pulse,
|
||||||
&self.rot_imgs,
|
&self.rot_imgs,
|
||||||
item_tooltip_manager,
|
item_tooltip_manager,
|
||||||
@ -3519,7 +3519,7 @@ impl Hud {
|
|||||||
&self.rot_imgs,
|
&self.rot_imgs,
|
||||||
&self.fonts,
|
&self.fonts,
|
||||||
i18n,
|
i18n,
|
||||||
&self.item_l10n,
|
&self.item_i18n,
|
||||||
&msm,
|
&msm,
|
||||||
item_tooltip_manager,
|
item_tooltip_manager,
|
||||||
self.pulse,
|
self.pulse,
|
||||||
|
@ -26,7 +26,7 @@ use common::comp::{
|
|||||||
ability::{AbilityInput, Stance},
|
ability::{AbilityInput, Stance},
|
||||||
item::{
|
item::{
|
||||||
tool::{AbilityContext, ToolKind},
|
tool::{AbilityContext, ToolKind},
|
||||||
ItemDesc, ItemL10n, MaterialStatManifest,
|
ItemDesc, ItemI18n, MaterialStatManifest,
|
||||||
},
|
},
|
||||||
skillset::SkillGroupKind,
|
skillset::SkillGroupKind,
|
||||||
Ability, ActiveAbilities, Body, CharacterState, Combo, Energy, Health, Inventory, Poise,
|
Ability, ActiveAbilities, Body, CharacterState, Combo, Energy, Health, Inventory, Poise,
|
||||||
@ -307,7 +307,7 @@ pub struct Skillbar<'a> {
|
|||||||
item_tooltip_manager: &'a mut ItemTooltipManager,
|
item_tooltip_manager: &'a mut ItemTooltipManager,
|
||||||
slot_manager: &'a mut slots::SlotManager,
|
slot_manager: &'a mut slots::SlotManager,
|
||||||
localized_strings: &'a Localization,
|
localized_strings: &'a Localization,
|
||||||
item_l10n: &'a ItemL10n,
|
item_i18n: &'a ItemI18n,
|
||||||
pulse: f32,
|
pulse: f32,
|
||||||
#[conrod(common_builder)]
|
#[conrod(common_builder)]
|
||||||
common: widget::CommonBuilder,
|
common: widget::CommonBuilder,
|
||||||
@ -344,7 +344,7 @@ impl<'a> Skillbar<'a> {
|
|||||||
item_tooltip_manager: &'a mut ItemTooltipManager,
|
item_tooltip_manager: &'a mut ItemTooltipManager,
|
||||||
slot_manager: &'a mut slots::SlotManager,
|
slot_manager: &'a mut slots::SlotManager,
|
||||||
localized_strings: &'a Localization,
|
localized_strings: &'a Localization,
|
||||||
item_l10n: &'a ItemL10n,
|
item_i18n: &'a ItemI18n,
|
||||||
msm: &'a MaterialStatManifest,
|
msm: &'a MaterialStatManifest,
|
||||||
combo_floater: Option<ComboFloater>,
|
combo_floater: Option<ComboFloater>,
|
||||||
context: &'a AbilityContext,
|
context: &'a AbilityContext,
|
||||||
@ -376,7 +376,7 @@ impl<'a> Skillbar<'a> {
|
|||||||
item_tooltip_manager,
|
item_tooltip_manager,
|
||||||
slot_manager,
|
slot_manager,
|
||||||
localized_strings,
|
localized_strings,
|
||||||
item_l10n,
|
item_i18n,
|
||||||
msm,
|
msm,
|
||||||
combo_floater,
|
combo_floater,
|
||||||
context,
|
context,
|
||||||
@ -1010,7 +1010,7 @@ impl<'a> Skillbar<'a> {
|
|||||||
self.pulse,
|
self.pulse,
|
||||||
self.msm,
|
self.msm,
|
||||||
self.localized_strings,
|
self.localized_strings,
|
||||||
self.item_l10n,
|
self.item_i18n,
|
||||||
)
|
)
|
||||||
.title_font_size(self.fonts.cyri.scale(20))
|
.title_font_size(self.fonts.cyri.scale(20))
|
||||||
.parent(ui.window)
|
.parent(ui.window)
|
||||||
@ -1033,7 +1033,7 @@ impl<'a> Skillbar<'a> {
|
|||||||
hotbar.get(slot).and_then(|content| match content {
|
hotbar.get(slot).and_then(|content| match content {
|
||||||
hotbar::SlotContents::Inventory(i, _) => inventory.get_by_hash(i).map(|item| {
|
hotbar::SlotContents::Inventory(i, _) => inventory.get_by_hash(i).map(|item| {
|
||||||
let (title, desc) =
|
let (title, desc) =
|
||||||
util::item_text(item, self.localized_strings, self.item_l10n);
|
util::item_text(item, self.localized_strings, self.item_i18n);
|
||||||
|
|
||||||
(title.into(), desc.into())
|
(title.into(), desc.into())
|
||||||
}),
|
}),
|
||||||
|
@ -10,7 +10,7 @@ use vek::*;
|
|||||||
use client::Client;
|
use client::Client;
|
||||||
use common::{
|
use common::{
|
||||||
comp::{
|
comp::{
|
||||||
inventory::item::{ItemDesc, ItemL10n, MaterialStatManifest, Quality},
|
inventory::item::{ItemDesc, ItemI18n, MaterialStatManifest, Quality},
|
||||||
Inventory, Stats,
|
Inventory, Stats,
|
||||||
},
|
},
|
||||||
trade::{PendingTrade, SitePrices, TradeAction, TradePhase},
|
trade::{PendingTrade, SitePrices, TradeAction, TradePhase},
|
||||||
@ -99,7 +99,7 @@ pub struct Trade<'a> {
|
|||||||
common: widget::CommonBuilder,
|
common: widget::CommonBuilder,
|
||||||
slot_manager: &'a mut SlotManager,
|
slot_manager: &'a mut SlotManager,
|
||||||
localized_strings: &'a Localization,
|
localized_strings: &'a Localization,
|
||||||
item_l10n: &'a ItemL10n,
|
item_i18n: &'a ItemI18n,
|
||||||
msm: &'a MaterialStatManifest,
|
msm: &'a MaterialStatManifest,
|
||||||
pulse: f32,
|
pulse: f32,
|
||||||
show: &'a mut Show,
|
show: &'a mut Show,
|
||||||
@ -118,7 +118,7 @@ impl<'a> Trade<'a> {
|
|||||||
item_tooltip_manager: &'a mut ItemTooltipManager,
|
item_tooltip_manager: &'a mut ItemTooltipManager,
|
||||||
slot_manager: &'a mut SlotManager,
|
slot_manager: &'a mut SlotManager,
|
||||||
localized_strings: &'a Localization,
|
localized_strings: &'a Localization,
|
||||||
item_l10n: &'a ItemL10n,
|
item_i18n: &'a ItemI18n,
|
||||||
msm: &'a MaterialStatManifest,
|
msm: &'a MaterialStatManifest,
|
||||||
pulse: f32,
|
pulse: f32,
|
||||||
show: &'a mut Show,
|
show: &'a mut Show,
|
||||||
@ -135,7 +135,7 @@ impl<'a> Trade<'a> {
|
|||||||
common: widget::CommonBuilder::default(),
|
common: widget::CommonBuilder::default(),
|
||||||
slot_manager,
|
slot_manager,
|
||||||
localized_strings,
|
localized_strings,
|
||||||
item_l10n,
|
item_i18n,
|
||||||
msm,
|
msm,
|
||||||
pulse,
|
pulse,
|
||||||
show,
|
show,
|
||||||
@ -349,7 +349,7 @@ impl<'a> Trade<'a> {
|
|||||||
self.pulse,
|
self.pulse,
|
||||||
self.msm,
|
self.msm,
|
||||||
self.localized_strings,
|
self.localized_strings,
|
||||||
self.item_l10n,
|
self.item_i18n,
|
||||||
)
|
)
|
||||||
.title_font_size(self.fonts.cyri.scale(20))
|
.title_font_size(self.fonts.cyri.scale(20))
|
||||||
.parent(ui.window)
|
.parent(ui.window)
|
||||||
@ -367,7 +367,7 @@ impl<'a> Trade<'a> {
|
|||||||
self.slot_manager,
|
self.slot_manager,
|
||||||
self.pulse,
|
self.pulse,
|
||||||
self.localized_strings,
|
self.localized_strings,
|
||||||
self.item_l10n,
|
self.item_i18n,
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
@ -537,7 +537,7 @@ impl<'a> Trade<'a> {
|
|||||||
.invslot
|
.invslot
|
||||||
.and_then(|i| inventory.get(i))
|
.and_then(|i| inventory.get(i))
|
||||||
.map(|i| {
|
.map(|i| {
|
||||||
let (name, _) = util::item_text(&i, self.localized_strings, self.item_l10n);
|
let (name, _) = util::item_text(&i, self.localized_strings, self.item_i18n);
|
||||||
|
|
||||||
Cow::Owned(name)
|
Cow::Owned(name)
|
||||||
})
|
})
|
||||||
|
@ -5,7 +5,7 @@ use common::{
|
|||||||
item::{
|
item::{
|
||||||
armor::{Armor, ArmorKind, Protection},
|
armor::{Armor, ArmorKind, Protection},
|
||||||
tool::{Hands, Tool, ToolKind},
|
tool::{Hands, Tool, ToolKind},
|
||||||
Effects, Item, ItemDefinitionId, ItemDesc, ItemKind, ItemL10n, MaterialKind,
|
Effects, Item, ItemDefinitionId, ItemDesc, ItemI18n, ItemKind, MaterialKind,
|
||||||
MaterialStatManifest,
|
MaterialStatManifest,
|
||||||
},
|
},
|
||||||
BuffKind,
|
BuffKind,
|
||||||
@ -64,9 +64,9 @@ pub fn price_desc<'a>(
|
|||||||
pub fn item_text<'a, I: ItemDesc + ?Sized>(
|
pub fn item_text<'a, I: ItemDesc + ?Sized>(
|
||||||
item: &I,
|
item: &I,
|
||||||
i18n: &'a Localization,
|
i18n: &'a Localization,
|
||||||
l10n_spec: &'a ItemL10n,
|
i18n_spec: &'a ItemI18n,
|
||||||
) -> (String, String) {
|
) -> (String, String) {
|
||||||
let (title, desc) = item.l10n(l10n_spec);
|
let (title, desc) = item.i18n(i18n_spec);
|
||||||
|
|
||||||
(i18n.get_content(&title), i18n.get_content(&desc))
|
(i18n.get_content(&title), i18n.get_content(&desc))
|
||||||
}
|
}
|
||||||
@ -74,9 +74,9 @@ pub fn item_text<'a, I: ItemDesc + ?Sized>(
|
|||||||
pub fn describe<'a, I: ItemDesc + ?Sized>(
|
pub fn describe<'a, I: ItemDesc + ?Sized>(
|
||||||
item: &I,
|
item: &I,
|
||||||
i18n: &'a Localization,
|
i18n: &'a Localization,
|
||||||
l10n_spec: &'a ItemL10n,
|
i18n_spec: &'a ItemI18n,
|
||||||
) -> String {
|
) -> String {
|
||||||
let (title, _) = item_text(item, i18n, l10n_spec);
|
let (title, _) = item_text(item, i18n, i18n_spec);
|
||||||
let amount = item.amount();
|
let amount = item.amount();
|
||||||
|
|
||||||
if amount.get() > 1 {
|
if amount.get() > 1 {
|
||||||
|
@ -10,7 +10,7 @@ use common::{
|
|||||||
comp::{
|
comp::{
|
||||||
item::{
|
item::{
|
||||||
armor::Protection, item_key::ItemKey, modular::ModularComponent, Item, ItemDesc,
|
armor::Protection, item_key::ItemKey, modular::ModularComponent, Item, ItemDesc,
|
||||||
ItemKind, ItemL10n, ItemTag, MaterialStatManifest, Quality,
|
ItemI18n, ItemKind, ItemTag, MaterialStatManifest, Quality,
|
||||||
},
|
},
|
||||||
Energy,
|
Energy,
|
||||||
},
|
},
|
||||||
@ -296,7 +296,7 @@ pub struct ItemTooltip<'a> {
|
|||||||
item_imgs: &'a ItemImgs,
|
item_imgs: &'a ItemImgs,
|
||||||
pulse: f32,
|
pulse: f32,
|
||||||
localized_strings: &'a Localization,
|
localized_strings: &'a Localization,
|
||||||
item_l10n: &'a ItemL10n,
|
item_i18n: &'a ItemI18n,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, PartialEq, WidgetStyle)]
|
#[derive(Clone, Debug, Default, PartialEq, WidgetStyle)]
|
||||||
@ -361,7 +361,7 @@ impl<'a> ItemTooltip<'a> {
|
|||||||
pulse: f32,
|
pulse: f32,
|
||||||
msm: &'a MaterialStatManifest,
|
msm: &'a MaterialStatManifest,
|
||||||
localized_strings: &'a Localization,
|
localized_strings: &'a Localization,
|
||||||
item_l10n: &'a ItemL10n,
|
item_i18n: &'a ItemI18n,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
ItemTooltip {
|
ItemTooltip {
|
||||||
common: widget::CommonBuilder::default(),
|
common: widget::CommonBuilder::default(),
|
||||||
@ -379,7 +379,7 @@ impl<'a> ItemTooltip<'a> {
|
|||||||
item_imgs,
|
item_imgs,
|
||||||
pulse,
|
pulse,
|
||||||
localized_strings,
|
localized_strings,
|
||||||
item_l10n,
|
item_i18n,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -453,7 +453,7 @@ impl<'a> Widget for ItemTooltip<'a> {
|
|||||||
} = args;
|
} = args;
|
||||||
|
|
||||||
let i18n = &self.localized_strings;
|
let i18n = &self.localized_strings;
|
||||||
let item_l10n = &self.item_l10n;
|
let item_i18n = &self.item_i18n;
|
||||||
|
|
||||||
let inventories = self.client.inventories();
|
let inventories = self.client.inventories();
|
||||||
let inventory = match inventories.get(self.info.viewpoint_entity) {
|
let inventory = match inventories.get(self.info.viewpoint_entity) {
|
||||||
@ -469,7 +469,7 @@ impl<'a> Widget for ItemTooltip<'a> {
|
|||||||
|
|
||||||
let equipped_item = inventory.equipped_items_replaceable_by(item_kind).next();
|
let equipped_item = inventory.equipped_items_replaceable_by(item_kind).next();
|
||||||
|
|
||||||
let (title, desc) = util::item_text(item, i18n, item_l10n);
|
let (title, desc) = util::item_text(item, i18n, item_i18n);
|
||||||
|
|
||||||
let item_kind = util::kind_text(item_kind, i18n).to_string();
|
let item_kind = util::kind_text(item_kind, i18n).to_string();
|
||||||
|
|
||||||
@ -1271,7 +1271,7 @@ impl<'a> Widget for ItemTooltip<'a> {
|
|||||||
let item = &self.item;
|
let item = &self.item;
|
||||||
|
|
||||||
// TODO: we do double work here, does it need optimization?
|
// TODO: we do double work here, does it need optimization?
|
||||||
let (_, desc) = util::item_text(item, self.localized_strings, self.item_l10n);
|
let (_, desc) = util::item_text(item, self.localized_strings, self.item_i18n);
|
||||||
|
|
||||||
let (text_w, _image_w) = self.text_image_width(260.0);
|
let (text_w, _image_w) = self.text_image_width(260.0);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user