From c32712134c2e488e0eb277aaa8a7844c200dec33 Mon Sep 17 00:00:00 2001 From: Sebastien Rousseau Date: Sun, 7 Apr 2024 16:41:21 +0100 Subject: [PATCH] refactor(ssg): :globe_with_meridians: starting to add localization messages --- src/lang/de.rs | 1 + src/lang/en.rs | 1 + src/lang/fr.rs | 1 + src/main.rs | 5 ++++- 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lang/de.rs b/src/lang/de.rs index 722627d1..9f8b5df9 100644 --- a/src/lang/de.rs +++ b/src/lang/de.rs @@ -44,6 +44,7 @@ lazy_static::lazy_static! { pub static ref T: std::collections::HashMap<&'static str, &'static str> = [ ("Hello", "Hallo"), + ("main_logger_msg", "\nFür weitere Informationen führen Sie bitte `ssg --help` aus.\n") // Add more translations here ].iter().cloned().collect(); } \ No newline at end of file diff --git a/src/lang/en.rs b/src/lang/en.rs index 68a89789..7345f520 100644 --- a/src/lang/en.rs +++ b/src/lang/en.rs @@ -46,6 +46,7 @@ lazy_static::lazy_static! { pub static ref T: std::collections::HashMap<&'static str, &'static str> = [ ("Hello", "Hello"), + ("main_logger_msg", "\nPlease run `ssg --help` for more information.\n") // Add more translations here ].iter().cloned().collect(); } \ No newline at end of file diff --git a/src/lang/fr.rs b/src/lang/fr.rs index 0664a610..b7ccd881 100644 --- a/src/lang/fr.rs +++ b/src/lang/fr.rs @@ -44,6 +44,7 @@ lazy_static::lazy_static! { pub static ref T: std::collections::HashMap<&'static str, &'static str> = [ ("Hello", "Bonjour"), + ("main_logger_msg", "\nVeuillez lancer `ssg --help` pour plus d'informations.\n") // Add more translations here ].iter().cloned().collect(); } \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index eac12342..1bb91767 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,10 +7,13 @@ //! //! If an error occurs while running the `run()` function, the function prints an error message //! to standard error and exits the program with a non-zero status code. + +use ssg::languages::translate; + fn main() { if let Err(err) = ssg::run() { eprintln!("{}", err); - eprintln!("\nPlease run `ssg --help` for more information.\n"); + eprintln!("{}", translate("en", "main_logger_msg")); std::process::exit(1); } }