From e34bb494ae188d35c3200eb81ae1c39052ed1689 Mon Sep 17 00:00:00 2001 From: cksac Date: Mon, 6 Jan 2025 13:17:21 +0800 Subject: [PATCH] add de_de for cli --- CHANGELOG.md | 7 ++++++- Cargo.toml | 3 +++ fake/Cargo.toml | 2 +- fake/src/bin/cli/fake_gen.rs | 12 +++++------- fake/src/bin/cli/main.rs | 8 ++++---- fake/src/bin/cli/names.rs | 1 - 6 files changed, 19 insertions(+), 14 deletions(-) delete mode 100644 fake/src/bin/cli/names.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index 47a7833..8383915 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelogs -## v3.1.0 +## v3.1.1 +- Add more french translation(@odarrouzet [#213](https://github.com/cksac/fake-rs/pull/213)) +- Add de_de locale support in fake cli +- Enable Link-Time Optimization + +## v3.1.0 (2024-12-27) - Allow CityName implementation to be overrite by each locale - Added DE_DE Locale (@xoryouyou [#75](https://github.com/cksac/fake-rs/pull/75)) - Added fake cli (@akhildevelops [#209](https://github.com/cksac/fake-rs/pull/209)) diff --git a/Cargo.toml b/Cargo.toml index 3131db6..47d8163 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,3 +5,6 @@ members = [ ] resolver = "2" + +[profile.release] +lto = true \ No newline at end of file diff --git a/fake/Cargo.toml b/fake/Cargo.toml index cb6ee01..00fb36d 100644 --- a/fake/Cargo.toml +++ b/fake/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fake" -version = "3.1.0" +version = "3.1.1" authors = ["cksac "] description = "An easy to use library and command line for generating fake data like name, number, address, lorem, dates, etc." keywords = ["faker", "data", "generator", "random"] diff --git a/fake/src/bin/cli/fake_gen.rs b/fake/src/bin/cli/fake_gen.rs index 87c1d3c..8c375d1 100644 --- a/fake/src/bin/cli/fake_gen.rs +++ b/fake/src/bin/cli/fake_gen.rs @@ -11,6 +11,7 @@ pub enum AVAILABLE_LOCALES { JA_JP, AR_SA, PT_BR, + DE_DE, } macro_rules! fake_gen_on_return_type { @@ -29,37 +30,34 @@ macro_rules! some_rules { AVAILABLE_LOCALES::EN => { let s = faker::$module::en::$fake($($arg)?); Box::new(move |rng: &mut R| fake_gen_on_return_type!(s,rng$(,$return_type)?)) - } AVAILABLE_LOCALES::FR_FR => { let s = faker::$module::fr_fr::$fake($($arg)?); Box::new(move |rng: &mut R| fake_gen_on_return_type!(s,rng$(,$return_type)?)) - } AVAILABLE_LOCALES::ZH_TW => { let s = faker::$module::zh_tw::$fake($($arg)?); Box::new(move |rng: &mut R| fake_gen_on_return_type!(s,rng$(,$return_type)?)) - } AVAILABLE_LOCALES::ZH_CN => { let s = faker::$module::zh_cn::$fake($($arg)?); Box::new(move |rng: &mut R| fake_gen_on_return_type!(s,rng$(,$return_type)?)) - } AVAILABLE_LOCALES::AR_SA => { let s = faker::$module::ar_sa::$fake($($arg)?); Box::new(move |rng: &mut R| fake_gen_on_return_type!(s,rng$(,$return_type)?)) - } AVAILABLE_LOCALES::JA_JP => { let s = faker::$module::ja_jp::$fake($($arg)?); Box::new(move |rng: &mut R| fake_gen_on_return_type!(s,rng$(,$return_type)?)) - } AVAILABLE_LOCALES::PT_BR => { let s = faker::$module::pt_br::$fake($($arg)?); Box::new(move |rng: &mut R| fake_gen_on_return_type!(s,rng$(,$return_type)?)) - + } + AVAILABLE_LOCALES::DE_DE => { + let s = faker::$module::de_de::$fake($($arg)?); + Box::new(move |rng: &mut R| fake_gen_on_return_type!(s,rng$(,$return_type)?)) } } }; diff --git a/fake/src/bin/cli/main.rs b/fake/src/bin/cli/main.rs index 3169621..f510f90 100644 --- a/fake/src/bin/cli/main.rs +++ b/fake/src/bin/cli/main.rs @@ -4,10 +4,9 @@ use std::io::{self, Write}; mod fake_gen; -#[allow(non_upper_case_globals)] -mod names; - -const AVAILABLE_LOCALES: [&str; 7] = ["en", "fr_fr", "zh_tw", "zh_cn", "ja_jp", "ar_sa", "pt_br"]; +const AVAILABLE_LOCALES: [&str; 8] = [ + "en", "fr_fr", "zh_tw", "zh_cn", "ja_jp", "ar_sa", "pt_br", "de_de", +]; pub use fake_gen::{all_fakegen_commands, AVAILABLE_LOCALES}; pub fn main() { @@ -39,6 +38,7 @@ impl TryFrom<&str> for AVAILABLE_LOCALES { "ja_jp" => AVAILABLE_LOCALES::JA_JP, "ar_sa" => AVAILABLE_LOCALES::AR_SA, "pt_br" => AVAILABLE_LOCALES::PT_BR, + "de_de" => AVAILABLE_LOCALES::DE_DE, _=> return Err(format!("{} is either an invalid locale or not yet supported.\n The supported locales are: {:?}",str_val,AVAILABLE_LOCALES)) }; Ok(variant) diff --git a/fake/src/bin/cli/names.rs b/fake/src/bin/cli/names.rs deleted file mode 100644 index 8b13789..0000000 --- a/fake/src/bin/cli/names.rs +++ /dev/null @@ -1 +0,0 @@ -