mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Remake price-tips internationalization
This commit is contained in:
parent
a00a92def1
commit
76cd36b179
@ -16,9 +16,14 @@ hud-trade-invite_sent = Trade request sent to { $playername }.
|
|||||||
hud-trade-result-completed = Trade completed successfully.
|
hud-trade-result-completed = Trade completed successfully.
|
||||||
hud-trade-result-declined = Trade declined.
|
hud-trade-result-declined = Trade declined.
|
||||||
hud-trade-result-nospace = Not enough space to complete the trade.
|
hud-trade-result-nospace = Not enough space to complete the trade.
|
||||||
hud-trade-buy_price = Buy Price
|
hud-trade-buy = Buy Price: { $coin_num ->
|
||||||
hud-trade-sell_price = Sell Price
|
[one] one coin
|
||||||
hud-trade-coin = coin(s)
|
*[other] { $coin_formatted } coins
|
||||||
|
}
|
||||||
|
hud-trade-sell = Sell Price: { $coin_num ->
|
||||||
|
[one] one coin.
|
||||||
|
*[other] { $coin_formatted } coins
|
||||||
|
}
|
||||||
hud-trade-tooltip_hint_1 = <Shift-Click to Add/Remove from trade.>
|
hud-trade-tooltip_hint_1 = <Shift-Click to Add/Remove from trade.>
|
||||||
hud-trade-tooltip_hint_2 = <Ctrl-Click to Auto-Balance with this.>
|
hud-trade-tooltip_hint_2 = <Ctrl-Click to Auto-Balance with this.>
|
||||||
hud-trade-your_offer = Your offer
|
hud-trade-your_offer = Your offer
|
||||||
|
@ -13,14 +13,14 @@ use common::{
|
|||||||
trade::{Good, SitePrices},
|
trade::{Good, SitePrices},
|
||||||
};
|
};
|
||||||
use conrod_core::image;
|
use conrod_core::image;
|
||||||
use i18n::Localization;
|
use i18n::{fluent_args, Localization};
|
||||||
use std::{borrow::Cow, fmt::Write};
|
use std::{borrow::Cow, fmt::Write};
|
||||||
|
|
||||||
pub fn price_desc(
|
pub fn price_desc<'a>(
|
||||||
prices: &Option<SitePrices>,
|
prices: &Option<SitePrices>,
|
||||||
item_definition_id: ItemDefinitionId<'_>,
|
item_definition_id: ItemDefinitionId<'_>,
|
||||||
i18n: &Localization,
|
i18n: &'a Localization,
|
||||||
) -> Option<(String, String, f32)> {
|
) -> Option<(Cow<'a, str>, Cow<'a, str>, f32)> {
|
||||||
if let Some(prices) = prices {
|
if let Some(prices) = prices {
|
||||||
if let Some(materials) = TradePricing::get_materials(&item_definition_id) {
|
if let Some(materials) = TradePricing::get_materials(&item_definition_id) {
|
||||||
let coinprice = prices.values.get(&Good::Coin).cloned().unwrap_or(1.0);
|
let coinprice = prices.values.get(&Good::Coin).cloned().unwrap_or(1.0);
|
||||||
@ -42,18 +42,16 @@ pub fn price_desc(
|
|||||||
/ prices.values.get(&Good::Coin).cloned().unwrap_or(1.0)
|
/ prices.values.get(&Good::Coin).cloned().unwrap_or(1.0)
|
||||||
/ (materials.len() as f32);
|
/ (materials.len() as f32);
|
||||||
let deal_goodness = deal_goodness.log(2.0);
|
let deal_goodness = deal_goodness.log(2.0);
|
||||||
let buy_string = format!(
|
|
||||||
"{} : {:0.1} {}",
|
let buy_string = i18n.get_msg_ctx("hud-trade-buy", &fluent_args! {
|
||||||
i18n.get_msg("hud-trade-buy_price"),
|
"coin_num" => buyprice / coinprice,
|
||||||
buyprice / coinprice,
|
"coin_formatted" => format!("{:0.1}", buyprice / coinprice),
|
||||||
i18n.get_msg("hud-trade-coin"),
|
});
|
||||||
);
|
let sell_string = i18n.get_msg_ctx("hud-trade-sell", &fluent_args! {
|
||||||
let sell_string = format!(
|
"coin_num" => sellprice / coinprice,
|
||||||
"{} : {:0.1} {}",
|
"coin_formatted" => format!("{:0.1}", sellprice / coinprice),
|
||||||
i18n.get_msg("hud-trade-sell_price"),
|
});
|
||||||
sellprice / coinprice,
|
|
||||||
i18n.get_msg("hud-trade-coin"),
|
|
||||||
);
|
|
||||||
let deal_goodness = match deal_goodness {
|
let deal_goodness = match deal_goodness {
|
||||||
x if x < -2.5 => 0.0,
|
x if x < -2.5 => 0.0,
|
||||||
x if x < -1.05 => 0.25,
|
x if x < -1.05 => 0.25,
|
||||||
|
Loading…
Reference in New Issue
Block a user