diff --git a/assets/voxygen/i18n/en/hud/group.ftl b/assets/voxygen/i18n/en/hud/group.ftl index b91e9e0f1f..31dcb65e45 100644 --- a/assets/voxygen/i18n/en/hud/group.ftl +++ b/assets/voxygen/i18n/en/hud/group.ftl @@ -1,6 +1,11 @@ hud-group = Group + hud-group-invite_to_join = [{ $name }] invited you to their group! hud-group-invite_to_trade = [{ $name }] would like to trade with you. +hug-group-invite-accepted = { $target } accepted your group invite. +hud-group-invite-declined = { $target } declined your group invite. +hud-group-invite-timed_out= Group invite to { $target } timed out. + hud-group-invite = Invite hud-group-kick = Kick hud-group-assign_leader = Assign Leader diff --git a/assets/voxygen/i18n/en/hud/trade.ftl b/assets/voxygen/i18n/en/hud/trade.ftl index 7ff75ae8b6..81d2d69c68 100644 --- a/assets/voxygen/i18n/en/hud/trade.ftl +++ b/assets/voxygen/i18n/en/hud/trade.ftl @@ -12,7 +12,12 @@ hud-trade-has_accepted = has accepted hud-trade-accept = Accept hud-trade-decline = Decline + hud-trade-invite_sent = Trade request sent to { $playername }. +hud-trade-invite-accepted = { $target } accepted your trade request. +hud-trade-invite-declined = { $target } declined your trade request. +hud-trade-invite-timed_out = Trade request to { $target } timed out. + hud-trade-result-completed = Trade completed successfully. hud-trade-result-declined = Trade declined. hud-trade-result-nospace = Not enough space to complete the trade. diff --git a/voxygen/src/session/mod.rs b/voxygen/src/session/mod.rs index 0cef377265..9697f03575 100644 --- a/voxygen/src/session/mod.rs +++ b/voxygen/src/session/mod.rs @@ -302,12 +302,6 @@ impl SessionState { answer, kind, } => { - // TODO: i18n (complicated since substituting phrases at this granularity may - // not be grammatical in some languages) - let kind_str = match kind { - InviteKind::Group => "Group", - InviteKind::Trade => "Trade", - }; let target_name = match client.player_list().get(&target) { Some(info) => info.player_alias.clone(), None => match client.state().ecs().entity_from_uid(target) { @@ -320,13 +314,21 @@ impl SessionState { None => format!("", target), }, }; - let answer_str = match answer { - InviteAnswer::Accepted => "accepted", - InviteAnswer::Declined => "declined", - InviteAnswer::TimedOut => "timed out", + + let msg_key = match (kind, answer) { + (InviteKind::Group, InviteAnswer::Accepted) => "hud-group-invite-accepted", + (InviteKind::Group, InviteAnswer::Declined) => "hud-group-invite-declined", + (InviteKind::Group, InviteAnswer::TimedOut) => "hud-group-invite-timed_out", + (InviteKind::Trade, InviteAnswer::Accepted) => "hud-trade-invite-accepted", + (InviteKind::Trade, InviteAnswer::Declined) => "hud-trade-invite-declined", + (InviteKind::Trade, InviteAnswer::TimedOut) => "hud-trade-invite-timed_out", }; - let msg = format!("{} invite to {} {}", kind_str, target_name, answer_str); - // TODO: Localise + + let msg = global_state + .i18n + .read() + .get_msg_ctx(msg_key, &i18n::fluent_args! { "target" => target_name }); + self.hud.new_message(ChatType::Meta.into_plain_msg(msg)); }, client::Event::TradeComplete { result, trade: _ } => {