Merge branch 'coffee-compiler/diary_section_localization' into 'master'

Localize diary section and skill tree titles

See merge request veloren/veloren!4532
This commit is contained in:
Marcel 2024-07-28 20:53:59 +00:00
commit 0669f5d8e6
3 changed files with 60 additions and 25 deletions

View File

@ -0,0 +1,8 @@
## General diary terms
## Section titles
hud-diary-sections-skill_trees-title = Skill-Trees
hud-diary-sections-abilities-title = Abilities
hud-diary-sections-stats-title = Stats
hud-diary-sections-recipes-title = Recipes

View File

@ -7,6 +7,16 @@
-hud-skill-st_shockwave_title = "" -hud-skill-st_shockwave_title = ""
## Skill tree UI ## Skill tree UI
hud-skill_tree-general = General Combat
hud-skill_tree-sword = Sword
hud-skill_tree-axe = Axe
hud-skill_tree-hammer = Hammer
hud-skill_tree-bow = Bow
hud-skill_tree-staff = Fire Staff
hud-skill_tree-sceptre = Sceptre
hud-skill_tree-mining = Mining
hud-rank_up = New skill point hud-rank_up = New skill point
hud-skill-sp_available = hud-skill-sp_available =
{ $number -> { $number ->

View File

@ -445,22 +445,24 @@ impl<'a> Widget for Diary<'a> {
continue; continue;
}, },
}; };
// Section Icons
let section_desc = match section_name { let section_name_key = match section {
"Abilities" => "List of your currently available abilities.", DiarySection::SkillTrees => "hud-diary-sections-skill_trees-title",
"Skill-Trees" => "", DiarySection::AbilitySelection => "hud-diary-sections-abilities-title",
"Stats" => "", DiarySection::Stats => "hud-diary-sections-stats-title",
"Recipes" => "", DiarySection::Recipes => "hud-diary-sections-recipes-title",
_ => "",
}; };
let section_name = self.localized_strings.get_msg(section_name_key);
let btn_img = { let btn_img = {
let img = match section_name { let img = match section {
"Abilities" => self.imgs.spellbook_ico, DiarySection::AbilitySelection => self.imgs.spellbook_ico,
"Skill-Trees" => self.imgs.skilltree_ico, DiarySection::SkillTrees => self.imgs.skilltree_ico,
"Stats" => self.imgs.stats_ico, DiarySection::Stats => self.imgs.stats_ico,
"Recipes" => self.imgs.crafting_icon, DiarySection::Recipes => self.imgs.crafting_icon,
_ => self.imgs.nothing,
}; };
if i == 0 { if i == 0 {
Image::new(img).top_left_with_margins_on(state.ids.content_align, 0.0, -50.0) Image::new(img).top_left_with_margins_on(state.ids.content_align, 0.0, -50.0)
} else { } else {
@ -493,8 +495,8 @@ impl<'a> Widget for Diary<'a> {
.middle_of(state.ids.section_imgs[i]) .middle_of(state.ids.section_imgs[i])
.with_tooltip( .with_tooltip(
self.tooltip_manager, self.tooltip_manager,
section_name, &section_name,
section_desc, "",
&diary_tooltip, &diary_tooltip,
TEXT_COLOR, TEXT_COLOR,
) )
@ -535,20 +537,34 @@ impl<'a> Widget for Diary<'a> {
}, },
}; };
let skilltree_name_key = match skill_group {
SkillGroupKind::General => "hud-skill_tree-general",
SkillGroupKind::Weapon(ToolKind::Sword) => "hud-skill_tree-sword",
SkillGroupKind::Weapon(ToolKind::Axe) => "hud-skill_tree-axe",
SkillGroupKind::Weapon(ToolKind::Hammer) => "hud-skill_tree-hammer",
SkillGroupKind::Weapon(ToolKind::Bow) => "hud-skill_tree-bow",
SkillGroupKind::Weapon(ToolKind::Staff) => "hud-skill_tree-staff",
SkillGroupKind::Weapon(ToolKind::Sceptre) => "hud-skill_tree-sceptre",
SkillGroupKind::Weapon(ToolKind::Pick) => "hud-skill_tree-mining",
_ => "",
};
let skilltree_name = self.localized_strings.get_msg(skilltree_name_key);
// Check if we have this skill tree unlocked // Check if we have this skill tree unlocked
let locked = !self.skill_set.skill_group_accessible(skill_group); let locked = !self.skill_set.skill_group_accessible(skill_group);
// Weapon button image // Weapon button image
let btn_img = { let btn_img = {
let img = match skilltree_name { let img = match skill_group {
"General Combat" => self.imgs.swords_crossed, SkillGroupKind::General => self.imgs.swords_crossed,
"Sword" => self.imgs.sword, SkillGroupKind::Weapon(ToolKind::Sword) => self.imgs.sword,
"Axe" => self.imgs.axe, SkillGroupKind::Weapon(ToolKind::Axe) => self.imgs.axe,
"Hammer" => self.imgs.hammer, SkillGroupKind::Weapon(ToolKind::Hammer) => self.imgs.hammer,
"Bow" => self.imgs.bow, SkillGroupKind::Weapon(ToolKind::Bow) => self.imgs.bow,
"Fire Staff" => self.imgs.staff, SkillGroupKind::Weapon(ToolKind::Staff) => self.imgs.staff,
"Sceptre" => self.imgs.sceptre, SkillGroupKind::Weapon(ToolKind::Sceptre) => self.imgs.sceptre,
"Mining" => self.imgs.mining, SkillGroupKind::Weapon(ToolKind::Pick) => self.imgs.mining,
_ => self.imgs.nothing, _ => self.imgs.nothing,
}; };
@ -577,6 +593,7 @@ impl<'a> Widget for Diary<'a> {
// Weapon icons // Weapon icons
let have_points = { let have_points = {
let available = self.skill_set.available_sp(skill_group); let available = self.skill_set.available_sp(skill_group);
let earned = self.skill_set.earned_sp(skill_group); let earned = self.skill_set.earned_sp(skill_group);
let total_cost = skill_group.total_skill_point_cost(); let total_cost = skill_group.total_skill_point_cost();
@ -621,7 +638,7 @@ impl<'a> Widget for Diary<'a> {
.image_color(color) .image_color(color)
.with_tooltip( .with_tooltip(
self.tooltip_manager, self.tooltip_manager,
skilltree_name, &skilltree_name,
&tooltip_txt, &tooltip_txt,
&diary_tooltip, &diary_tooltip,
TEXT_COLOR, TEXT_COLOR,