Merge branch 'sylv256/prompt-i18n' into 'master'

Fix #1806: Localize PromptDialog

Closes #1806

See merge request veloren/veloren!4464
This commit is contained in:
Marcel 2024-05-24 17:18:41 +00:00
commit 88b9643b11
5 changed files with 86 additions and 48 deletions

View File

@ -44,6 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Loot protection for solo players and NPCs works again
- New cultist dungeons are less overly abundant, sahagin dungeons spawn again.
- Cultist dungeons now always have exactly one portal which leads to the boss room.
- Prompt dialogs are now localized.
## [0.16.0] - 2024-03-30

View File

@ -41,3 +41,19 @@ hud-bag-sort_by_quality = Sort by Quality
hud-bag-sort_by_category = Sort by Category
hud-bag-sort_by_tag = Sort by Tag
hud-bag-sort_by_quantity = Sort by Quantity
hud-bag-use_slot_equip_drop_items = { $slot_deficit ->
[1] Equipping this item will result in insufficient inventory space to hold the items in your inventory and 1 item will drop on the floor. Do you wish to continue?
*[other] Equipping this item will result in insufficient inventory space to hold the items in your inventory and { $slot_deficit } items will drop on the floor. Do you wish to continue?
}
hud-bag-use_slot_unequip_drop_items = { $slot_deficit ->
[1] Unequipping this item will result in insufficient inventory space to hold the items in your inventory and 1 item will drop on the floor. Do you wish to continue?
*[other] Unequipping this item will result in insufficient inventory space to hold the items in your inventory and { $slot_deficit } items will drop on the floor. Do you wish to continue?
}
hud-bag-swap_slots_drop_items = { $slot_deficit ->
[1] This will result in dropping 1 item on the ground. Are you sure?
*[other] This will result in dropping { $slot_deficit } items on the ground. Are you sure?
}
hud-bag-split_swap_slots_drop_items = { $slot_deficit ->
[1] This will result in dropping 1 item on the ground. Are you sure?
*[other] This will result in dropping { $slot_deficit } items on the ground. Are you sure?
}

View File

@ -139,3 +139,10 @@ hud-skill-pick_strike_oregain_title = Pickaxe Strike Ore Yield
hud-skill-pick_strike_oregain = Chance to gain extra ore ({ $boost } % per level).{ $SP }
hud-skill-pick_strike_gemgain_title = Pickaxe Strike Gem Yield
hud-skill-pick_strike_gemgain = Chance to gain extra gems ({ $boost } % per level).{ $SP }
## Skill tree error dialog
hud-skill-persistence-hash_mismatch = There was a difference detected in one of your skill groups since you last played.
hud-skill-persistence-deserialization_failure = There was a error in loading some of your skills from the database.
hud-skill-persistence-spent_experience_missing = The amount of free experience you had in one of your skill groups differed from when you last played.
hud-skill-persistence-skills_unlock_failed = Your skills were not able to be obtained in the same order you acquired them. Prerequisites or costs may have changed.
hud-skill-persistence-common_message = Some of your skill points have been reset. You will need to reassign them.

View File

@ -103,7 +103,7 @@ use common::{
loot_owner::LootOwnerKind,
pet::is_mountable,
skillset::{skills::Skill, SkillGroupKind, SkillsPersistenceError},
BuffData, BuffKind, Health, Item, MapMarkerChange, PickupItem, PresenceKind,
BuffData, BuffKind, Content, Health, Item, MapMarkerChange, PickupItem, PresenceKind,
},
consts::MAX_PICKUP_RANGE,
link::Is,
@ -1515,26 +1515,30 @@ impl Hud {
if let Some(persistence_error) = info.persistence_load_error {
let persistence_error = match persistence_error {
SkillsPersistenceError::HashMismatch => {
"There was a difference detected in one of your skill groups since you \
last played."
"hud-skill-persistence-hash_mismatch"
},
SkillsPersistenceError::DeserializationFailure => {
"There was a error in loading some of your skills from the database."
"hud-skill-persistence-deserialization_failure"
},
SkillsPersistenceError::SpentExpMismatch => {
"The amount of free experience you had in one of your skill groups \
differed from when you last played."
"hud-skill-persistence-spent_experience_missing"
},
SkillsPersistenceError::SkillsUnlockFailed => {
"Your skills were not able to be obtained in the same order you \
acquired them. Prerequisites or costs may have changed."
"hud-skill-persistence-skills_unlock_failed"
},
};
let persistence_error = global_state
.i18n
.read()
.get_content(&Content::localized(persistence_error));
let common_message = "Some of your skill points have been reset. You will \
need to reassign them.";
let common_message = global_state
.i18n
.read()
.get_content(&Content::localized("hud-skill-persistence-common_message"));
warn!("{}\n{}", persistence_error, common_message);
// TODO: Let the player see the more detailed message `persistence_error`?
let prompt_dialog = PromptDialogSettings::new(
format!("{}\n", common_message),
Event::AcknowledgePersistenceLoadError,

View File

@ -1736,12 +1736,14 @@ impl PlayState for SessionState {
let slot_deficit = inventory.free_after_equip(inv_slot);
if slot_deficit < 0 {
self.hud.set_prompt_dialog(PromptDialogSettings::new(
format!(
"Equipping this item will result in \
insufficient inventory space to hold the \
items in your inventory and {} items will \
drop on the floor. Do you wish to continue?",
slot_deficit.abs()
global_state.i18n.read().get_content(
&Content::localized_with_args(
"hud-bag-use_slot_equip_drop_items",
[(
"slot_deficit",
slot_deficit.unsigned_abs() as u64,
)],
),
),
HudEvent::UseSlot {
slot,
@ -1761,23 +1763,23 @@ impl PlayState for SessionState {
let slot_deficit =
inventory.free_after_unequip(equip_slot);
if slot_deficit < 0 {
self.hud.set_prompt_dialog(
PromptDialogSettings::new(
format!(
"Unequipping this item will result \
in insufficient inventory space to \
hold the items in your inventory and \
{} items will drop on the floor. Do \
you wish to continue?",
slot_deficit.abs()
self.hud
.set_prompt_dialog(PromptDialogSettings::new(
global_state.i18n.read().get_content(
&Content::localized_with_args(
"hud-bag-use_slot_unequip_drop_items",
[(
"slot_deficit",
slot_deficit.unsigned_abs() as u64,
)],
),
HudEvent::UseSlot {
slot,
bypass_dialog: true,
},
None,
),
);
HudEvent::UseSlot {
slot,
bypass_dialog: true,
},
None,
));
move_allowed = false;
}
} else {
@ -1822,10 +1824,15 @@ impl PlayState for SessionState {
if slot_deficit < 0 {
self.hud.set_prompt_dialog(
PromptDialogSettings::new(
format!(
"This will result in dropping {} \
item(s) on the ground. Are you sure?",
slot_deficit.abs()
global_state.i18n.read().get_content(
&Content::localized_with_args(
"hud-bag-swap_slots_drop_items",
[(
"slot_deficit",
slot_deficit.unsigned_abs()
as u64,
)],
),
),
HudEvent::SwapSlots {
slot_a,
@ -1874,21 +1881,24 @@ impl PlayState for SessionState {
let slot_deficit =
inventory.free_after_swap(equip_slot, inv_slot);
if slot_deficit < 0 {
self.hud.set_prompt_dialog(
PromptDialogSettings::new(
format!(
"This will result in dropping {} \
item(s) on the ground. Are you sure?",
slot_deficit.abs()
self.hud
.set_prompt_dialog(PromptDialogSettings::new(
global_state.i18n.read().get_content(
&Content::localized_with_args(
"hud-bag-split_swap_slots_drop_items",
[(
"slot_deficit",
slot_deficit.unsigned_abs() as u64,
)],
),
HudEvent::SwapSlots {
slot_a,
slot_b,
bypass_dialog: true,
},
None,
),
);
HudEvent::SwapSlots {
slot_a,
slot_b,
bypass_dialog: true,
},
None,
));
move_allowed = false;
}
}