Fix #1806: Localize PromptDialog

This commit is contained in:
Sylv 2024-05-24 17:18:41 +00:00 committed by Marcel
parent 372c43e538
commit c9141f4c6b
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 - Loot protection for solo players and NPCs works again
- New cultist dungeons are less overly abundant, sahagin dungeons spawn 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. - 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 ## [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_category = Sort by Category
hud-bag-sort_by_tag = Sort by Tag hud-bag-sort_by_tag = Sort by Tag
hud-bag-sort_by_quantity = Sort by Quantity 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_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_title = Pickaxe Strike Gem Yield
hud-skill-pick_strike_gemgain = Chance to gain extra gems ({ $boost } % per level).{ $SP } 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, loot_owner::LootOwnerKind,
pet::is_mountable, pet::is_mountable,
skillset::{skills::Skill, SkillGroupKind, SkillsPersistenceError}, skillset::{skills::Skill, SkillGroupKind, SkillsPersistenceError},
BuffData, BuffKind, Health, Item, MapMarkerChange, PickupItem, PresenceKind, BuffData, BuffKind, Content, Health, Item, MapMarkerChange, PickupItem, PresenceKind,
}, },
consts::MAX_PICKUP_RANGE, consts::MAX_PICKUP_RANGE,
link::Is, link::Is,
@ -1515,26 +1515,30 @@ impl Hud {
if let Some(persistence_error) = info.persistence_load_error { if let Some(persistence_error) = info.persistence_load_error {
let persistence_error = match persistence_error { let persistence_error = match persistence_error {
SkillsPersistenceError::HashMismatch => { SkillsPersistenceError::HashMismatch => {
"There was a difference detected in one of your skill groups since you \ "hud-skill-persistence-hash_mismatch"
last played."
}, },
SkillsPersistenceError::DeserializationFailure => { SkillsPersistenceError::DeserializationFailure => {
"There was a error in loading some of your skills from the database." "hud-skill-persistence-deserialization_failure"
}, },
SkillsPersistenceError::SpentExpMismatch => { SkillsPersistenceError::SpentExpMismatch => {
"The amount of free experience you had in one of your skill groups \ "hud-skill-persistence-spent_experience_missing"
differed from when you last played."
}, },
SkillsPersistenceError::SkillsUnlockFailed => { SkillsPersistenceError::SkillsUnlockFailed => {
"Your skills were not able to be obtained in the same order you \ "hud-skill-persistence-skills_unlock_failed"
acquired them. Prerequisites or costs may have changed."
}, },
}; };
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 \ let common_message = global_state
need to reassign them."; .i18n
.read()
.get_content(&Content::localized("hud-skill-persistence-common_message"));
warn!("{}\n{}", persistence_error, common_message); warn!("{}\n{}", persistence_error, common_message);
// TODO: Let the player see the more detailed message `persistence_error`?
let prompt_dialog = PromptDialogSettings::new( let prompt_dialog = PromptDialogSettings::new(
format!("{}\n", common_message), format!("{}\n", common_message),
Event::AcknowledgePersistenceLoadError, Event::AcknowledgePersistenceLoadError,

View File

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