mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'coffee-compiler/localize_pseudo_recipes' into 'master'
Localize pseudo recipes See merge request veloren/veloren!4537
This commit is contained in:
commit
f06440b2c3
@ -87,4 +87,30 @@ recipe-weapons-frostwood = Frostwood Weapon Recipes
|
|||||||
recipe-weapons-eldwood = Eldwood Weapon Recipes
|
recipe-weapons-eldwood = Eldwood Weapon Recipes
|
||||||
.desc = Eldwood Weapon Recipes
|
.desc = Eldwood Weapon Recipes
|
||||||
recipe-default = Default Recipes
|
recipe-default = Default Recipes
|
||||||
.desc = Default Recipes
|
.desc = Default Recipes
|
||||||
|
|
||||||
|
## Pseudo
|
||||||
|
|
||||||
|
pseudo-recipe-modular_weapon-modular_weapon = Modular Weapon
|
||||||
|
.desc = {""}
|
||||||
|
|
||||||
|
pseudo-recipe-modular_weapon-sword = Sword Blade
|
||||||
|
.desc = {""}
|
||||||
|
|
||||||
|
pseudo-recipe-modular_weapon-axe = Axe Head
|
||||||
|
.desc = {""}
|
||||||
|
|
||||||
|
pseudo-recipe-modular_weapon-hammer = Hammer Head
|
||||||
|
.desc = {""}
|
||||||
|
|
||||||
|
pseudo-recipe-modular_weapon-bow = Bow Limbs
|
||||||
|
.desc = {""}
|
||||||
|
|
||||||
|
pseudo-recipe-modular_weapon-staff = Staff Shaft
|
||||||
|
.desc = {""}
|
||||||
|
|
||||||
|
pseudo-recipe-modular_weapon-sceptre = Sceptre Shaft
|
||||||
|
.desc = {""}
|
||||||
|
|
||||||
|
pseudo-recipe-repair = Repair Equipment
|
||||||
|
.desc = {""}
|
@ -556,43 +556,90 @@ impl<'a> Widget for Crafting<'a> {
|
|||||||
let wood_comp_recipe = make_pseudo_recipe(SpriteKind::CraftingBench);
|
let wood_comp_recipe = make_pseudo_recipe(SpriteKind::CraftingBench);
|
||||||
let repair_recipe = make_pseudo_recipe(SpriteKind::RepairBench);
|
let repair_recipe = make_pseudo_recipe(SpriteKind::RepairBench);
|
||||||
|
|
||||||
// TODO: localize
|
// A BTreeMap is used over a HashMap as when a HashMap is used, the UI shuffles
|
||||||
|
// the positions of these every tick, so a BTreeMap is necessary to keep it
|
||||||
|
// ordered.
|
||||||
let pseudo_entries = {
|
let pseudo_entries = {
|
||||||
// A BTreeMap is used over a HashMap as when a HashMap is used, the UI shuffles
|
|
||||||
// the positions of these every tick, so a BTreeMap is necessary to keep it
|
|
||||||
// ordered.
|
|
||||||
let mut pseudo_entries = BTreeMap::new();
|
let mut pseudo_entries = BTreeMap::new();
|
||||||
pseudo_entries.insert(
|
pseudo_entries.insert(
|
||||||
String::from("veloren.core.pseudo_recipe.modular_weapon"),
|
String::from("veloren.core.pseudo_recipe.modular_weapon"),
|
||||||
(&weapon_recipe, "Modular Weapon", CraftingTab::Weapon),
|
(
|
||||||
|
&weapon_recipe,
|
||||||
|
self.localized_strings
|
||||||
|
.get_msg("pseudo-recipe-modular_weapon-modular_weapon")
|
||||||
|
.to_string(),
|
||||||
|
CraftingTab::Weapon,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
pseudo_entries.insert(
|
pseudo_entries.insert(
|
||||||
String::from("veloren.core.pseudo_recipe.modular_weapon_component.sword"),
|
String::from("veloren.core.pseudo_recipe.modular_weapon_component.sword"),
|
||||||
(&metal_comp_recipe, "Sword Blade", CraftingTab::Weapon),
|
(
|
||||||
|
&metal_comp_recipe,
|
||||||
|
self.localized_strings
|
||||||
|
.get_msg("pseudo-recipe-modular_weapon-sword")
|
||||||
|
.to_string(),
|
||||||
|
CraftingTab::Weapon,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
pseudo_entries.insert(
|
pseudo_entries.insert(
|
||||||
String::from("veloren.core.pseudo_recipe.modular_weapon_component.axe"),
|
String::from("veloren.core.pseudo_recipe.modular_weapon_component.axe"),
|
||||||
(&metal_comp_recipe, "Axe Head", CraftingTab::Weapon),
|
(
|
||||||
|
&metal_comp_recipe,
|
||||||
|
self.localized_strings
|
||||||
|
.get_msg("pseudo-recipe-modular_weapon-axe")
|
||||||
|
.to_string(),
|
||||||
|
CraftingTab::Weapon,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
pseudo_entries.insert(
|
pseudo_entries.insert(
|
||||||
String::from("veloren.core.pseudo_recipe.modular_weapon_component.hammer"),
|
String::from("veloren.core.pseudo_recipe.modular_weapon_component.hammer"),
|
||||||
(&metal_comp_recipe, "Hammer Head", CraftingTab::Weapon),
|
(
|
||||||
|
&metal_comp_recipe,
|
||||||
|
self.localized_strings
|
||||||
|
.get_msg("pseudo-recipe-modular_weapon-hammer")
|
||||||
|
.to_string(),
|
||||||
|
CraftingTab::Weapon,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
pseudo_entries.insert(
|
pseudo_entries.insert(
|
||||||
String::from("veloren.core.pseudo_recipe.modular_weapon_component.bow"),
|
String::from("veloren.core.pseudo_recipe.modular_weapon_component.bow"),
|
||||||
(&wood_comp_recipe, "Bow Limbs", CraftingTab::Weapon),
|
(
|
||||||
|
&wood_comp_recipe,
|
||||||
|
self.localized_strings
|
||||||
|
.get_msg("pseudo-recipe-modular_weapon-bow")
|
||||||
|
.to_string(),
|
||||||
|
CraftingTab::Weapon,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
pseudo_entries.insert(
|
pseudo_entries.insert(
|
||||||
String::from("veloren.core.pseudo_recipe.modular_weapon_component.staff"),
|
String::from("veloren.core.pseudo_recipe.modular_weapon_component.staff"),
|
||||||
(&wood_comp_recipe, "Staff Shaft", CraftingTab::Weapon),
|
(
|
||||||
|
&wood_comp_recipe,
|
||||||
|
self.localized_strings
|
||||||
|
.get_msg("pseudo-recipe-modular_weapon-staff")
|
||||||
|
.to_string(),
|
||||||
|
CraftingTab::Weapon,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
pseudo_entries.insert(
|
pseudo_entries.insert(
|
||||||
String::from("veloren.core.pseudo_recipe.modular_weapon_component.sceptre"),
|
String::from("veloren.core.pseudo_recipe.modular_weapon_component.sceptre"),
|
||||||
(&wood_comp_recipe, "Sceptre Shaft", CraftingTab::Weapon),
|
(
|
||||||
|
&wood_comp_recipe,
|
||||||
|
self.localized_strings
|
||||||
|
.get_msg("pseudo-recipe-modular_weapon-sceptre")
|
||||||
|
.to_string(),
|
||||||
|
CraftingTab::Weapon,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
pseudo_entries.insert(
|
pseudo_entries.insert(
|
||||||
String::from("veloren.core.pseudo_recipe.repair"),
|
String::from("veloren.core.pseudo_recipe.repair"),
|
||||||
(&repair_recipe, "Repair Equipment", CraftingTab::All),
|
(
|
||||||
|
&repair_recipe,
|
||||||
|
self.localized_strings
|
||||||
|
.get_msg("pseudo-recipe-repair")
|
||||||
|
.to_string(),
|
||||||
|
CraftingTab::All,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
pseudo_entries
|
pseudo_entries
|
||||||
};
|
};
|
||||||
@ -760,7 +807,7 @@ impl<'a> Widget for Crafting<'a> {
|
|||||||
let title;
|
let title;
|
||||||
let recipe_name =
|
let recipe_name =
|
||||||
if let Some((_recipe, pseudo_name, _filter_tab)) = pseudo_entries.get(name) {
|
if let Some((_recipe, pseudo_name, _filter_tab)) = pseudo_entries.get(name) {
|
||||||
*pseudo_name
|
pseudo_name
|
||||||
} else {
|
} else {
|
||||||
(title, _) = util::item_text(
|
(title, _) = util::item_text(
|
||||||
recipe.output.0.as_ref(),
|
recipe.output.0.as_ref(),
|
||||||
@ -888,7 +935,7 @@ impl<'a> Widget for Crafting<'a> {
|
|||||||
let title = if let Some((_recipe, pseudo_name, _filter_tab)) =
|
let title = if let Some((_recipe, pseudo_name, _filter_tab)) =
|
||||||
pseudo_entries.get(&recipe_name)
|
pseudo_entries.get(&recipe_name)
|
||||||
{
|
{
|
||||||
*pseudo_name
|
pseudo_name
|
||||||
} else {
|
} else {
|
||||||
(title, _) = util::item_text(
|
(title, _) = util::item_text(
|
||||||
recipe.output.0.as_ref(),
|
recipe.output.0.as_ref(),
|
||||||
|
Loading…
Reference in New Issue
Block a user