mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-04-25 07:07:32 -04:00
chore: update currency
This commit is contained in:
parent
cf05d7da41
commit
f3b899d742
1 changed files with 392 additions and 92 deletions
|
@ -1,18 +1,16 @@
|
||||||
use crate::impl_type_option;
|
use crate::impl_type_option;
|
||||||
|
use crate::services::field::{BoxTypeOptionBuilder, TypeOptionBuilder};
|
||||||
use crate::services::row::{CellDataChangeset, CellDataOperation, TypeOptionCellData};
|
use crate::services::row::{CellDataChangeset, CellDataOperation, TypeOptionCellData};
|
||||||
|
use bytes::Bytes;
|
||||||
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
|
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
|
||||||
use flowy_error::FlowyError;
|
use flowy_error::FlowyError;
|
||||||
use flowy_grid_data_model::entities::{
|
use flowy_grid_data_model::entities::{
|
||||||
CellMeta, FieldMeta, FieldType, TypeOptionDataDeserializer, TypeOptionDataEntry,
|
CellMeta, FieldMeta, FieldType, TypeOptionDataDeserializer, TypeOptionDataEntry,
|
||||||
};
|
};
|
||||||
|
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use rust_decimal::Decimal;
|
use rust_decimal::Decimal;
|
||||||
use rusty_money::iso::*;
|
use rusty_money::define_currency_set;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::services::field::{BoxTypeOptionBuilder, TypeOptionBuilder};
|
|
||||||
use bytes::Bytes;
|
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use strum::IntoEnumIterator;
|
use strum::IntoEnumIterator;
|
||||||
use strum_macros::EnumIter;
|
use strum_macros::EnumIter;
|
||||||
|
@ -87,14 +85,9 @@ impl CellDataOperation for NumberTypeOption {
|
||||||
|
|
||||||
let cell_data = type_option_cell_data.data;
|
let cell_data = type_option_cell_data.data;
|
||||||
match self.format {
|
match self.format {
|
||||||
NumberFormat::Number | NumberFormat::Percent => {
|
NumberFormat::Number => cell_data.parse::<i64>().map_or(String::new(), |v| v.to_string()),
|
||||||
if cell_data.parse::<i64>().is_ok() {
|
NumberFormat::Percent => cell_data.parse::<f64>().map_or(String::new(), |v| v.to_string()),
|
||||||
cell_data
|
_ => self.money_from_str(&cell_data),
|
||||||
} else {
|
|
||||||
String::new()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => self.money_from_str(&cell_data, self.format.currency()),
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String::new()
|
String::new()
|
||||||
|
@ -137,7 +130,7 @@ impl NumberTypeOption {
|
||||||
self.symbol = format.symbol();
|
self.symbol = format.symbol();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn money_from_str(&self, s: &str, currency: &'static Currency) -> String {
|
fn money_from_str(&self, s: &str) -> String {
|
||||||
match Decimal::from_str(s) {
|
match Decimal::from_str(s) {
|
||||||
Ok(mut decimal) => {
|
Ok(mut decimal) => {
|
||||||
match decimal.set_scale(self.scale) {
|
match decimal.set_scale(self.scale) {
|
||||||
|
@ -146,8 +139,9 @@ impl NumberTypeOption {
|
||||||
tracing::error!("Set decimal scale failed: {:?}", e);
|
tracing::error!("Set decimal scale failed: {:?}", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
decimal.set_sign_positive(self.sign_positive);
|
decimal.set_sign_positive(self.sign_positive);
|
||||||
let money = rusty_money::Money::from_decimal(decimal, currency);
|
let money = rusty_money::Money::from_decimal(decimal, self.format.currency());
|
||||||
money.to_string()
|
money.to_string()
|
||||||
}
|
}
|
||||||
Err(_) => String::new(),
|
Err(_) => String::new(),
|
||||||
|
@ -209,86 +203,389 @@ impl std::default::Default for NumberFormat {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
define_currency_set!(
|
||||||
|
number_currency {
|
||||||
|
NUMBER : {
|
||||||
|
code: "",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnEu,
|
||||||
|
minor_units: 1,
|
||||||
|
name: "number",
|
||||||
|
symbol: "RUB",
|
||||||
|
symbol_first: false,
|
||||||
|
},
|
||||||
|
USD : {
|
||||||
|
code: "USD",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnUs,
|
||||||
|
minor_units: 1,
|
||||||
|
name: "United States Dollar",
|
||||||
|
symbol: "$",
|
||||||
|
symbol_first: true,
|
||||||
|
},
|
||||||
|
CANADIAN_DOLLAR : {
|
||||||
|
code: "USD",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnUs,
|
||||||
|
minor_units: 1,
|
||||||
|
name: "Canadian Dollar",
|
||||||
|
symbol: "CA$",
|
||||||
|
symbol_first: true,
|
||||||
|
},
|
||||||
|
NEW_TAIWAN_DOLLAR : {
|
||||||
|
code: "USD",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnUs,
|
||||||
|
minor_units: 1,
|
||||||
|
name: "NewTaiwan Dollar",
|
||||||
|
symbol: "NT$",
|
||||||
|
symbol_first: true,
|
||||||
|
},
|
||||||
|
HONG_KONG_DOLLAR : {
|
||||||
|
code: "USD",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnUs,
|
||||||
|
minor_units: 1,
|
||||||
|
name: "HongKong Dollar",
|
||||||
|
symbol: "HZ$",
|
||||||
|
symbol_first: true,
|
||||||
|
},
|
||||||
|
NEW_ZEALAND_DOLLAR : {
|
||||||
|
code: "USD",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnUs,
|
||||||
|
minor_units: 1,
|
||||||
|
name: "NewZealand Dollar",
|
||||||
|
symbol: "NZ$",
|
||||||
|
symbol_first: true,
|
||||||
|
},
|
||||||
|
EUR : {
|
||||||
|
code: "EUR",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnEu,
|
||||||
|
minor_units: 1,
|
||||||
|
name: "Euro",
|
||||||
|
symbol: "€",
|
||||||
|
symbol_first: true,
|
||||||
|
},
|
||||||
|
GIP : {
|
||||||
|
code: "GIP",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnUs,
|
||||||
|
minor_units: 1,
|
||||||
|
name: "Gibraltar Pound",
|
||||||
|
symbol: "£",
|
||||||
|
symbol_first: true,
|
||||||
|
},
|
||||||
|
CNY : {
|
||||||
|
code: "CNY",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnUs,
|
||||||
|
minor_units: 1,
|
||||||
|
name: "Chinese Renminbi Yuan",
|
||||||
|
symbol: "¥",
|
||||||
|
symbol_first: true,
|
||||||
|
},
|
||||||
|
YUAN : {
|
||||||
|
code: "CNY",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnUs,
|
||||||
|
minor_units: 1,
|
||||||
|
name: "Chinese Renminbi Yuan",
|
||||||
|
symbol: "CN¥",
|
||||||
|
symbol_first: true,
|
||||||
|
},
|
||||||
|
RUB : {
|
||||||
|
code: "RUB",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnEu,
|
||||||
|
minor_units: 1,
|
||||||
|
name: "Russian Ruble",
|
||||||
|
symbol: "RUB",
|
||||||
|
symbol_first: false,
|
||||||
|
},
|
||||||
|
INR : {
|
||||||
|
code: "INR",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnIn,
|
||||||
|
minor_units: 50,
|
||||||
|
name: "Indian Rupee",
|
||||||
|
symbol: "₹",
|
||||||
|
symbol_first: true,
|
||||||
|
},
|
||||||
|
KRW : {
|
||||||
|
code: "KRW",
|
||||||
|
exponent: 0,
|
||||||
|
locale: EnUs,
|
||||||
|
minor_units: 1,
|
||||||
|
name: "South Korean Won",
|
||||||
|
symbol: "₩",
|
||||||
|
symbol_first: true,
|
||||||
|
},
|
||||||
|
BRL : {
|
||||||
|
code: "BRL",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnUs,
|
||||||
|
minor_units: 5,
|
||||||
|
name: "Brazilian real",
|
||||||
|
symbol: "R$",
|
||||||
|
symbol_first: true,
|
||||||
|
},
|
||||||
|
TRY : {
|
||||||
|
code: "TRY",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnEu,
|
||||||
|
minor_units: 1,
|
||||||
|
name: "Turkish Lira",
|
||||||
|
// symbol: "₺",
|
||||||
|
symbol: "TRY",
|
||||||
|
symbol_first: true,
|
||||||
|
},
|
||||||
|
IDR : {
|
||||||
|
code: "IDR",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnUs,
|
||||||
|
minor_units: 5000,
|
||||||
|
name: "Indonesian Rupiah",
|
||||||
|
// symbol: "Rp",
|
||||||
|
symbol: "IDR",
|
||||||
|
symbol_first: true,
|
||||||
|
},
|
||||||
|
CHF : {
|
||||||
|
code: "CHF",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnUs,
|
||||||
|
minor_units: 5,
|
||||||
|
name: "Swiss Franc",
|
||||||
|
// symbol: "Fr",
|
||||||
|
symbol: "CHF",
|
||||||
|
symbol_first: true,
|
||||||
|
},
|
||||||
|
SEK : {
|
||||||
|
code: "SEK",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnBy,
|
||||||
|
minor_units: 100,
|
||||||
|
name: "Swedish Krona",
|
||||||
|
// symbol: "kr",
|
||||||
|
symbol: "SEK",
|
||||||
|
symbol_first: false,
|
||||||
|
},
|
||||||
|
NOK : {
|
||||||
|
code: "NOK",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnUs,
|
||||||
|
minor_units: 100,
|
||||||
|
name: "Norwegian Krone",
|
||||||
|
// symbol: "kr",
|
||||||
|
symbol: "NOK",
|
||||||
|
symbol_first: false,
|
||||||
|
},
|
||||||
|
MEXICAN_PESO : {
|
||||||
|
code: "USD",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnUs,
|
||||||
|
minor_units: 1,
|
||||||
|
name: "Mexican Peso",
|
||||||
|
symbol: "MX$",
|
||||||
|
symbol_first: true,
|
||||||
|
},
|
||||||
|
ZAR : {
|
||||||
|
code: "ZAR",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnUs,
|
||||||
|
minor_units: 10,
|
||||||
|
name: "South African Rand",
|
||||||
|
// symbol: "R",
|
||||||
|
symbol: "ZAR",
|
||||||
|
symbol_first: true,
|
||||||
|
},
|
||||||
|
DKK : {
|
||||||
|
code: "DKK",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnEu,
|
||||||
|
minor_units: 50,
|
||||||
|
name: "Danish Krone",
|
||||||
|
// symbol: "kr.",
|
||||||
|
symbol: "DKK",
|
||||||
|
symbol_first: false,
|
||||||
|
},
|
||||||
|
THB : {
|
||||||
|
code: "THB",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnUs,
|
||||||
|
minor_units: 1,
|
||||||
|
name: "Thai Baht",
|
||||||
|
// symbol: "฿",
|
||||||
|
symbol: "THB",
|
||||||
|
symbol_first: true,
|
||||||
|
},
|
||||||
|
HUF : {
|
||||||
|
code: "HUF",
|
||||||
|
exponent: 0,
|
||||||
|
locale: EnBy,
|
||||||
|
minor_units: 5,
|
||||||
|
name: "Hungarian Forint",
|
||||||
|
// symbol: "Ft",
|
||||||
|
symbol: "HUF",
|
||||||
|
symbol_first: false,
|
||||||
|
},
|
||||||
|
KORUNA : {
|
||||||
|
code: "CZK",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnBy,
|
||||||
|
minor_units: 100,
|
||||||
|
name: "Czech Koruna",
|
||||||
|
// symbol: "Kč",
|
||||||
|
symbol: "CZK",
|
||||||
|
symbol_first: false,
|
||||||
|
},
|
||||||
|
SHEKEL : {
|
||||||
|
code: "CZK",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnBy,
|
||||||
|
minor_units: 100,
|
||||||
|
name: "Czech Koruna",
|
||||||
|
symbol: "Kč",
|
||||||
|
symbol_first: false,
|
||||||
|
},
|
||||||
|
CLP : {
|
||||||
|
code: "CLP",
|
||||||
|
exponent: 0,
|
||||||
|
locale: EnEu,
|
||||||
|
minor_units: 1,
|
||||||
|
name: "Chilean Peso",
|
||||||
|
// symbol: "$",
|
||||||
|
symbol: "CLP",
|
||||||
|
symbol_first: true,
|
||||||
|
},
|
||||||
|
PHP : {
|
||||||
|
code: "PHP",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnUs,
|
||||||
|
minor_units: 1,
|
||||||
|
name: "Philippine Peso",
|
||||||
|
symbol: "₱",
|
||||||
|
symbol_first: true,
|
||||||
|
},
|
||||||
|
AED : {
|
||||||
|
code: "AED",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnUs,
|
||||||
|
minor_units: 25,
|
||||||
|
name: "United Arab Emirates Dirham",
|
||||||
|
// symbol: "د.إ",
|
||||||
|
symbol: "AED",
|
||||||
|
symbol_first: false,
|
||||||
|
},
|
||||||
|
COP : {
|
||||||
|
code: "COP",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnEu,
|
||||||
|
minor_units: 20,
|
||||||
|
name: "Colombian Peso",
|
||||||
|
// symbol: "$",
|
||||||
|
symbol: "COP",
|
||||||
|
symbol_first: true,
|
||||||
|
},
|
||||||
|
SAR : {
|
||||||
|
code: "SAR",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnUs,
|
||||||
|
minor_units: 5,
|
||||||
|
name: "Saudi Riyal",
|
||||||
|
// symbol: "ر.س",
|
||||||
|
symbol: "SAR",
|
||||||
|
symbol_first: true,
|
||||||
|
},
|
||||||
|
MYR : {
|
||||||
|
code: "MYR",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnUs,
|
||||||
|
minor_units: 5,
|
||||||
|
name: "Malaysian Ringgit",
|
||||||
|
// symbol: "RM",
|
||||||
|
symbol: "MYR",
|
||||||
|
symbol_first: true,
|
||||||
|
},
|
||||||
|
RON : {
|
||||||
|
code: "RON",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnEu,
|
||||||
|
minor_units: 1,
|
||||||
|
name: "Romanian Leu",
|
||||||
|
// symbol: "ر.ق",
|
||||||
|
symbol: "RON",
|
||||||
|
symbol_first: false,
|
||||||
|
},
|
||||||
|
ARS : {
|
||||||
|
code: "ARS",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnEu,
|
||||||
|
minor_units: 1,
|
||||||
|
name: "Argentine Peso",
|
||||||
|
// symbol: "$",
|
||||||
|
symbol: "ARS",
|
||||||
|
symbol_first: true,
|
||||||
|
},
|
||||||
|
UYU : {
|
||||||
|
code: "UYU",
|
||||||
|
exponent: 2,
|
||||||
|
locale: EnEu,
|
||||||
|
minor_units: 100,
|
||||||
|
name: "Uruguayan Peso",
|
||||||
|
// symbol: "$U",
|
||||||
|
symbol: "UYU",
|
||||||
|
symbol_first: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
impl NumberFormat {
|
impl NumberFormat {
|
||||||
pub fn currency(&self) -> &'static Currency {
|
pub fn currency(&self) -> &'static number_currency::Currency {
|
||||||
match self {
|
let currency = match self {
|
||||||
NumberFormat::Number => USD,
|
NumberFormat::Number => number_currency::NUMBER,
|
||||||
NumberFormat::USD => USD,
|
NumberFormat::USD => number_currency::USD,
|
||||||
NumberFormat::CanadianDollar => USD,
|
NumberFormat::CanadianDollar => number_currency::CANADIAN_DOLLAR,
|
||||||
NumberFormat::EUR => EUR,
|
NumberFormat::EUR => number_currency::EUR,
|
||||||
NumberFormat::Pound => GIP,
|
NumberFormat::Pound => number_currency::GIP,
|
||||||
NumberFormat::Yen => CNY,
|
NumberFormat::Yen => number_currency::CNY,
|
||||||
NumberFormat::Ruble => RUB,
|
NumberFormat::Ruble => number_currency::RUB,
|
||||||
NumberFormat::Rupee => INR,
|
NumberFormat::Rupee => number_currency::INR,
|
||||||
NumberFormat::Won => KRW,
|
NumberFormat::Won => number_currency::KRW,
|
||||||
NumberFormat::Yuan => CNY,
|
NumberFormat::Yuan => number_currency::YUAN,
|
||||||
NumberFormat::Real => BRL,
|
NumberFormat::Real => number_currency::BRL,
|
||||||
NumberFormat::Lira => TRY,
|
NumberFormat::Lira => number_currency::TRY,
|
||||||
NumberFormat::Rupiah => IDR,
|
NumberFormat::Rupiah => number_currency::IDR,
|
||||||
NumberFormat::Franc => CHF,
|
NumberFormat::Franc => number_currency::CHF,
|
||||||
NumberFormat::HongKongDollar => USD,
|
NumberFormat::HongKongDollar => number_currency::HONG_KONG_DOLLAR,
|
||||||
NumberFormat::NewZealandDollar => USD,
|
NumberFormat::NewZealandDollar => number_currency::NEW_ZEALAND_DOLLAR,
|
||||||
NumberFormat::Krona => SEK,
|
NumberFormat::Krona => number_currency::SEK,
|
||||||
NumberFormat::NorwegianKrone => NOK,
|
NumberFormat::NorwegianKrone => number_currency::NOK,
|
||||||
NumberFormat::MexicanPeso => USD,
|
NumberFormat::MexicanPeso => number_currency::MEXICAN_PESO,
|
||||||
NumberFormat::Rand => ZAR,
|
NumberFormat::Rand => number_currency::ZAR,
|
||||||
NumberFormat::NewTaiwanDollar => USD,
|
NumberFormat::NewTaiwanDollar => number_currency::NEW_TAIWAN_DOLLAR,
|
||||||
NumberFormat::DanishKrone => DKK,
|
NumberFormat::DanishKrone => number_currency::DKK,
|
||||||
NumberFormat::Baht => THB,
|
NumberFormat::Baht => number_currency::THB,
|
||||||
NumberFormat::Forint => HUF,
|
NumberFormat::Forint => number_currency::HUF,
|
||||||
NumberFormat::Koruna => CZK,
|
NumberFormat::Koruna => number_currency::KORUNA,
|
||||||
NumberFormat::Shekel => CZK,
|
NumberFormat::Shekel => number_currency::SHEKEL,
|
||||||
NumberFormat::ChileanPeso => CLP,
|
NumberFormat::ChileanPeso => number_currency::CLP,
|
||||||
NumberFormat::PhilippinePeso => PHP,
|
NumberFormat::PhilippinePeso => number_currency::PHP,
|
||||||
NumberFormat::Dirham => AED,
|
NumberFormat::Dirham => number_currency::AED,
|
||||||
NumberFormat::ColombianPeso => COP,
|
NumberFormat::ColombianPeso => number_currency::COP,
|
||||||
NumberFormat::Riyal => SAR,
|
NumberFormat::Riyal => number_currency::SAR,
|
||||||
NumberFormat::Ringgit => MYR,
|
NumberFormat::Ringgit => number_currency::MYR,
|
||||||
NumberFormat::Leu => RON,
|
NumberFormat::Leu => number_currency::RON,
|
||||||
NumberFormat::ArgentinePeso => ARS,
|
NumberFormat::ArgentinePeso => number_currency::ARS,
|
||||||
NumberFormat::UruguayanPeso => UYU,
|
NumberFormat::UruguayanPeso => number_currency::UYU,
|
||||||
NumberFormat::Percent => USD,
|
NumberFormat::Percent => number_currency::USD,
|
||||||
}
|
};
|
||||||
|
currency
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn symbol(&self) -> String {
|
pub fn symbol(&self) -> String {
|
||||||
match self {
|
self.currency().symbol.to_string()
|
||||||
NumberFormat::Number => "".to_string(),
|
|
||||||
NumberFormat::USD => USD.symbol.to_string(),
|
|
||||||
NumberFormat::CanadianDollar => format!("CA{}", USD.symbol.to_string()),
|
|
||||||
NumberFormat::EUR => EUR.symbol.to_string(),
|
|
||||||
NumberFormat::Pound => GIP.symbol.to_string(),
|
|
||||||
NumberFormat::Yen => CNY.symbol.to_string(),
|
|
||||||
NumberFormat::Ruble => RUB.iso_alpha_code.to_string(),
|
|
||||||
NumberFormat::Rupee => INR.symbol.to_string(),
|
|
||||||
NumberFormat::Won => KRW.symbol.to_string(),
|
|
||||||
NumberFormat::Yuan => format!("CN{}", CNY.symbol.to_string()),
|
|
||||||
NumberFormat::Real => BRL.symbol.to_string(),
|
|
||||||
NumberFormat::Lira => TRY.iso_alpha_code.to_string(),
|
|
||||||
NumberFormat::Rupiah => IDR.iso_alpha_code.to_string(),
|
|
||||||
NumberFormat::Franc => CHF.iso_alpha_code.to_string(),
|
|
||||||
NumberFormat::HongKongDollar => format!("HK{}", USD.symbol.to_string()),
|
|
||||||
NumberFormat::NewZealandDollar => format!("NZ{}", USD.symbol.to_string()),
|
|
||||||
NumberFormat::Krona => SEK.iso_alpha_code.to_string(),
|
|
||||||
NumberFormat::NorwegianKrone => NOK.iso_alpha_code.to_string(),
|
|
||||||
NumberFormat::MexicanPeso => format!("MX{}", USD.symbol.to_string()),
|
|
||||||
NumberFormat::Rand => ZAR.iso_alpha_code.to_string(),
|
|
||||||
NumberFormat::NewTaiwanDollar => format!("NT{}", USD.symbol.to_string()),
|
|
||||||
NumberFormat::DanishKrone => DKK.iso_alpha_code.to_string(),
|
|
||||||
NumberFormat::Baht => THB.iso_alpha_code.to_string(),
|
|
||||||
NumberFormat::Forint => HUF.iso_alpha_code.to_string(),
|
|
||||||
NumberFormat::Koruna => CZK.iso_alpha_code.to_string(),
|
|
||||||
NumberFormat::Shekel => CZK.symbol.to_string(),
|
|
||||||
NumberFormat::ChileanPeso => CLP.iso_alpha_code.to_string(),
|
|
||||||
NumberFormat::PhilippinePeso => PHP.symbol.to_string(),
|
|
||||||
NumberFormat::Dirham => AED.iso_alpha_code.to_string(),
|
|
||||||
NumberFormat::ColombianPeso => COP.iso_alpha_code.to_string(),
|
|
||||||
NumberFormat::Riyal => SAR.iso_alpha_code.to_string(),
|
|
||||||
NumberFormat::Ringgit => MYR.iso_alpha_code.to_string(),
|
|
||||||
NumberFormat::Leu => RON.iso_alpha_code.to_string(),
|
|
||||||
NumberFormat::ArgentinePeso => ARS.iso_alpha_code.to_string(),
|
|
||||||
NumberFormat::UruguayanPeso => UYU.iso_alpha_code.to_string(),
|
|
||||||
NumberFormat::Percent => "%".to_string(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,6 +650,7 @@ mod tests {
|
||||||
"€18.443".to_owned()
|
"€18.443".to_owned()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -396,6 +694,7 @@ mod tests {
|
||||||
"€1.844,3".to_owned()
|
"€1.844,3".to_owned()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -435,6 +734,7 @@ mod tests {
|
||||||
"-€18.443".to_owned()
|
"-€18.443".to_owned()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue