mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Rename localization/font types (e.g. VoxygenLocalization -> Localization)
This commit is contained in:
parent
0053299b14
commit
bc0792a57a
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1864,7 +1864,7 @@ checksum = "5fca6f9d679bff1322c76c9a1ad4b8553b30a94f3f75bea6936e19032c2f2ec3"
|
||||
dependencies = [
|
||||
"glyph_brush_layout",
|
||||
"log",
|
||||
"ordered-float",
|
||||
"ordered-float 1.1.0",
|
||||
"rustc-hash",
|
||||
"rusttype 0.8.3",
|
||||
"twox-hash",
|
||||
|
@ -1,5 +1,5 @@
|
||||
/// Localization for Polish / Tłumaczenia dla języka polskiego
|
||||
VoxygenLocalization(
|
||||
Localization(
|
||||
metadata: (
|
||||
language_name: "Polish",
|
||||
language_identifier: "PL",
|
||||
|
@ -11,7 +11,7 @@
|
||||
/// `assets/voxygen/i18n` and that's it!
|
||||
|
||||
/// Lokalisation für Deutsch/Deutschland
|
||||
VoxygenLocalization(
|
||||
(
|
||||
metadata: (
|
||||
language_name: "Deutsch",
|
||||
language_identifier: "de_DE",
|
||||
|
@ -13,7 +13,7 @@
|
||||
/// WARNING: Localization files shall be saved in UTF-8 format without BOM
|
||||
|
||||
/// Localization for "global" English
|
||||
VoxygenLocalization(
|
||||
(
|
||||
metadata: (
|
||||
language_name: "English",
|
||||
language_identifier: "en",
|
||||
|
@ -12,7 +12,7 @@
|
||||
///
|
||||
/// Localization for Spanish (Spain)
|
||||
|
||||
VoxygenLocalization(
|
||||
Localization(
|
||||
metadata: (
|
||||
language_name: "Español de España",
|
||||
language_identifier: "es_ES",
|
||||
|
@ -13,7 +13,7 @@
|
||||
/// WARNING: Localization files shall be saved in UTF-8 format without BOM
|
||||
|
||||
/// Localization for "latinoamericano" Latin-American
|
||||
VoxygenLocalization(
|
||||
Localization(
|
||||
metadata: (
|
||||
language_name: "Español Latino",
|
||||
language_identifier: "es_la",
|
||||
|
@ -1,5 +1,5 @@
|
||||
/// Localization for French (France locale)
|
||||
VoxygenLocalization(
|
||||
(
|
||||
metadata: (
|
||||
language_name: "Français",
|
||||
language_identifier: "fr_FR",
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
|
||||
/// Localization for "global" Italian
|
||||
VoxygenLocalization(
|
||||
(
|
||||
metadata: (
|
||||
language_name: "Italiano",
|
||||
language_identifier: "it_IT",
|
||||
|
@ -13,7 +13,7 @@
|
||||
/// WARNING: Localization files shall be saved in UTF-8 format without BOM
|
||||
|
||||
/// Localization for "global" English
|
||||
VoxygenLocalization(
|
||||
(
|
||||
metadata: (
|
||||
language_name: "Nederlands",
|
||||
language_identifier: "nl",
|
||||
|
@ -1,5 +1,5 @@
|
||||
/// Localization for Portuguese (Brazil)
|
||||
VoxygenLocalization(
|
||||
Localization(
|
||||
metadata: (
|
||||
language_name: "Português Brasileiro",
|
||||
language_identifier: "pt_BR",
|
||||
|
@ -1,5 +1,5 @@
|
||||
/// Localization for portuguese (Portugal)
|
||||
VoxygenLocalization(
|
||||
(
|
||||
metadata: (
|
||||
language_name: "Português",
|
||||
language_identifier: "pt_PT",
|
||||
|
@ -1,5 +1,5 @@
|
||||
/// Localization for "global" Russian
|
||||
VoxygenLocalization(
|
||||
(
|
||||
metadata: (
|
||||
language_name: "Русский",
|
||||
language_identifier: "ru_RU",
|
||||
|
@ -11,7 +11,7 @@
|
||||
/// `assets/voxygen/i18n` and that's it!
|
||||
|
||||
/// Localization for Swedish
|
||||
VoxygenLocalization(
|
||||
Localization(
|
||||
metadata: (
|
||||
language_name: "Svenska",
|
||||
language_identifier: "sv",
|
||||
|
@ -13,7 +13,7 @@
|
||||
/// WARNING: Localization files shall be saved in UTF-8 format without BOM
|
||||
|
||||
/// Localization for Turkish (Turkey)
|
||||
VoxygenLocalization(
|
||||
(
|
||||
metadata: (
|
||||
language_name: "Türkçe (Türkiye)",
|
||||
language_identifier: "tr_TR",
|
||||
|
@ -13,7 +13,7 @@
|
||||
/// 注意: 本地化文件应以 UTF-8无BOM 格式保存
|
||||
|
||||
/// "全局"本地化 Simplified Chinese-简体中文
|
||||
VoxygenLocalization(
|
||||
Localization(
|
||||
metadata: (
|
||||
language_name: "Simplified Chinese",
|
||||
language_identifier: "zh_CN",
|
||||
|
@ -1,5 +1,5 @@
|
||||
/// Localization for Traditional Chinese
|
||||
VoxygenLocalization(
|
||||
Localization(
|
||||
metadata: (
|
||||
language_name: "繁體中文",
|
||||
language_identifier: "zh_TW",
|
||||
|
@ -8,9 +8,9 @@ use super::{
|
||||
};
|
||||
use crate::{
|
||||
hud::get_quality_col,
|
||||
i18n::VoxygenLocalization,
|
||||
i18n::Localization,
|
||||
ui::{
|
||||
fonts::ConrodVoxygenFonts,
|
||||
fonts::Fonts,
|
||||
slot::{ContentSize, SlotMaker},
|
||||
ImageFrame, Tooltip, TooltipManager, Tooltipable,
|
||||
},
|
||||
@ -90,14 +90,14 @@ pub struct Bag<'a> {
|
||||
client: &'a Client,
|
||||
imgs: &'a Imgs,
|
||||
item_imgs: &'a ItemImgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
fonts: &'a Fonts,
|
||||
#[conrod(common_builder)]
|
||||
common: widget::CommonBuilder,
|
||||
rot_imgs: &'a ImgsRot,
|
||||
tooltip_manager: &'a mut TooltipManager,
|
||||
slot_manager: &'a mut SlotManager,
|
||||
_pulse: f32,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
localized_strings: &'a Localization,
|
||||
|
||||
stats: &'a Stats,
|
||||
show: &'a Show,
|
||||
@ -109,12 +109,12 @@ impl<'a> Bag<'a> {
|
||||
client: &'a Client,
|
||||
imgs: &'a Imgs,
|
||||
item_imgs: &'a ItemImgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
fonts: &'a Fonts,
|
||||
rot_imgs: &'a ImgsRot,
|
||||
tooltip_manager: &'a mut TooltipManager,
|
||||
slot_manager: &'a mut SlotManager,
|
||||
pulse: f32,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
localized_strings: &'a Localization,
|
||||
stats: &'a Stats,
|
||||
show: &'a Show,
|
||||
) -> Self {
|
||||
|
@ -4,8 +4,8 @@ use super::{
|
||||
};
|
||||
use crate::{
|
||||
hud::{get_buff_info, BuffPosition},
|
||||
i18n::VoxygenLocalization,
|
||||
ui::{fonts::ConrodVoxygenFonts, ImageFrame, Tooltip, TooltipManager, Tooltipable},
|
||||
i18n::Localization,
|
||||
ui::{fonts::Fonts, ImageFrame, Tooltip, TooltipManager, Tooltipable},
|
||||
GlobalState,
|
||||
};
|
||||
|
||||
@ -34,12 +34,12 @@ widget_ids! {
|
||||
#[derive(WidgetCommon)]
|
||||
pub struct BuffsBar<'a> {
|
||||
imgs: &'a Imgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
fonts: &'a Fonts,
|
||||
#[conrod(common_builder)]
|
||||
common: widget::CommonBuilder,
|
||||
rot_imgs: &'a ImgsRot,
|
||||
tooltip_manager: &'a mut TooltipManager,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
localized_strings: &'a Localization,
|
||||
buffs: &'a Buffs,
|
||||
pulse: f32,
|
||||
global_state: &'a GlobalState,
|
||||
@ -49,10 +49,10 @@ impl<'a> BuffsBar<'a> {
|
||||
#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587
|
||||
pub fn new(
|
||||
imgs: &'a Imgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
fonts: &'a Fonts,
|
||||
rot_imgs: &'a ImgsRot,
|
||||
tooltip_manager: &'a mut TooltipManager,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
localized_strings: &'a Localization,
|
||||
buffs: &'a Buffs,
|
||||
pulse: f32,
|
||||
global_state: &'a GlobalState,
|
||||
|
@ -3,8 +3,8 @@ use super::{
|
||||
BLACK, CRITICAL_HP_COLOR, LOW_HP_COLOR, TEXT_COLOR,
|
||||
};
|
||||
use crate::{
|
||||
i18n::VoxygenLocalization,
|
||||
ui::{fonts::ConrodVoxygenFonts, ImageFrame, Tooltip, TooltipManager, Tooltipable},
|
||||
i18n::Localization,
|
||||
ui::{fonts::Fonts, ImageFrame, Tooltip, TooltipManager, Tooltipable},
|
||||
window::GameInput,
|
||||
GlobalState,
|
||||
};
|
||||
@ -49,13 +49,13 @@ pub struct Buttons<'a> {
|
||||
client: &'a Client,
|
||||
show_bag: bool,
|
||||
imgs: &'a Imgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
fonts: &'a Fonts,
|
||||
#[conrod(common_builder)]
|
||||
common: widget::CommonBuilder,
|
||||
global_state: &'a GlobalState,
|
||||
rot_imgs: &'a ImgsRot,
|
||||
tooltip_manager: &'a mut TooltipManager,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
localized_strings: &'a Localization,
|
||||
stats: &'a Stats,
|
||||
}
|
||||
|
||||
@ -65,11 +65,11 @@ impl<'a> Buttons<'a> {
|
||||
client: &'a Client,
|
||||
show_bag: bool,
|
||||
imgs: &'a Imgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
fonts: &'a Fonts,
|
||||
global_state: &'a GlobalState,
|
||||
rot_imgs: &'a ImgsRot,
|
||||
tooltip_manager: &'a mut TooltipManager,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
localized_strings: &'a Localization,
|
||||
stats: &'a Stats,
|
||||
) -> Self {
|
||||
Self {
|
||||
|
@ -2,7 +2,7 @@ use super::{
|
||||
img_ids::Imgs, ERROR_COLOR, FACTION_COLOR, GROUP_COLOR, INFO_COLOR, KILL_COLOR, LOOT_COLOR,
|
||||
OFFLINE_COLOR, ONLINE_COLOR, REGION_COLOR, SAY_COLOR, TELL_COLOR, TEXT_COLOR, WORLD_COLOR,
|
||||
};
|
||||
use crate::{i18n::VoxygenLocalization, ui::fonts::ConrodVoxygenFonts, GlobalState};
|
||||
use crate::{ui::fonts::Fonts, GlobalState, Localization};
|
||||
use client::{cmd, Client};
|
||||
use common::{
|
||||
comp::{
|
||||
@ -52,7 +52,7 @@ pub struct Chat<'a> {
|
||||
|
||||
global_state: &'a GlobalState,
|
||||
imgs: &'a Imgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
fonts: &'a Fonts,
|
||||
|
||||
#[conrod(common_builder)]
|
||||
common: widget::CommonBuilder,
|
||||
@ -60,7 +60,7 @@ pub struct Chat<'a> {
|
||||
// TODO: add an option to adjust this
|
||||
history_max: usize,
|
||||
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
localized_strings: &'a Localization,
|
||||
}
|
||||
|
||||
impl<'a> Chat<'a> {
|
||||
@ -69,8 +69,8 @@ impl<'a> Chat<'a> {
|
||||
client: &'a Client,
|
||||
global_state: &'a GlobalState,
|
||||
imgs: &'a Imgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
fonts: &'a Fonts,
|
||||
localized_strings: &'a Localization,
|
||||
) -> Self {
|
||||
Self {
|
||||
new_messages,
|
||||
@ -536,12 +536,7 @@ fn do_tab_completion(cursor: usize, input: &str, word: &str) -> (String, usize)
|
||||
}
|
||||
}
|
||||
|
||||
fn cursor_offset_to_index(
|
||||
offset: usize,
|
||||
text: &str,
|
||||
ui: &Ui,
|
||||
fonts: &ConrodVoxygenFonts,
|
||||
) -> Option<Index> {
|
||||
fn cursor_offset_to_index(offset: usize, text: &str, ui: &Ui, fonts: &Fonts) -> Option<Index> {
|
||||
// This moves the cursor to the given offset. Conrod is a pain.
|
||||
//
|
||||
// Width and font must match that of the chat TextEdit
|
||||
|
@ -5,8 +5,8 @@ use super::{
|
||||
};
|
||||
use crate::{
|
||||
hud::get_quality_col,
|
||||
i18n::VoxygenLocalization,
|
||||
ui::{fonts::ConrodVoxygenFonts, ImageFrame, Tooltip, TooltipManager, Tooltipable},
|
||||
i18n::Localization,
|
||||
ui::{fonts::Fonts, ImageFrame, Tooltip, TooltipManager, Tooltipable},
|
||||
};
|
||||
use client::{self, Client};
|
||||
use common::comp::{
|
||||
@ -55,8 +55,8 @@ pub enum Event {
|
||||
pub struct Crafting<'a> {
|
||||
client: &'a Client,
|
||||
imgs: &'a Imgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
fonts: &'a Fonts,
|
||||
localized_strings: &'a Localization,
|
||||
rot_imgs: &'a ImgsRot,
|
||||
tooltip_manager: &'a mut TooltipManager,
|
||||
item_imgs: &'a ItemImgs,
|
||||
@ -69,8 +69,8 @@ impl<'a> Crafting<'a> {
|
||||
pub fn new(
|
||||
client: &'a Client,
|
||||
imgs: &'a Imgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
fonts: &'a Fonts,
|
||||
localized_strings: &'a Localization,
|
||||
rot_imgs: &'a ImgsRot,
|
||||
tooltip_manager: &'a mut TooltipManager,
|
||||
item_imgs: &'a ItemImgs,
|
||||
|
@ -1,5 +1,5 @@
|
||||
use super::{img_ids::Imgs, settings_window::SettingsTab, TEXT_COLOR};
|
||||
use crate::{i18n::VoxygenLocalization, ui::fonts::ConrodVoxygenFonts};
|
||||
use crate::{i18n::Localization, ui::fonts::Fonts};
|
||||
use conrod_core::{
|
||||
widget::{self, Button, Image},
|
||||
widget_ids, Color, Labelable, Positionable, Sizeable, Widget, WidgetCommon,
|
||||
@ -22,19 +22,15 @@ widget_ids! {
|
||||
#[derive(WidgetCommon)]
|
||||
pub struct EscMenu<'a> {
|
||||
imgs: &'a Imgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
fonts: &'a Fonts,
|
||||
localized_strings: &'a Localization,
|
||||
|
||||
#[conrod(common_builder)]
|
||||
common: widget::CommonBuilder,
|
||||
}
|
||||
|
||||
impl<'a> EscMenu<'a> {
|
||||
pub fn new(
|
||||
imgs: &'a Imgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
) -> Self {
|
||||
pub fn new(imgs: &'a Imgs, fonts: &'a Fonts, localized_strings: &'a Localization) -> Self {
|
||||
Self {
|
||||
imgs,
|
||||
fonts,
|
||||
|
@ -6,9 +6,9 @@ use super::{
|
||||
|
||||
use crate::{
|
||||
hud::get_buff_info,
|
||||
i18n::VoxygenLocalization,
|
||||
i18n::Localization,
|
||||
settings::Settings,
|
||||
ui::{fonts::ConrodVoxygenFonts, ImageFrame, Tooltip, TooltipManager, Tooltipable},
|
||||
ui::{fonts::Fonts, ImageFrame, Tooltip, TooltipManager, Tooltipable},
|
||||
window::GameInput,
|
||||
GlobalState,
|
||||
};
|
||||
@ -70,8 +70,8 @@ pub struct Group<'a> {
|
||||
settings: &'a Settings,
|
||||
imgs: &'a Imgs,
|
||||
rot_imgs: &'a ImgsRot,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
fonts: &'a Fonts,
|
||||
localized_strings: &'a Localization,
|
||||
pulse: f32,
|
||||
global_state: &'a GlobalState,
|
||||
tooltip_manager: &'a mut TooltipManager,
|
||||
@ -88,8 +88,8 @@ impl<'a> Group<'a> {
|
||||
settings: &'a Settings,
|
||||
imgs: &'a Imgs,
|
||||
rot_imgs: &'a ImgsRot,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
fonts: &'a Fonts,
|
||||
localized_strings: &'a Localization,
|
||||
pulse: f32,
|
||||
global_state: &'a GlobalState,
|
||||
tooltip_manager: &'a mut TooltipManager,
|
||||
|
@ -3,8 +3,8 @@ use super::{
|
||||
Show, TEXT_COLOR, UI_HIGHLIGHT_0, UI_MAIN,
|
||||
};
|
||||
use crate::{
|
||||
i18n::VoxygenLocalization,
|
||||
ui::{fonts::ConrodVoxygenFonts, img_ids, ImageSlider},
|
||||
i18n::Localization,
|
||||
ui::{fonts::Fonts, img_ids, ImageSlider},
|
||||
GlobalState,
|
||||
};
|
||||
use client::{self, Client};
|
||||
@ -41,11 +41,11 @@ pub struct Map<'a> {
|
||||
world_map: &'a (img_ids::Rotations, Vec2<u32>),
|
||||
imgs: &'a Imgs,
|
||||
rot_imgs: &'a ImgsRot,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
fonts: &'a Fonts,
|
||||
#[conrod(common_builder)]
|
||||
common: widget::CommonBuilder,
|
||||
_pulse: f32,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
localized_strings: &'a Localization,
|
||||
global_state: &'a GlobalState,
|
||||
}
|
||||
impl<'a> Map<'a> {
|
||||
@ -56,9 +56,9 @@ impl<'a> Map<'a> {
|
||||
imgs: &'a Imgs,
|
||||
rot_imgs: &'a ImgsRot,
|
||||
world_map: &'a (img_ids::Rotations, Vec2<u32>),
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
fonts: &'a Fonts,
|
||||
pulse: f32,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
localized_strings: &'a Localization,
|
||||
global_state: &'a GlobalState,
|
||||
) -> Self {
|
||||
Self {
|
||||
|
@ -2,7 +2,7 @@ use super::{
|
||||
img_ids::{Imgs, ImgsRot},
|
||||
Show, TEXT_COLOR, UI_HIGHLIGHT_0, UI_MAIN,
|
||||
};
|
||||
use crate::ui::{fonts::ConrodVoxygenFonts, img_ids};
|
||||
use crate::ui::{fonts::Fonts, img_ids};
|
||||
use client::{self, Client};
|
||||
use common::{comp, terrain::TerrainChunkSize, vol::RectVolSize};
|
||||
use conrod_core::{
|
||||
@ -40,7 +40,7 @@ pub struct MiniMap<'a> {
|
||||
imgs: &'a Imgs,
|
||||
rot_imgs: &'a ImgsRot,
|
||||
world_map: &'a (img_ids::Rotations, Vec2<u32>),
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
fonts: &'a Fonts,
|
||||
#[conrod(common_builder)]
|
||||
common: widget::CommonBuilder,
|
||||
ori: Vec3<f32>,
|
||||
@ -53,7 +53,7 @@ impl<'a> MiniMap<'a> {
|
||||
imgs: &'a Imgs,
|
||||
rot_imgs: &'a ImgsRot,
|
||||
world_map: &'a (img_ids::Rotations, Vec2<u32>),
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
fonts: &'a Fonts,
|
||||
ori: Vec3<f32>,
|
||||
) -> Self {
|
||||
Self {
|
||||
|
@ -46,13 +46,13 @@ use spell::Spell;
|
||||
use crate::{
|
||||
ecs::{comp as vcomp, comp::HpFloaterList},
|
||||
hud::img_ids::ImgsRot,
|
||||
i18n::{i18n_asset_key, LanguageMetadata, VoxygenLocalization},
|
||||
i18n::{i18n_asset_key, LanguageMetadata, Localization},
|
||||
render::{Consts, Globals, RenderMode, Renderer},
|
||||
scene::{
|
||||
camera::{self, Camera},
|
||||
lod,
|
||||
},
|
||||
ui::{fonts::ConrodVoxygenFonts, img_ids::Rotations, slot, Graphic, Ingameable, ScaleMode, Ui},
|
||||
ui::{fonts::Fonts, img_ids::Rotations, slot, Graphic, Ingameable, ScaleMode, Ui},
|
||||
window::{Event as WinEvent, FullScreenSettings, GameInput},
|
||||
GlobalState,
|
||||
};
|
||||
@ -598,7 +598,7 @@ pub struct Hud {
|
||||
world_map: (/* Id */ Rotations, Vec2<u32>),
|
||||
imgs: Imgs,
|
||||
item_imgs: ItemImgs,
|
||||
fonts: ConrodVoxygenFonts,
|
||||
fonts: Fonts,
|
||||
rot_imgs: ImgsRot,
|
||||
new_messages: VecDeque<comp::ChatMsg>,
|
||||
new_notifications: VecDeque<common::msg::Notification>,
|
||||
@ -614,7 +614,7 @@ pub struct Hud {
|
||||
tab_complete: Option<String>,
|
||||
pulse: f32,
|
||||
velocity: f32,
|
||||
voxygen_i18n: std::sync::Arc<VoxygenLocalization>,
|
||||
i18n: std::sync::Arc<Localization>,
|
||||
slot_manager: slots::SlotManager,
|
||||
hotbar: hotbar::State,
|
||||
events: Vec<Event>,
|
||||
@ -649,12 +649,11 @@ impl Hud {
|
||||
// Load item images.
|
||||
let item_imgs = ItemImgs::new(&mut ui, imgs.not_found);
|
||||
// Load language.
|
||||
let voxygen_i18n = VoxygenLocalization::load_expect(&i18n_asset_key(
|
||||
let i18n = Localization::load_expect(&i18n_asset_key(
|
||||
&global_state.settings.language.selected_language,
|
||||
));
|
||||
// Load fonts.
|
||||
let fonts = ConrodVoxygenFonts::load(&voxygen_i18n.fonts, &mut ui)
|
||||
.expect("Impossible to load fonts!");
|
||||
let fonts = Fonts::load(&i18n.fonts, &mut ui).expect("Impossible to load fonts!");
|
||||
// Get the server name.
|
||||
let server = &client.server_info.name;
|
||||
// Get the id, unwrap is safe because this CANNOT be None at this
|
||||
@ -715,7 +714,7 @@ impl Hud {
|
||||
tab_complete: None,
|
||||
pulse: 0.0,
|
||||
velocity: 0.0,
|
||||
voxygen_i18n,
|
||||
i18n,
|
||||
slot_manager,
|
||||
hotbar: hotbar_state,
|
||||
events: Vec::new(),
|
||||
@ -723,10 +722,10 @@ impl Hud {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn update_language(&mut self, voxygen_i18n: std::sync::Arc<VoxygenLocalization>) {
|
||||
self.voxygen_i18n = voxygen_i18n;
|
||||
self.fonts = ConrodVoxygenFonts::load(&self.voxygen_i18n.fonts, &mut self.ui)
|
||||
.expect("Impossible to load fonts!");
|
||||
pub fn update_language(&mut self, i18n: std::sync::Arc<Localization>) {
|
||||
self.i18n = i18n;
|
||||
self.fonts =
|
||||
Fonts::load(&self.i18n.fonts, &mut self.ui).expect("Impossible to load fonts!");
|
||||
}
|
||||
|
||||
#[allow(clippy::assign_op_pattern)] // TODO: Pending review in #587
|
||||
@ -1256,7 +1255,7 @@ impl Hud {
|
||||
in_group,
|
||||
&global_state.settings.gameplay,
|
||||
self.pulse,
|
||||
&self.voxygen_i18n,
|
||||
&self.i18n,
|
||||
&self.imgs,
|
||||
&self.fonts,
|
||||
)
|
||||
@ -1459,8 +1458,8 @@ impl Hud {
|
||||
Intro::Show => {
|
||||
if self.pulse > 20.0 {
|
||||
self.show.want_grab = false;
|
||||
let quest_headline = &self.voxygen_i18n.get("hud.temp_quest_headline");
|
||||
let quest_text = &self.voxygen_i18n.get("hud.temp_quest_text");
|
||||
let quest_headline = &self.i18n.get("hud.temp_quest_headline");
|
||||
let quest_text = &self.i18n.get("hud.temp_quest_text");
|
||||
Image::new(self.imgs.quest_bg)
|
||||
.w_h(404.0, 858.0)
|
||||
.middle_of(ui_widgets.window)
|
||||
@ -1497,7 +1496,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, -120.0)
|
||||
.label(&self.voxygen_i18n.get("common.accept"))
|
||||
.label(&self.i18n.get("common.accept"))
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.label_font_size(self.fonts.cyri.scale(22))
|
||||
.label_color(TEXT_COLOR)
|
||||
@ -1675,7 +1674,7 @@ impl Hud {
|
||||
if let Some(help_key) = global_state.settings.controls.get_binding(GameInput::Help) {
|
||||
Text::new(
|
||||
&self
|
||||
.voxygen_i18n
|
||||
.i18n
|
||||
.get("hud.press_key_to_toggle_keybindings_fmt")
|
||||
.replace("{key}", help_key.to_string().as_str()),
|
||||
)
|
||||
@ -1693,7 +1692,7 @@ impl Hud {
|
||||
{
|
||||
Text::new(
|
||||
&self
|
||||
.voxygen_i18n
|
||||
.i18n
|
||||
.get("hud.press_key_to_toggle_debug_info_fmt")
|
||||
.replace("{key}", toggle_debug_key.to_string().as_str()),
|
||||
)
|
||||
@ -1708,7 +1707,7 @@ impl Hud {
|
||||
if let Some(help_key) = global_state.settings.controls.get_binding(GameInput::Help) {
|
||||
Text::new(
|
||||
&self
|
||||
.voxygen_i18n
|
||||
.i18n
|
||||
.get("hud.press_key_to_show_keybindings_fmt")
|
||||
.replace("{key}", help_key.to_string().as_str()),
|
||||
)
|
||||
@ -1726,7 +1725,7 @@ impl Hud {
|
||||
{
|
||||
Text::new(
|
||||
&self
|
||||
.voxygen_i18n
|
||||
.i18n
|
||||
.get("hud.press_key_to_show_debug_info_fmt")
|
||||
.replace("{key}", toggle_debug_key.to_string().as_str()),
|
||||
)
|
||||
@ -1744,7 +1743,7 @@ impl Hud {
|
||||
{
|
||||
Text::new(
|
||||
&self
|
||||
.voxygen_i18n
|
||||
.i18n
|
||||
.get("hud.press_key_to_toggle_lantern_fmt")
|
||||
.replace("{key}", toggle_lantern_key.to_string().as_str()),
|
||||
)
|
||||
@ -1789,7 +1788,7 @@ impl Hud {
|
||||
global_state,
|
||||
&self.rot_imgs,
|
||||
tooltip_manager,
|
||||
&self.voxygen_i18n,
|
||||
&self.i18n,
|
||||
&player_stats,
|
||||
)
|
||||
.set(self.ids.buttons, ui_widgets)
|
||||
@ -1811,7 +1810,7 @@ impl Hud {
|
||||
&self.fonts,
|
||||
&self.rot_imgs,
|
||||
tooltip_manager,
|
||||
&self.voxygen_i18n,
|
||||
&self.i18n,
|
||||
&player_buffs,
|
||||
self.pulse,
|
||||
&global_state,
|
||||
@ -1831,7 +1830,7 @@ impl Hud {
|
||||
&self.imgs,
|
||||
&self.rot_imgs,
|
||||
&self.fonts,
|
||||
&self.voxygen_i18n,
|
||||
&self.i18n,
|
||||
self.pulse,
|
||||
&global_state,
|
||||
tooltip_manager,
|
||||
@ -1848,7 +1847,7 @@ impl Hud {
|
||||
}
|
||||
// Popup (waypoint saved and similar notifications)
|
||||
Popup::new(
|
||||
&self.voxygen_i18n,
|
||||
&self.i18n,
|
||||
client,
|
||||
&self.new_notifications,
|
||||
&self.fonts,
|
||||
@ -1884,7 +1883,7 @@ impl Hud {
|
||||
tooltip_manager,
|
||||
&mut self.slot_manager,
|
||||
self.pulse,
|
||||
&self.voxygen_i18n,
|
||||
&self.i18n,
|
||||
&player_stats,
|
||||
&self.show,
|
||||
)
|
||||
@ -1951,7 +1950,7 @@ impl Hud {
|
||||
&self.hotbar,
|
||||
tooltip_manager,
|
||||
&mut self.slot_manager,
|
||||
&self.voxygen_i18n,
|
||||
&self.i18n,
|
||||
&self.show,
|
||||
)
|
||||
.set(self.ids.skillbar, ui_widgets);
|
||||
@ -1965,7 +1964,7 @@ impl Hud {
|
||||
client,
|
||||
&self.imgs,
|
||||
&self.fonts,
|
||||
&self.voxygen_i18n,
|
||||
&self.i18n,
|
||||
&self.rot_imgs,
|
||||
tooltip_manager,
|
||||
&self.item_imgs,
|
||||
@ -2004,7 +2003,7 @@ impl Hud {
|
||||
global_state,
|
||||
&self.imgs,
|
||||
&self.fonts,
|
||||
&self.voxygen_i18n,
|
||||
&self.i18n,
|
||||
)
|
||||
.and_then(self.force_chat_input.take(), |c, input| c.input(input))
|
||||
.and_then(self.tab_complete.take(), |c, input| {
|
||||
@ -2041,7 +2040,7 @@ impl Hud {
|
||||
&self.show,
|
||||
&self.imgs,
|
||||
&self.fonts,
|
||||
&self.voxygen_i18n,
|
||||
&self.i18n,
|
||||
fps as f32,
|
||||
)
|
||||
.set(self.ids.settings_window, ui_widgets)
|
||||
@ -2194,7 +2193,7 @@ impl Hud {
|
||||
client,
|
||||
&self.imgs,
|
||||
&self.fonts,
|
||||
&self.voxygen_i18n,
|
||||
&self.i18n,
|
||||
info.selected_entity,
|
||||
&self.rot_imgs,
|
||||
tooltip_manager,
|
||||
@ -2222,14 +2221,8 @@ impl Hud {
|
||||
|
||||
// Spellbook
|
||||
if self.show.spell {
|
||||
match Spell::new(
|
||||
&self.show,
|
||||
client,
|
||||
&self.imgs,
|
||||
&self.fonts,
|
||||
&self.voxygen_i18n,
|
||||
)
|
||||
.set(self.ids.spell, ui_widgets)
|
||||
match Spell::new(&self.show, client, &self.imgs, &self.fonts, &self.i18n)
|
||||
.set(self.ids.spell, ui_widgets)
|
||||
{
|
||||
Some(spell::Event::Close) => {
|
||||
self.show.spell(false);
|
||||
@ -2249,7 +2242,7 @@ impl Hud {
|
||||
&self.world_map,
|
||||
&self.fonts,
|
||||
self.pulse,
|
||||
&self.voxygen_i18n,
|
||||
&self.i18n,
|
||||
&global_state,
|
||||
)
|
||||
.set(self.ids.map, ui_widgets)
|
||||
@ -2268,7 +2261,7 @@ impl Hud {
|
||||
}
|
||||
|
||||
if self.show.esc_menu {
|
||||
match EscMenu::new(&self.imgs, &self.fonts, &self.voxygen_i18n)
|
||||
match EscMenu::new(&self.imgs, &self.fonts, &self.i18n)
|
||||
.set(self.ids.esc_menu, ui_widgets)
|
||||
{
|
||||
Some(esc_menu::Event::OpenSettings(tab)) => {
|
||||
@ -2311,7 +2304,7 @@ impl Hud {
|
||||
if self.show.free_look {
|
||||
Text::new(
|
||||
&self
|
||||
.voxygen_i18n
|
||||
.i18n
|
||||
.get("hud.free_look_indicator")
|
||||
.replace("{key}", freelook_key.to_string().as_str()),
|
||||
)
|
||||
@ -2322,7 +2315,7 @@ impl Hud {
|
||||
.set(self.ids.free_look_bg, ui_widgets);
|
||||
Text::new(
|
||||
&self
|
||||
.voxygen_i18n
|
||||
.i18n
|
||||
.get("hud.free_look_indicator")
|
||||
.replace("{key}", freelook_key.to_string().as_str()),
|
||||
)
|
||||
@ -2336,13 +2329,13 @@ impl Hud {
|
||||
|
||||
// Auto walk indicator
|
||||
if self.show.auto_walk {
|
||||
Text::new(&self.voxygen_i18n.get("hud.auto_walk_indicator"))
|
||||
Text::new(&self.i18n.get("hud.auto_walk_indicator"))
|
||||
.color(TEXT_BG)
|
||||
.mid_top_with_margin_on(ui_widgets.window, 70.0)
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.font_size(self.fonts.cyri.scale(20))
|
||||
.set(self.ids.auto_walk_bg, ui_widgets);
|
||||
Text::new(&self.voxygen_i18n.get("hud.auto_walk_indicator"))
|
||||
Text::new(&self.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)
|
||||
|
@ -4,9 +4,9 @@ use super::{
|
||||
};
|
||||
use crate::{
|
||||
hud::get_buff_info,
|
||||
i18n::VoxygenLocalization,
|
||||
i18n::Localization,
|
||||
settings::GameplaySettings,
|
||||
ui::{fonts::ConrodVoxygenFonts, Ingameable},
|
||||
ui::{fonts::Fonts, Ingameable},
|
||||
};
|
||||
use common::comp::{BuffKind, Buffs, Energy, Health, SpeechBubble, SpeechBubbleType, Stats};
|
||||
use conrod_core::{
|
||||
@ -76,9 +76,9 @@ pub struct Overhead<'a> {
|
||||
in_group: bool,
|
||||
settings: &'a GameplaySettings,
|
||||
pulse: f32,
|
||||
voxygen_i18n: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
i18n: &'a Localization,
|
||||
imgs: &'a Imgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
fonts: &'a Fonts,
|
||||
|
||||
#[conrod(common_builder)]
|
||||
common: widget::CommonBuilder,
|
||||
@ -93,9 +93,9 @@ impl<'a> Overhead<'a> {
|
||||
in_group: bool,
|
||||
settings: &'a GameplaySettings,
|
||||
pulse: f32,
|
||||
voxygen_i18n: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
i18n: &'a Localization,
|
||||
imgs: &'a Imgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
fonts: &'a Fonts,
|
||||
) -> Self {
|
||||
Self {
|
||||
info,
|
||||
@ -104,7 +104,7 @@ impl<'a> Overhead<'a> {
|
||||
in_group,
|
||||
settings,
|
||||
pulse,
|
||||
voxygen_i18n,
|
||||
i18n,
|
||||
imgs,
|
||||
fonts,
|
||||
common: widget::CommonBuilder::default(),
|
||||
@ -336,7 +336,7 @@ impl<'a> Widget for Overhead<'a> {
|
||||
.set(state.ids.health_bar, ui);
|
||||
let mut txt = format!("{}/{}", health_cur_txt, health_max_txt);
|
||||
if health.is_dead {
|
||||
txt = self.voxygen_i18n.get("hud.group.dead").to_string()
|
||||
txt = self.i18n.get("hud.group.dead").to_string()
|
||||
};
|
||||
Text::new(&txt)
|
||||
.mid_top_with_margin_on(state.ids.health_bar_bg, 2.0)
|
||||
@ -420,8 +420,7 @@ impl<'a> Widget for Overhead<'a> {
|
||||
// Speech bubble
|
||||
if let Some(bubble) = self.bubble {
|
||||
let dark_mode = self.settings.speech_bubble_dark_mode;
|
||||
let localizer =
|
||||
|s: &str, i| -> String { self.voxygen_i18n.get_variation(&s, i).to_string() };
|
||||
let localizer = |s: &str, i| -> String { self.i18n.get_variation(&s, i).to_string() };
|
||||
let bubble_contents: String = bubble.message(localizer);
|
||||
let (text_color, shadow_color) = bubble_color(&bubble, dark_mode);
|
||||
let mut text = Text::new(&bubble_contents)
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
settings::ControlSettings,
|
||||
ui::{fonts::ConrodVoxygenFonts, Ingameable},
|
||||
ui::{fonts::Fonts, Ingameable},
|
||||
window::GameInput,
|
||||
};
|
||||
use conrod_core::{
|
||||
@ -25,7 +25,7 @@ widget_ids! {
|
||||
pub struct Overitem<'a> {
|
||||
name: &'a str,
|
||||
distance_from_player_sqr: &'a f32,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
fonts: &'a Fonts,
|
||||
controls: &'a ControlSettings,
|
||||
#[conrod(common_builder)]
|
||||
common: widget::CommonBuilder,
|
||||
@ -35,7 +35,7 @@ impl<'a> Overitem<'a> {
|
||||
pub fn new(
|
||||
name: &'a str,
|
||||
distance_from_player_sqr: &'a f32,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
fonts: &'a Fonts,
|
||||
controls: &'a ControlSettings,
|
||||
) -> Self {
|
||||
Self {
|
||||
|
@ -1,5 +1,5 @@
|
||||
use super::Show;
|
||||
use crate::{i18n::VoxygenLocalization, ui::fonts::ConrodVoxygenFonts};
|
||||
use crate::{i18n::Localization, ui::fonts::Fonts};
|
||||
use client::{self, Client};
|
||||
use common::msg::Notification;
|
||||
use conrod_core::{
|
||||
@ -21,10 +21,10 @@ widget_ids! {
|
||||
|
||||
#[derive(WidgetCommon)]
|
||||
pub struct Popup<'a> {
|
||||
voxygen_i18n: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
i18n: &'a Localization,
|
||||
client: &'a Client,
|
||||
new_notifications: &'a VecDeque<Notification>,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
fonts: &'a Fonts,
|
||||
#[conrod(common_builder)]
|
||||
common: widget::CommonBuilder,
|
||||
show: &'a Show,
|
||||
@ -34,14 +34,14 @@ pub struct Popup<'a> {
|
||||
/// Dungeon Cleared (TODO), and Quest Completed (TODO)
|
||||
impl<'a> Popup<'a> {
|
||||
pub fn new(
|
||||
voxygen_i18n: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
i18n: &'a Localization,
|
||||
client: &'a Client,
|
||||
new_notifications: &'a VecDeque<Notification>,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
fonts: &'a Fonts,
|
||||
show: &'a Show,
|
||||
) -> Self {
|
||||
Self {
|
||||
voxygen_i18n,
|
||||
i18n,
|
||||
client,
|
||||
new_notifications,
|
||||
fonts,
|
||||
@ -126,7 +126,7 @@ impl<'a> Widget for Popup<'a> {
|
||||
if s.infos.is_empty() {
|
||||
s.last_info_update = Instant::now();
|
||||
}
|
||||
let text = self.voxygen_i18n.get("hud.waypoint_saved");
|
||||
let text = self.i18n.get("hud.waypoint_saved");
|
||||
s.infos.push_back(text.to_string());
|
||||
});
|
||||
},
|
||||
|
@ -5,9 +5,9 @@ use super::{
|
||||
};
|
||||
use crate::{
|
||||
hud::BuffPosition,
|
||||
i18n::{list_localizations, LanguageMetadata, VoxygenLocalization},
|
||||
i18n::{list_localizations, LanguageMetadata, Localization},
|
||||
render::{AaMode, CloudMode, FluidMode, LightingMode, RenderMode, ShadowMapMode, ShadowMode},
|
||||
ui::{fonts::ConrodVoxygenFonts, ImageSlider, ScaleMode, ToggleButton},
|
||||
ui::{fonts::Fonts, ImageSlider, ScaleMode, ToggleButton},
|
||||
window::{FullScreenSettings, FullscreenMode, GameInput},
|
||||
GlobalState,
|
||||
};
|
||||
@ -227,8 +227,8 @@ pub struct SettingsWindow<'a> {
|
||||
global_state: &'a GlobalState,
|
||||
show: &'a Show,
|
||||
imgs: &'a Imgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
fonts: &'a Fonts,
|
||||
localized_strings: &'a Localization,
|
||||
fps: f32,
|
||||
#[conrod(common_builder)]
|
||||
common: widget::CommonBuilder,
|
||||
@ -239,8 +239,8 @@ impl<'a> SettingsWindow<'a> {
|
||||
global_state: &'a GlobalState,
|
||||
show: &'a Show,
|
||||
imgs: &'a Imgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
fonts: &'a Fonts,
|
||||
localized_strings: &'a Localization,
|
||||
fps: f32,
|
||||
) -> Self {
|
||||
Self {
|
||||
|
@ -6,9 +6,9 @@ use super::{
|
||||
STAMINA_COLOR, TEXT_COLOR, UI_HIGHLIGHT_0, UI_MAIN, XP_COLOR,
|
||||
};
|
||||
use crate::{
|
||||
i18n::VoxygenLocalization,
|
||||
i18n::Localization,
|
||||
ui::{
|
||||
fonts::ConrodVoxygenFonts,
|
||||
fonts::Fonts,
|
||||
slot::{ContentSize, SlotMaker},
|
||||
ImageFrame, Tooltip, TooltipManager, Tooltipable,
|
||||
},
|
||||
@ -121,7 +121,7 @@ pub struct Skillbar<'a> {
|
||||
global_state: &'a GlobalState,
|
||||
imgs: &'a Imgs,
|
||||
item_imgs: &'a ItemImgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
fonts: &'a Fonts,
|
||||
rot_imgs: &'a ImgsRot,
|
||||
stats: &'a Stats,
|
||||
health: &'a Health,
|
||||
@ -133,7 +133,7 @@ pub struct Skillbar<'a> {
|
||||
hotbar: &'a hotbar::State,
|
||||
tooltip_manager: &'a mut TooltipManager,
|
||||
slot_manager: &'a mut slots::SlotManager,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
localized_strings: &'a Localization,
|
||||
pulse: f32,
|
||||
#[conrod(common_builder)]
|
||||
common: widget::CommonBuilder,
|
||||
@ -146,7 +146,7 @@ impl<'a> Skillbar<'a> {
|
||||
global_state: &'a GlobalState,
|
||||
imgs: &'a Imgs,
|
||||
item_imgs: &'a ItemImgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
fonts: &'a Fonts,
|
||||
rot_imgs: &'a ImgsRot,
|
||||
stats: &'a Stats,
|
||||
health: &'a Health,
|
||||
@ -159,7 +159,7 @@ impl<'a> Skillbar<'a> {
|
||||
hotbar: &'a hotbar::State,
|
||||
tooltip_manager: &'a mut TooltipManager,
|
||||
slot_manager: &'a mut slots::SlotManager,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
localized_strings: &'a Localization,
|
||||
show: &'a Show,
|
||||
) -> Self {
|
||||
Self {
|
||||
|
@ -4,8 +4,8 @@ use super::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
i18n::VoxygenLocalization,
|
||||
ui::{fonts::ConrodVoxygenFonts, ImageFrame, Tooltip, TooltipManager, Tooltipable},
|
||||
i18n::Localization,
|
||||
ui::{fonts::Fonts, ImageFrame, Tooltip, TooltipManager, Tooltipable},
|
||||
};
|
||||
use client::{self, Client};
|
||||
use common::{comp::group, sync::Uid};
|
||||
@ -66,8 +66,8 @@ pub struct Social<'a> {
|
||||
show: &'a Show,
|
||||
client: &'a Client,
|
||||
imgs: &'a Imgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
fonts: &'a Fonts,
|
||||
localized_strings: &'a Localization,
|
||||
selected_entity: Option<(specs::Entity, Instant)>,
|
||||
rot_imgs: &'a ImgsRot,
|
||||
tooltip_manager: &'a mut TooltipManager,
|
||||
@ -82,8 +82,8 @@ impl<'a> Social<'a> {
|
||||
show: &'a Show,
|
||||
client: &'a Client,
|
||||
imgs: &'a Imgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
fonts: &'a Fonts,
|
||||
localized_strings: &'a Localization,
|
||||
selected_entity: Option<(specs::Entity, Instant)>,
|
||||
rot_imgs: &'a ImgsRot,
|
||||
tooltip_manager: &'a mut TooltipManager,
|
||||
|
@ -1,5 +1,5 @@
|
||||
use super::{img_ids::Imgs, Show, TEXT_COLOR, UI_MAIN};
|
||||
use crate::{i18n::VoxygenLocalization, ui::fonts::ConrodVoxygenFonts};
|
||||
use crate::{i18n::Localization, ui::fonts::Fonts};
|
||||
use conrod_core::{
|
||||
color,
|
||||
widget::{self, Button, Image, Rectangle, Text},
|
||||
@ -24,8 +24,8 @@ pub struct Spell<'a> {
|
||||
_client: &'a Client,
|
||||
|
||||
imgs: &'a Imgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
fonts: &'a Fonts,
|
||||
localized_strings: &'a Localization,
|
||||
|
||||
#[conrod(common_builder)]
|
||||
common: widget::CommonBuilder,
|
||||
@ -36,8 +36,8 @@ impl<'a> Spell<'a> {
|
||||
show: &'a Show,
|
||||
_client: &'a Client,
|
||||
imgs: &'a Imgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
fonts: &'a Fonts,
|
||||
localized_strings: &'a Localization,
|
||||
) -> Self {
|
||||
Self {
|
||||
_show: show,
|
||||
|
@ -44,11 +44,11 @@ impl Font {
|
||||
}
|
||||
|
||||
/// Store font metadata
|
||||
pub type VoxygenFonts = HashMap<String, Font>;
|
||||
pub type Fonts = HashMap<String, Font>;
|
||||
|
||||
/// Store internationalization data
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct VoxygenLocalization {
|
||||
pub struct Localization {
|
||||
/// A map storing the localized texts
|
||||
///
|
||||
/// Localized content can be accessed using a String key.
|
||||
@ -64,12 +64,12 @@ pub struct VoxygenLocalization {
|
||||
pub convert_utf8_to_ascii: bool,
|
||||
|
||||
/// Font configuration is stored here
|
||||
pub fonts: VoxygenFonts,
|
||||
pub fonts: Fonts,
|
||||
|
||||
pub metadata: LanguageMetadata,
|
||||
}
|
||||
|
||||
impl VoxygenLocalization {
|
||||
impl Localization {
|
||||
/// Get a localized text from the given key
|
||||
///
|
||||
/// If the key is not present in the localization object
|
||||
@ -97,7 +97,7 @@ impl VoxygenLocalization {
|
||||
/// Return the missing keys compared to the reference language
|
||||
pub fn list_missing_entries(&self) -> (HashSet<String>, HashSet<String>) {
|
||||
let reference_localization =
|
||||
VoxygenLocalization::load_expect(i18n_asset_key(REFERENCE_LANG).as_ref());
|
||||
Localization::load_expect(i18n_asset_key(REFERENCE_LANG).as_ref());
|
||||
|
||||
let reference_string_keys: HashSet<_> =
|
||||
reference_localization.string_map.keys().cloned().collect();
|
||||
@ -136,14 +136,14 @@ impl VoxygenLocalization {
|
||||
}
|
||||
}
|
||||
|
||||
impl Asset for VoxygenLocalization {
|
||||
impl Asset for Localization {
|
||||
const ENDINGS: &'static [&'static str] = &["ron"];
|
||||
|
||||
/// Load the translations located in the input buffer and convert them
|
||||
/// into a `VoxygenLocalization` object.
|
||||
/// into a `Localization` object.
|
||||
#[allow(clippy::into_iter_on_ref)] // TODO: Pending review in #587
|
||||
fn parse(buf_reader: BufReader<File>, _specifier: &str) -> Result<Self, assets::Error> {
|
||||
let mut asked_localization: VoxygenLocalization =
|
||||
let mut asked_localization: Localization =
|
||||
from_reader(buf_reader).map_err(assets::Error::parse_error)?;
|
||||
|
||||
// Update the text if UTF-8 to ASCII conversion is enabled
|
||||
@ -163,10 +163,10 @@ impl Asset for VoxygenLocalization {
|
||||
}
|
||||
}
|
||||
|
||||
/// Load all the available languages located in the Voxygen asset directory
|
||||
/// Load all the available languages located in the voxygen asset directory
|
||||
pub fn list_localizations() -> Vec<LanguageMetadata> {
|
||||
let voxygen_locales_assets = "voxygen.i18n.*";
|
||||
let lang_list = VoxygenLocalization::load_glob(voxygen_locales_assets).unwrap();
|
||||
let lang_list = Localization::load_glob(voxygen_locales_assets).unwrap();
|
||||
lang_list.iter().map(|e| (*e).metadata.clone()).collect()
|
||||
}
|
||||
|
||||
@ -175,7 +175,7 @@ pub fn i18n_asset_key(language_id: &str) -> String { "voxygen.i18n.".to_string()
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::VoxygenLocalization;
|
||||
use super::Localization;
|
||||
use git2::Repository;
|
||||
use ron::de::{from_bytes, from_reader};
|
||||
use std::{
|
||||
@ -248,7 +248,7 @@ mod tests {
|
||||
|
||||
fn generate_key_version<'a>(
|
||||
repo: &'a git2::Repository,
|
||||
localization: &VoxygenLocalization,
|
||||
localization: &Localization,
|
||||
path: &std::path::Path,
|
||||
file_blob: &git2::Blob,
|
||||
) -> HashMap<String, LocalizationEntryState> {
|
||||
@ -348,7 +348,7 @@ mod tests {
|
||||
);
|
||||
for path in i18n_files {
|
||||
let f = fs::File::open(&path).expect("Failed opening file");
|
||||
let _: VoxygenLocalization = match from_reader(f) {
|
||||
let _: Localization = match from_reader(f) {
|
||||
Ok(v) => v,
|
||||
Err(e) => {
|
||||
panic!(
|
||||
@ -387,7 +387,7 @@ mod tests {
|
||||
|
||||
// Read HEAD for the reference language file
|
||||
let i18n_en_blob = read_file_from_path(&repo, &head_ref, &en_i18n_path);
|
||||
let loc: VoxygenLocalization = from_bytes(i18n_en_blob.content())
|
||||
let loc: Localization = from_bytes(i18n_en_blob.content())
|
||||
.expect("Expect to parse reference i18n RON file, can't proceed without it");
|
||||
let i18n_references: HashMap<String, LocalizationEntryState> =
|
||||
generate_key_version(&repo, &loc, &en_i18n_path, &i18n_en_blob);
|
||||
@ -406,7 +406,7 @@ mod tests {
|
||||
|
||||
// Find the localization entry state
|
||||
let current_blob = read_file_from_path(&repo, &head_ref, &relfile);
|
||||
let current_loc: VoxygenLocalization = match from_bytes(current_blob.content()) {
|
||||
let current_loc: Localization = match from_bytes(current_blob.content()) {
|
||||
Ok(v) => v,
|
||||
Err(e) => {
|
||||
eprintln!(
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
use veloren_voxygen::{
|
||||
audio::{self, AudioFrontend},
|
||||
i18n::{self, i18n_asset_key, VoxygenLocalization},
|
||||
i18n::{self, i18n_asset_key, Localization},
|
||||
logging,
|
||||
profile::Profile,
|
||||
run,
|
||||
@ -157,7 +157,7 @@ fn main() {
|
||||
let profile = Profile::load();
|
||||
|
||||
let mut localization_watcher = watch::ReloadIndicator::new();
|
||||
let localized_strings = VoxygenLocalization::load_watched(
|
||||
let localized_strings = Localization::load_watched(
|
||||
&i18n_asset_key(&settings.language.selected_language),
|
||||
&mut localization_watcher,
|
||||
)
|
||||
@ -169,7 +169,7 @@ fn main() {
|
||||
"Impossible to load language: change to the default language (English) instead.",
|
||||
);
|
||||
settings.language.selected_language = i18n::REFERENCE_LANG.to_owned();
|
||||
VoxygenLocalization::load_watched(
|
||||
Localization::load_watched(
|
||||
&i18n_asset_key(&settings.language.selected_language),
|
||||
&mut localization_watcher,
|
||||
)
|
||||
|
@ -1,7 +1,7 @@
|
||||
mod ui;
|
||||
|
||||
use crate::{
|
||||
i18n::{i18n_asset_key, VoxygenLocalization},
|
||||
i18n::{i18n_asset_key, Localization},
|
||||
render::Renderer,
|
||||
scene::simple::{self as scene, Scene},
|
||||
session::SessionState,
|
||||
@ -149,7 +149,7 @@ impl PlayState for CharSelectionState {
|
||||
}
|
||||
|
||||
// Tick the client (currently only to keep the connection alive).
|
||||
let localized_strings = VoxygenLocalization::load_expect(&i18n_asset_key(
|
||||
let localized_strings = Localization::load_expect(&i18n_asset_key(
|
||||
&global_state.settings.language.selected_language,
|
||||
));
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
use crate::{
|
||||
i18n::{i18n_asset_key, VoxygenLocalization},
|
||||
i18n::{i18n_asset_key, Localization},
|
||||
render::{Consts, Globals, Renderer},
|
||||
ui::{
|
||||
fonts::ConrodVoxygenFonts,
|
||||
fonts::Fonts,
|
||||
img_ids::{BlankGraphic, ImageGraphic, VoxelGraphic, VoxelSs9Graphic},
|
||||
ImageFrame, ImageSlider, Tooltip, Tooltipable, Ui,
|
||||
},
|
||||
@ -26,7 +26,6 @@ use conrod_core::{
|
||||
widget_ids, Borderable, Color, Colorable, Labelable, Positionable, Sizeable, UiCell, Widget,
|
||||
};
|
||||
use rand::{thread_rng, Rng};
|
||||
use std::sync::Arc;
|
||||
|
||||
const STARTER_HAMMER: &str = "common.items.weapons.hammer.starter_hammer";
|
||||
const STARTER_BOW: &str = "common.items.weapons.bow.starter_bow";
|
||||
@ -300,9 +299,9 @@ pub struct CharSelectionUi {
|
||||
ids: Ids,
|
||||
imgs: Imgs,
|
||||
rot_imgs: ImgsRot,
|
||||
fonts: ConrodVoxygenFonts,
|
||||
fonts: Fonts,
|
||||
info_content: InfoContent,
|
||||
voxygen_i18n: Arc<VoxygenLocalization>,
|
||||
i18n: std::sync::Arc<Localization>,
|
||||
enter: bool,
|
||||
pub mode: Mode,
|
||||
pub selected_character: usize,
|
||||
@ -321,12 +320,11 @@ impl CharSelectionUi {
|
||||
let imgs = Imgs::load(&mut ui).expect("Failed to load images!");
|
||||
let rot_imgs = ImgsRot::load(&mut ui).expect("Failed to load images!");
|
||||
// Load language
|
||||
let voxygen_i18n = VoxygenLocalization::load_expect(&i18n_asset_key(
|
||||
let i18n = Localization::load_expect(&i18n_asset_key(
|
||||
&global_state.settings.language.selected_language,
|
||||
));
|
||||
// Load fonts.
|
||||
let fonts = ConrodVoxygenFonts::load(&voxygen_i18n.fonts, &mut ui)
|
||||
.expect("Impossible to load fonts!");
|
||||
let fonts = Fonts::load(&i18n.fonts, &mut ui).expect("Impossible to load fonts!");
|
||||
|
||||
Self {
|
||||
ui,
|
||||
@ -336,7 +334,7 @@ impl CharSelectionUi {
|
||||
fonts,
|
||||
info_content: InfoContent::LoadingCharacters,
|
||||
selected_character: 0,
|
||||
voxygen_i18n,
|
||||
i18n,
|
||||
mode: Mode::Select(None),
|
||||
enter: false,
|
||||
}
|
||||
@ -483,7 +481,7 @@ impl CharSelectionUi {
|
||||
match self.info_content {
|
||||
InfoContent::None => unreachable!(),
|
||||
InfoContent::Deletion(character_index) => {
|
||||
Text::new(&self.voxygen_i18n.get("char_selection.delete_permanently"))
|
||||
Text::new(&self.i18n.get("char_selection.delete_permanently"))
|
||||
.mid_top_with_margin_on(self.ids.info_frame, 40.0)
|
||||
.font_size(self.fonts.cyri.scale(24))
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
@ -495,7 +493,7 @@ impl CharSelectionUi {
|
||||
.hover_image(self.imgs.button_hover)
|
||||
.press_image(self.imgs.button_press)
|
||||
.label_y(Relative::Scalar(2.0))
|
||||
.label(&self.voxygen_i18n.get("common.no"))
|
||||
.label(&self.i18n.get("common.no"))
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.label_font_size(self.fonts.cyri.scale(18))
|
||||
.label_color(TEXT_COLOR)
|
||||
@ -510,7 +508,7 @@ impl CharSelectionUi {
|
||||
.hover_image(self.imgs.button_hover)
|
||||
.press_image(self.imgs.button_press)
|
||||
.label_y(Relative::Scalar(2.0))
|
||||
.label(&self.voxygen_i18n.get("common.yes"))
|
||||
.label(&self.i18n.get("common.yes"))
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.label_font_size(self.fonts.cyri.scale(18))
|
||||
.label_color(TEXT_COLOR)
|
||||
@ -532,7 +530,7 @@ impl CharSelectionUi {
|
||||
};
|
||||
},
|
||||
InfoContent::LoadingCharacters => {
|
||||
Text::new(&self.voxygen_i18n.get("char_selection.loading_characters"))
|
||||
Text::new(&self.i18n.get("char_selection.loading_characters"))
|
||||
.mid_top_with_margin_on(self.ids.info_frame, 40.0)
|
||||
.font_size(self.fonts.cyri.scale(24))
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
@ -540,7 +538,7 @@ impl CharSelectionUi {
|
||||
.set(self.ids.loading_characters_text, ui_widgets);
|
||||
},
|
||||
InfoContent::CreatingCharacter => {
|
||||
Text::new(&self.voxygen_i18n.get("char_selection.creating_character"))
|
||||
Text::new(&self.i18n.get("char_selection.creating_character"))
|
||||
.mid_top_with_margin_on(self.ids.info_frame, 40.0)
|
||||
.font_size(self.fonts.cyri.scale(24))
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
@ -548,7 +546,7 @@ impl CharSelectionUi {
|
||||
.set(self.ids.creating_character_text, ui_widgets);
|
||||
},
|
||||
InfoContent::DeletingCharacter => {
|
||||
Text::new(&self.voxygen_i18n.get("char_selection.deleting_character"))
|
||||
Text::new(&self.i18n.get("char_selection.deleting_character"))
|
||||
.mid_top_with_margin_on(self.ids.info_frame, 40.0)
|
||||
.font_size(self.fonts.cyri.scale(24))
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
@ -559,7 +557,7 @@ impl CharSelectionUi {
|
||||
if let Some(error_message) = &client.character_list.error {
|
||||
Text::new(&format!(
|
||||
"{}: {}",
|
||||
&self.voxygen_i18n.get("common.error"),
|
||||
&self.i18n.get("common.error"),
|
||||
error_message
|
||||
))
|
||||
.mid_top_with_margin_on(self.ids.info_frame, 40.0)
|
||||
@ -574,7 +572,7 @@ impl CharSelectionUi {
|
||||
.hover_image(self.imgs.button_hover)
|
||||
.press_image(self.imgs.button_press)
|
||||
.label_y(Relative::Scalar(2.0))
|
||||
.label(&self.voxygen_i18n.get("common.close"))
|
||||
.label(&self.i18n.get("common.close"))
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.label_font_size(self.fonts.cyri.scale(18))
|
||||
.label_color(TEXT_COLOR)
|
||||
@ -644,7 +642,7 @@ impl CharSelectionUi {
|
||||
.parent(self.ids.charlist_bg)
|
||||
.hover_image(self.imgs.button_hover)
|
||||
.press_image(self.imgs.button_press)
|
||||
.label(&self.voxygen_i18n.get("char_selection.change_server"))
|
||||
.label(&self.i18n.get("char_selection.change_server"))
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.label_font_size(self.fonts.cyri.scale(18))
|
||||
@ -657,7 +655,7 @@ impl CharSelectionUi {
|
||||
|
||||
// Enter World Button
|
||||
let character_count = client.character_list.characters.len();
|
||||
let enter_world_str = &self.voxygen_i18n.get("char_selection.enter_world");
|
||||
let enter_world_str = &self.i18n.get("char_selection.enter_world");
|
||||
let enter_button = Button::image(self.imgs.button)
|
||||
.mid_bottom_with_margin_on(ui_widgets.window, 10.0)
|
||||
.w_h(250.0, 60.0)
|
||||
@ -691,7 +689,7 @@ impl CharSelectionUi {
|
||||
.w_h(150.0, 40.0)
|
||||
.hover_image(self.imgs.button_hover)
|
||||
.press_image(self.imgs.button_press)
|
||||
.label(&self.voxygen_i18n.get("char_selection.logout"))
|
||||
.label(&self.i18n.get("char_selection.logout"))
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(self.fonts.cyri.scale(20))
|
||||
@ -772,7 +770,7 @@ impl CharSelectionUi {
|
||||
.press_image(self.imgs.delete_button_press)
|
||||
.with_tooltip(
|
||||
tooltip_manager,
|
||||
&self.voxygen_i18n.get("char_selection.delete_permanently"),
|
||||
&self.i18n.get("char_selection.delete_permanently"),
|
||||
"",
|
||||
&tooltip_human,
|
||||
TEXT_COLOR,
|
||||
@ -791,7 +789,7 @@ impl CharSelectionUi {
|
||||
|
||||
Text::new(
|
||||
&self
|
||||
.voxygen_i18n
|
||||
.i18n
|
||||
.get("char_selection.level_fmt")
|
||||
.replace("{level_nb}", &character_item.level.to_string()),
|
||||
)
|
||||
@ -801,7 +799,7 @@ impl CharSelectionUi {
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.character_levels[i], ui_widgets);
|
||||
|
||||
Text::new(&self.voxygen_i18n.get("char_selection.uncanny_valley"))
|
||||
Text::new(&self.i18n.get("char_selection.uncanny_valley"))
|
||||
.down_from(self.ids.character_levels[i], 4.0)
|
||||
.font_size(self.fonts.cyri.scale(17))
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
@ -834,7 +832,7 @@ impl CharSelectionUi {
|
||||
.w_h(386.0, 80.0)
|
||||
.hover_image(self.imgs.selection_hover)
|
||||
.press_image(self.imgs.selection_press)
|
||||
.label(&self.voxygen_i18n.get("char_selection.create_new_charater"))
|
||||
.label(&self.i18n.get("char_selection.create_new_charater"))
|
||||
.label_color(color)
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.image_color(color)
|
||||
@ -869,7 +867,7 @@ impl CharSelectionUi {
|
||||
.w_h(150.0, 40.0)
|
||||
.hover_image(self.imgs.button_hover)
|
||||
.press_image(self.imgs.button_press)
|
||||
.label(&self.voxygen_i18n.get("common.back"))
|
||||
.label(&self.i18n.get("common.back"))
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(self.fonts.cyri.scale(20))
|
||||
@ -893,7 +891,7 @@ impl CharSelectionUi {
|
||||
} else {
|
||||
self.imgs.button
|
||||
})
|
||||
.label(&self.voxygen_i18n.get("common.create"))
|
||||
.label(&self.i18n.get("common.create"))
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.label_color(if *name != "Character Name" && *name != "" {
|
||||
TEXT_COLOR
|
||||
@ -908,7 +906,7 @@ impl CharSelectionUi {
|
||||
if create_button
|
||||
.with_tooltip(
|
||||
tooltip_manager,
|
||||
&self.voxygen_i18n.get("char_selection.create_info_name"),
|
||||
&self.i18n.get("char_selection.create_info_name"),
|
||||
"",
|
||||
&tooltip_human,
|
||||
TEXT_COLOR,
|
||||
@ -1081,7 +1079,7 @@ impl CharSelectionUi {
|
||||
.press_image(self.imgs.icon_border_press)
|
||||
.with_tooltip(
|
||||
tooltip_manager,
|
||||
&self.voxygen_i18n.get("common.species.human"),
|
||||
&self.i18n.get("common.species.human"),
|
||||
"",
|
||||
&tooltip_human,
|
||||
TEXT_COLOR,
|
||||
@ -1108,7 +1106,7 @@ impl CharSelectionUi {
|
||||
.press_image(self.imgs.icon_border_press)
|
||||
.with_tooltip(
|
||||
tooltip_manager,
|
||||
&self.voxygen_i18n.get("common.species.orc"),
|
||||
&self.i18n.get("common.species.orc"),
|
||||
"",
|
||||
&tooltip_human,
|
||||
TEXT_COLOR,
|
||||
@ -1134,7 +1132,7 @@ impl CharSelectionUi {
|
||||
.press_image(self.imgs.icon_border_press)
|
||||
.with_tooltip(
|
||||
tooltip_manager,
|
||||
&self.voxygen_i18n.get("common.species.dwarf"),
|
||||
&self.i18n.get("common.species.dwarf"),
|
||||
"",
|
||||
&tooltip_human,
|
||||
TEXT_COLOR,
|
||||
@ -1160,7 +1158,7 @@ impl CharSelectionUi {
|
||||
.press_image(self.imgs.icon_border_press)
|
||||
.with_tooltip(
|
||||
tooltip_manager,
|
||||
&self.voxygen_i18n.get("common.species.elf"),
|
||||
&self.i18n.get("common.species.elf"),
|
||||
"",
|
||||
&tooltip_human,
|
||||
TEXT_COLOR,
|
||||
@ -1187,7 +1185,7 @@ impl CharSelectionUi {
|
||||
.press_image(self.imgs.icon_border_press)
|
||||
.with_tooltip(
|
||||
tooltip_manager,
|
||||
&self.voxygen_i18n.get("common.species.undead"),
|
||||
&self.i18n.get("common.species.undead"),
|
||||
"",
|
||||
&tooltip_human,
|
||||
TEXT_COLOR,
|
||||
@ -1213,7 +1211,7 @@ impl CharSelectionUi {
|
||||
.press_image(self.imgs.icon_border_press)
|
||||
.with_tooltip(
|
||||
tooltip_manager,
|
||||
&self.voxygen_i18n.get("common.species.danari"),
|
||||
&self.i18n.get("common.species.danari"),
|
||||
"",
|
||||
&tooltip_human,
|
||||
TEXT_COLOR,
|
||||
@ -1239,7 +1237,7 @@ impl CharSelectionUi {
|
||||
.press_image(self.imgs.icon_border_press)
|
||||
.with_tooltip(
|
||||
tooltip_manager,
|
||||
&self.voxygen_i18n.get("common.weapons.sceptre"),
|
||||
&self.i18n.get("common.weapons.sceptre"),
|
||||
"",
|
||||
&tooltip_human,
|
||||
TEXT_COLOR,
|
||||
@ -1265,7 +1263,7 @@ impl CharSelectionUi {
|
||||
.press_image(self.imgs.icon_border_press)
|
||||
.with_tooltip(
|
||||
tooltip_manager,
|
||||
&self.voxygen_i18n.get("common.weapons.bow"),
|
||||
&self.i18n.get("common.weapons.bow"),
|
||||
"",
|
||||
&tooltip_human,
|
||||
TEXT_COLOR,
|
||||
@ -1290,7 +1288,7 @@ impl CharSelectionUi {
|
||||
.press_image(self.imgs.icon_border_press)
|
||||
.with_tooltip(
|
||||
tooltip_manager,
|
||||
&self.voxygen_i18n.get("common.weapons.staff"),
|
||||
&self.i18n.get("common.weapons.staff"),
|
||||
"",
|
||||
&tooltip_human,
|
||||
TEXT_COLOR,
|
||||
@ -1315,7 +1313,7 @@ impl CharSelectionUi {
|
||||
.press_image(self.imgs.icon_border_press)
|
||||
.with_tooltip(
|
||||
tooltip_manager,
|
||||
&self.voxygen_i18n.get("common.weapons.sword"),
|
||||
&self.i18n.get("common.weapons.sword"),
|
||||
"",
|
||||
&tooltip_human,
|
||||
TEXT_COLOR,
|
||||
@ -1341,7 +1339,7 @@ impl CharSelectionUi {
|
||||
.press_image(self.imgs.icon_border_press)
|
||||
.with_tooltip(
|
||||
tooltip_manager,
|
||||
&self.voxygen_i18n.get("common.weapons.hammer"),
|
||||
&self.i18n.get("common.weapons.hammer"),
|
||||
"",
|
||||
&tooltip_human,
|
||||
TEXT_COLOR,
|
||||
@ -1367,7 +1365,7 @@ impl CharSelectionUi {
|
||||
.press_image(self.imgs.icon_border_press)
|
||||
.with_tooltip(
|
||||
tooltip_manager,
|
||||
&self.voxygen_i18n.get("common.weapons.axe"),
|
||||
&self.i18n.get("common.weapons.axe"),
|
||||
"",
|
||||
&tooltip_human,
|
||||
TEXT_COLOR,
|
||||
@ -1385,7 +1383,7 @@ impl CharSelectionUi {
|
||||
.press_image(self.imgs.dice_press)
|
||||
.with_tooltip(
|
||||
tooltip_manager,
|
||||
&self.voxygen_i18n.get("common.rand_appearance"),
|
||||
&self.i18n.get("common.rand_appearance"),
|
||||
"",
|
||||
&tooltip_human,
|
||||
TEXT_COLOR,
|
||||
@ -1436,7 +1434,7 @@ impl CharSelectionUi {
|
||||
// Hair Style
|
||||
if let Some(new_val) = char_slider(
|
||||
self.ids.creation_buttons_alignment_2,
|
||||
self.voxygen_i18n.get("char_selection.hair_style"),
|
||||
self.i18n.get("char_selection.hair_style"),
|
||||
self.ids.hairstyle_text,
|
||||
body.species.num_hair_styles(body.body_type) as usize - 1,
|
||||
body.hair_style as usize,
|
||||
@ -1448,7 +1446,7 @@ impl CharSelectionUi {
|
||||
// Hair Color
|
||||
if let Some(new_val) = char_slider(
|
||||
self.ids.hairstyle_slider,
|
||||
self.voxygen_i18n.get("char_selection.hair_color"),
|
||||
self.i18n.get("char_selection.hair_color"),
|
||||
self.ids.haircolor_text,
|
||||
body.species.num_hair_colors() as usize - 1,
|
||||
body.hair_color as usize,
|
||||
@ -1460,7 +1458,7 @@ impl CharSelectionUi {
|
||||
// Skin
|
||||
if let Some(new_val) = char_slider(
|
||||
self.ids.haircolor_slider,
|
||||
self.voxygen_i18n.get("char_selection.skin"),
|
||||
self.i18n.get("char_selection.skin"),
|
||||
self.ids.skin_text,
|
||||
body.species.num_skin_colors() as usize - 1,
|
||||
body.skin as usize,
|
||||
@ -1472,7 +1470,7 @@ impl CharSelectionUi {
|
||||
// Eyebrows
|
||||
if let Some(new_val) = char_slider(
|
||||
self.ids.skin_slider,
|
||||
self.voxygen_i18n.get("char_selection.eyeshape"),
|
||||
self.i18n.get("char_selection.eyeshape"),
|
||||
self.ids.eyebrows_text,
|
||||
body.species.num_eyes(body.body_type) as usize - 1,
|
||||
body.eyes as usize,
|
||||
@ -1484,7 +1482,7 @@ impl CharSelectionUi {
|
||||
// EyeColor
|
||||
if let Some(new_val) = char_slider(
|
||||
self.ids.eyebrows_slider,
|
||||
self.voxygen_i18n.get("char_selection.eye_color"),
|
||||
self.i18n.get("char_selection.eye_color"),
|
||||
self.ids.eyecolor_text,
|
||||
body.species.num_eye_colors() as usize - 1,
|
||||
body.eye_color as usize,
|
||||
@ -1497,7 +1495,7 @@ impl CharSelectionUi {
|
||||
let _current_accessory = body.accessory;
|
||||
if let Some(new_val) = char_slider(
|
||||
self.ids.eyecolor_slider,
|
||||
self.voxygen_i18n.get("char_selection.accessories"),
|
||||
self.i18n.get("char_selection.accessories"),
|
||||
self.ids.accessories_text,
|
||||
body.species.num_accessories(body.body_type) as usize - 1,
|
||||
body.accessory as usize,
|
||||
@ -1510,7 +1508,7 @@ impl CharSelectionUi {
|
||||
if body.species.num_beards(body.body_type) > 1 {
|
||||
if let Some(new_val) = char_slider(
|
||||
self.ids.accessories_slider,
|
||||
self.voxygen_i18n.get("char_selection.beard"),
|
||||
self.i18n.get("char_selection.beard"),
|
||||
self.ids.beard_text,
|
||||
body.species.num_beards(body.body_type) as usize - 1,
|
||||
body.beard as usize,
|
||||
@ -1520,7 +1518,7 @@ impl CharSelectionUi {
|
||||
body.beard = new_val as u8;
|
||||
}
|
||||
} else {
|
||||
Text::new(&self.voxygen_i18n.get("char_selection.beard"))
|
||||
Text::new(&self.i18n.get("char_selection.beard"))
|
||||
.mid_bottom_with_margin_on(self.ids.accessories_slider, -40.0)
|
||||
.font_size(self.fonts.cyri.scale(18))
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
@ -1541,7 +1539,7 @@ impl CharSelectionUi {
|
||||
.expect("Unable to load armor!");
|
||||
if let Some(new_val) = char_slider(
|
||||
self.ids.beard_slider,
|
||||
self.voxygen_i18n.get("char_selection.chest_color"),
|
||||
self.i18n.get("char_selection.chest_color"),
|
||||
self.ids.chest_text,
|
||||
armor.len() - 1,
|
||||
armor
|
||||
|
@ -47,7 +47,7 @@ impl PlayState for MainMenuState {
|
||||
|
||||
fn tick(&mut self, global_state: &mut GlobalState, events: Vec<Event>) -> PlayStateResult {
|
||||
span!(_guard, "tick", "<MainMenuState as PlayState>::tick");
|
||||
let localized_strings = crate::i18n::VoxygenLocalization::load_expect(
|
||||
let localized_strings = crate::i18n::Localization::load_expect(
|
||||
&crate::i18n::i18n_asset_key(&global_state.settings.language.selected_language),
|
||||
);
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
use crate::{
|
||||
i18n::{i18n_asset_key, VoxygenLocalization},
|
||||
i18n::{i18n_asset_key, Localization},
|
||||
render::Renderer,
|
||||
ui::{
|
||||
self,
|
||||
fonts::ConrodVoxygenFonts,
|
||||
fonts::Fonts,
|
||||
ice::{Element, IcedUi},
|
||||
img_ids::{BlankGraphic, ImageGraphic, VoxelGraphic},
|
||||
Graphic, Ui,
|
||||
@ -190,7 +190,7 @@ struct IcedState {
|
||||
}
|
||||
pub type Message = Event;
|
||||
impl IcedState {
|
||||
pub fn view(&mut self) -> Element<Message> {
|
||||
pub fn view(&mut self, i18n: &Localization) -> Element<Message> {
|
||||
use iced::{Align, Column, Container, Length, Row, Space, Text};
|
||||
use ui::ice::{
|
||||
compound_graphic::{CompoundGraphic, Graphic},
|
||||
@ -206,13 +206,30 @@ impl IcedState {
|
||||
Text::new("Quit"),
|
||||
)
|
||||
.into(), */
|
||||
Text::new("Quit").size(20).into(),
|
||||
Text::new(i18n.get("common.quit")).size(40).into(),
|
||||
])
|
||||
.width(Length::Fill)
|
||||
.max_width(200)
|
||||
.spacing(5)
|
||||
.padding(10);
|
||||
|
||||
// Quit
|
||||
/*if Button::image(self.imgs.button)
|
||||
.w_h(190.0, 40.0)
|
||||
.bottom_left_with_margins_on(ui_widgets.window, 60.0, 30.0)
|
||||
.hover_image(self.imgs.button_hover)
|
||||
.press_image(self.imgs.button_press)
|
||||
.label(i18n.get("common.quit"))
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(self.fonts.cyri.scale(20))
|
||||
.label_y(Relative::Scalar(3.0))
|
||||
.set(self.ids.quit_button, ui_widgets)
|
||||
.was_clicked()
|
||||
{
|
||||
events.push(Event::Quit);
|
||||
}*/
|
||||
|
||||
let buttons = Container::new(buttons)
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fill)
|
||||
@ -331,8 +348,8 @@ pub struct MainMenuUi {
|
||||
time: f32,
|
||||
anim_timer: f32,
|
||||
bg_img_id: conrod_core::image::Id,
|
||||
voxygen_i18n: std::sync::Arc<VoxygenLocalization>,
|
||||
fonts: ConrodVoxygenFonts,
|
||||
i18n: std::sync::Arc<Localization>,
|
||||
fonts: Fonts,
|
||||
tip_no: u16,
|
||||
pub show_iced: bool,
|
||||
}
|
||||
@ -376,21 +393,22 @@ impl<'a> MainMenuUi {
|
||||
));
|
||||
//let chosen_tip = *tips.choose(&mut rng).unwrap();
|
||||
// Load language
|
||||
let voxygen_i18n = VoxygenLocalization::load_expect(&i18n_asset_key(
|
||||
let i18n = Localization::load_expect(&i18n_asset_key(
|
||||
&global_state.settings.language.selected_language,
|
||||
));
|
||||
// Load fonts.
|
||||
let fonts = ConrodVoxygenFonts::load(&voxygen_i18n.fonts, &mut ui)
|
||||
.expect("Impossible to load fonts!");
|
||||
let fonts = Fonts::load(&i18n.fonts, &mut ui).expect("Impossible to load fonts!");
|
||||
|
||||
// TODO: newtype Font
|
||||
let ice_font = {
|
||||
use std::io::Read;
|
||||
let mut buf = Vec::new();
|
||||
common::assets::load_file("voxygen.font.OpenSans-Regular", &["ttf"])
|
||||
.unwrap()
|
||||
.read_to_end(&mut buf)
|
||||
.unwrap();
|
||||
common::assets::load_file("voxygen.font.haxrcorp_4089_cyrillic_altgr_extended", &[
|
||||
"ttf",
|
||||
])
|
||||
.unwrap()
|
||||
.read_to_end(&mut buf)
|
||||
.unwrap();
|
||||
glyph_brush::rusttype::Font::from_bytes(buf).unwrap()
|
||||
};
|
||||
|
||||
@ -421,7 +439,7 @@ impl<'a> MainMenuUi {
|
||||
anim_timer: 0.0,
|
||||
//show_disclaimer: global_state.settings.show_disclaimer,
|
||||
bg_img_id,
|
||||
voxygen_i18n,
|
||||
i18n,
|
||||
fonts,
|
||||
tip_no: 0,
|
||||
show_iced: false,
|
||||
@ -438,8 +456,8 @@ impl<'a> MainMenuUi {
|
||||
let (ref mut ui_widgets, ref mut _tooltip_manager) = self.ui.set_widgets();
|
||||
let tip_msg = format!(
|
||||
"{} {}",
|
||||
&self.voxygen_i18n.get("main.tip"),
|
||||
&self.voxygen_i18n.get_variation("loading.tips", self.tip_no),
|
||||
&self.i18n.get("main.tip"),
|
||||
&self.i18n.get_variation("loading.tips", self.tip_no),
|
||||
);
|
||||
let tip_show = global_state.settings.gameplay.loading_tips;
|
||||
let mut rng = thread_rng();
|
||||
@ -450,7 +468,7 @@ impl<'a> MainMenuUi {
|
||||
const TEXT_BG: Color = Color::Rgba(0.0, 0.0, 0.0, 1.0);
|
||||
//const INACTIVE: Color = Color::Rgba(0.47, 0.47, 0.47, 0.47);
|
||||
|
||||
let intro_text = &self.voxygen_i18n.get("main.login_process");
|
||||
let intro_text = &self.i18n.get("main.login_process");
|
||||
|
||||
// Tooltip
|
||||
/*let _tooltip = Tooltip::new({
|
||||
@ -614,9 +632,9 @@ impl<'a> MainMenuUi {
|
||||
.press_image(self.imgs.button_press)
|
||||
.label_y(Relative::Scalar(2.0))
|
||||
.label(match popup_type {
|
||||
PopupType::Error => self.voxygen_i18n.get("common.okay"),
|
||||
PopupType::ConnectionInfo => self.voxygen_i18n.get("common.cancel"),
|
||||
PopupType::AuthTrustPrompt(_) => self.voxygen_i18n.get("common.cancel"),
|
||||
PopupType::Error => self.i18n.get("common.okay"),
|
||||
PopupType::ConnectionInfo => self.i18n.get("common.cancel"),
|
||||
PopupType::AuthTrustPrompt(_) => self.i18n.get("common.cancel"),
|
||||
})
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.label_font_size(self.fonts.cyri.scale(15))
|
||||
@ -652,7 +670,7 @@ impl<'a> MainMenuUi {
|
||||
{
|
||||
events.push(Event::AuthServerTrust(auth_server.clone(), true));
|
||||
change_popup = Some(Some(PopupData {
|
||||
msg: self.voxygen_i18n.get("main.connecting").into(),
|
||||
msg: self.i18n.get("main.connecting").into(),
|
||||
popup_type: PopupType::ConnectionInfo,
|
||||
}));
|
||||
}
|
||||
@ -690,13 +708,13 @@ impl<'a> MainMenuUi {
|
||||
.scroll_kids_vertically()
|
||||
.set(self.ids.disc_window, ui_widgets);
|
||||
|
||||
Text::new(&self.voxygen_i18n.get("common.disclaimer"))
|
||||
Text::new(&self.i18n.get("common.disclaimer"))
|
||||
.top_left_with_margins_on(self.ids.disc_window, 30.0, 40.0)
|
||||
.font_size(self.fonts.cyri.scale(35))
|
||||
.font_id(self.fonts.alkhemi.conrod_id)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.disc_text_1, ui_widgets);
|
||||
Text::new(&self.voxygen_i18n.get("main.notice"))
|
||||
Text::new(&self.i18n.get("main.notice"))
|
||||
.top_left_with_margins_on(self.ids.disc_window, 110.0, 40.0)
|
||||
.font_size(self.fonts.cyri.scale(26))
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
@ -708,7 +726,7 @@ impl<'a> MainMenuUi {
|
||||
.hover_image(self.imgs.button_hover)
|
||||
.press_image(self.imgs.button_press)
|
||||
.label_y(Relative::Scalar(2.0))
|
||||
.label(&self.voxygen_i18n.get("common.accept"))
|
||||
.label(&self.i18n.get("common.accept"))
|
||||
.label_font_size(self.fonts.cyri.scale(22))
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
@ -727,7 +745,7 @@ impl<'a> MainMenuUi {
|
||||
self.connect = true;
|
||||
self.connecting = Some(std::time::Instant::now());
|
||||
self.popup = Some(PopupData {
|
||||
msg: [self.voxygen_i18n.get("main.connecting"), "..."].concat(),
|
||||
msg: [self.i18n.get("main.connecting"), "..."].concat(),
|
||||
popup_type: PopupType::ConnectionInfo,
|
||||
});
|
||||
|
||||
@ -764,7 +782,7 @@ impl<'a> MainMenuUi {
|
||||
self.connect = true;
|
||||
self.connecting = Some(std::time::Instant::now());
|
||||
self.popup = Some(PopupData {
|
||||
msg: [self.voxygen_i18n.get(""), ""].concat(),
|
||||
msg: [self.i18n.get(""), ""].concat(),
|
||||
popup_type: PopupType::ConnectionInfo,
|
||||
});
|
||||
};
|
||||
@ -893,7 +911,7 @@ impl<'a> MainMenuUi {
|
||||
.hover_image(self.imgs.button_hover)
|
||||
.press_image(self.imgs.button_press)
|
||||
.label_y(Relative::Scalar(2.0))
|
||||
.label(&self.voxygen_i18n.get("common.close"))
|
||||
.label(&self.i18n.get("common.close"))
|
||||
.label_font_size(self.fonts.cyri.scale(20))
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.label_color(TEXT_COLOR)
|
||||
@ -942,7 +960,7 @@ impl<'a> MainMenuUi {
|
||||
.w_h(258.0*scale, 55.0*scale)
|
||||
.down_from(self.ids.address_bg, 20.0*scale)
|
||||
.align_middle_x_of(self.ids.address_bg)
|
||||
.label(&self.voxygen_i18n.get("common.multiplayer"))
|
||||
.label(&self.i18n.get("common.multiplayer"))
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(self.fonts.cyri.scale(18))
|
||||
@ -970,7 +988,7 @@ impl<'a> MainMenuUi {
|
||||
.w_h(258.0 * scale, 55.0 * scale)
|
||||
.down_from(self.ids.login_button, 20.0 * scale)
|
||||
.align_middle_x_of(self.ids.address_bg)
|
||||
.label(&self.voxygen_i18n.get("common.singleplayer"))
|
||||
.label(&self.i18n.get("common.singleplayer"))
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(self.fonts.cyri.scale(18))
|
||||
@ -989,7 +1007,7 @@ impl<'a> MainMenuUi {
|
||||
.bottom_left_with_margins_on(ui_widgets.window, 60.0 * scale, 30.0 * scale)
|
||||
.hover_image(self.imgs.button_hover)
|
||||
.press_image(self.imgs.button_press)
|
||||
.label(&self.voxygen_i18n.get("common.quit"))
|
||||
.label(&self.i18n.get("common.quit"))
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(self.fonts.cyri.scale(16))
|
||||
@ -1006,7 +1024,7 @@ impl<'a> MainMenuUi {
|
||||
.up_from(self.ids.quit_button, 8.0*scale)
|
||||
//.hover_image(self.imgs.button_hover)
|
||||
//.press_image(self.imgs.button_press)
|
||||
.label(&self.voxygen_i18n.get("common.settings"))
|
||||
.label(&self.i18n.get("common.settings"))
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.label_color(TEXT_COLOR_2)
|
||||
.label_font_size(self.fonts.cyri.scale(16))
|
||||
@ -1023,7 +1041,7 @@ impl<'a> MainMenuUi {
|
||||
.up_from(self.ids.settings_button, 8.0 * scale)
|
||||
.hover_image(self.imgs.button_hover)
|
||||
.press_image(self.imgs.button_press)
|
||||
.label(&self.voxygen_i18n.get("common.servers"))
|
||||
.label(&self.i18n.get("common.servers"))
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(self.fonts.cyri.scale(16))
|
||||
@ -1079,8 +1097,10 @@ impl<'a> MainMenuUi {
|
||||
pub fn maintain(&mut self, global_state: &mut GlobalState, dt: Duration) -> Vec<Event> {
|
||||
let events = self.update_layout(global_state, dt);
|
||||
self.ui.maintain(global_state.window.renderer_mut(), None);
|
||||
self.ice_ui
|
||||
.maintain(self.ice_state.view(), global_state.window.renderer_mut());
|
||||
self.ice_ui.maintain(
|
||||
self.ice_state.view(&self.i18n),
|
||||
global_state.window.renderer_mut(),
|
||||
);
|
||||
events
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ use crate::{
|
||||
audio::sfx::{SfxEvent, SfxEventItem},
|
||||
ecs::MyEntity,
|
||||
hud::{DebugInfo, Event as HudEvent, Hud, HudInfo, PressBehavior},
|
||||
i18n::{i18n_asset_key, VoxygenLocalization},
|
||||
i18n::{i18n_asset_key, Localization},
|
||||
key_state::KeyState,
|
||||
menu::char_selection::CharSelectionState,
|
||||
render::Renderer,
|
||||
@ -46,7 +46,7 @@ pub struct SessionState {
|
||||
key_state: KeyState,
|
||||
inputs: comp::ControllerInputs,
|
||||
selected_block: Block,
|
||||
voxygen_i18n: std::sync::Arc<VoxygenLocalization>,
|
||||
i18n: std::sync::Arc<Localization>,
|
||||
walk_forward_dir: Vec2<f32>,
|
||||
walk_right_dir: Vec2<f32>,
|
||||
freefly_vel: Vec3<f32>,
|
||||
@ -72,7 +72,7 @@ impl SessionState {
|
||||
.camera_mut()
|
||||
.set_fov_deg(global_state.settings.graphics.fov);
|
||||
let hud = Hud::new(global_state, &client.borrow());
|
||||
let voxygen_i18n = VoxygenLocalization::load_expect(&i18n_asset_key(
|
||||
let i18n = Localization::load_expect(&i18n_asset_key(
|
||||
&global_state.settings.language.selected_language,
|
||||
));
|
||||
|
||||
@ -86,7 +86,7 @@ impl SessionState {
|
||||
inputs: comp::ControllerInputs::default(),
|
||||
hud,
|
||||
selected_block: Block::new(BlockKind::Misc, Rgb::broadcast(255)),
|
||||
voxygen_i18n,
|
||||
i18n,
|
||||
walk_forward_dir,
|
||||
walk_right_dir,
|
||||
freefly_vel: Vec3::zero(),
|
||||
@ -131,14 +131,14 @@ impl SessionState {
|
||||
match inv_event {
|
||||
InventoryUpdateEvent::CollectFailed => {
|
||||
self.hud.new_message(ChatMsg {
|
||||
message: self.voxygen_i18n.get("hud.chat.loot_fail").to_string(),
|
||||
message: self.i18n.get("hud.chat.loot_fail").to_string(),
|
||||
chat_type: ChatType::CommandError,
|
||||
});
|
||||
},
|
||||
InventoryUpdateEvent::Collected(item) => {
|
||||
self.hud.new_message(ChatMsg {
|
||||
message: self
|
||||
.voxygen_i18n
|
||||
.i18n
|
||||
.get("hud.chat.loot_msg")
|
||||
.replace("{item}", item.name()),
|
||||
chat_type: ChatType::Loot,
|
||||
@ -150,9 +150,9 @@ impl SessionState {
|
||||
client::Event::Disconnect => return Ok(TickAction::Disconnect),
|
||||
client::Event::DisconnectionNotification(time) => {
|
||||
let message = match time {
|
||||
0 => String::from(self.voxygen_i18n.get("hud.chat.goodbye")),
|
||||
0 => String::from(self.i18n.get("hud.chat.goodbye")),
|
||||
_ => self
|
||||
.voxygen_i18n
|
||||
.i18n
|
||||
.get("hud.chat.connection_lost")
|
||||
.replace("{time}", time.to_string().as_str()),
|
||||
};
|
||||
@ -165,7 +165,7 @@ impl SessionState {
|
||||
client::Event::Kicked(reason) => {
|
||||
global_state.info_message = Some(format!(
|
||||
"{}: {}",
|
||||
self.voxygen_i18n.get("main.login.kicked").to_string(),
|
||||
self.i18n.get("main.login.kicked").to_string(),
|
||||
reason
|
||||
));
|
||||
return Ok(TickAction::Disconnect);
|
||||
@ -207,7 +207,7 @@ impl PlayState for SessionState {
|
||||
span!(_guard, "tick", "<Session as PlayState>::tick");
|
||||
// TODO: let mut client = self.client.borrow_mut();
|
||||
// NOTE: Not strictly necessary, but useful for hotloading translation changes.
|
||||
self.voxygen_i18n = VoxygenLocalization::load_expect(&i18n_asset_key(
|
||||
self.i18n = Localization::load_expect(&i18n_asset_key(
|
||||
&global_state.settings.language.selected_language,
|
||||
));
|
||||
|
||||
@ -673,7 +673,7 @@ impl PlayState for SessionState {
|
||||
Ok(TickAction::Disconnect) => return PlayStateResult::Pop, // Go to main menu
|
||||
Err(err) => {
|
||||
global_state.info_message =
|
||||
Some(self.voxygen_i18n.get("common.connection_lost").to_owned());
|
||||
Some(self.i18n.get("common.connection_lost").to_owned());
|
||||
error!("[session] Failed to tick the scene: {:?}", err);
|
||||
|
||||
return PlayStateResult::Pop;
|
||||
@ -752,7 +752,7 @@ impl PlayState for SessionState {
|
||||
// Look for changes in the localization files
|
||||
if global_state.localization_watcher.reloaded() {
|
||||
hud_events.push(HudEvent::ChangeLanguage(Box::new(
|
||||
self.voxygen_i18n.metadata.clone(),
|
||||
self.i18n.metadata.clone(),
|
||||
)));
|
||||
}
|
||||
|
||||
@ -980,13 +980,13 @@ impl PlayState for SessionState {
|
||||
HudEvent::ChangeLanguage(new_language) => {
|
||||
global_state.settings.language.selected_language =
|
||||
new_language.language_identifier;
|
||||
self.voxygen_i18n = VoxygenLocalization::load_watched(
|
||||
self.i18n = Localization::load_watched(
|
||||
&i18n_asset_key(&global_state.settings.language.selected_language),
|
||||
&mut global_state.localization_watcher,
|
||||
)
|
||||
.unwrap();
|
||||
self.voxygen_i18n.log_missing_entries();
|
||||
self.hud.update_language(Arc::clone(&self.voxygen_i18n));
|
||||
self.i18n.log_missing_entries();
|
||||
self.hud.update_language(Arc::clone(&self.i18n));
|
||||
},
|
||||
HudEvent::ChangeFullscreenMode(new_fullscreen_settings) => {
|
||||
global_state
|
||||
|
@ -1,14 +1,14 @@
|
||||
use crate::i18n::{Font, VoxygenFonts};
|
||||
use crate::i18n;
|
||||
use common::assets::Asset;
|
||||
|
||||
pub struct ConrodVoxygenFont {
|
||||
metadata: Font,
|
||||
pub struct Font {
|
||||
metadata: i18n::Font,
|
||||
pub conrod_id: conrod_core::text::font::Id,
|
||||
}
|
||||
|
||||
impl ConrodVoxygenFont {
|
||||
impl Font {
|
||||
#[allow(clippy::needless_return)] // TODO: Pending review in #587
|
||||
pub fn new(font: &Font, ui: &mut crate::ui::Ui) -> ConrodVoxygenFont {
|
||||
pub fn new(font: &i18n::Font, ui: &mut crate::ui::Ui) -> Font {
|
||||
return Self {
|
||||
metadata: font.clone(),
|
||||
conrod_id: ui.new_font(crate::ui::Font::load_expect(&font.asset_key)),
|
||||
@ -22,14 +22,14 @@ impl ConrodVoxygenFont {
|
||||
macro_rules! conrod_fonts {
|
||||
($([ $( $name:ident$(,)? )* ])*) => {
|
||||
$(
|
||||
pub struct ConrodVoxygenFonts {
|
||||
$(pub $name: ConrodVoxygenFont,)*
|
||||
pub struct Fonts {
|
||||
$(pub $name: Font,)*
|
||||
}
|
||||
|
||||
impl ConrodVoxygenFonts {
|
||||
pub fn load(voxygen_fonts: &VoxygenFonts, ui: &mut crate::ui::Ui) -> Result<Self, common::assets::Error> {
|
||||
impl Fonts {
|
||||
pub fn load(fonts: &i18n::Fonts, ui: &mut crate::ui::Ui) -> Result<Self, common::assets::Error> {
|
||||
Ok(Self {
|
||||
$( $name: ConrodVoxygenFont::new(voxygen_fonts.get(stringify!($name)).unwrap(), ui),)*
|
||||
$( $name: Font::new(fonts.get(stringify!($name)).unwrap(), ui),)*
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user