Skip to content

Commit

Permalink
refactor(ssg): 🌐 starting to add localization messages
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienrousseau committed Apr 7, 2024
1 parent b88c4ff commit c327121
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/lang/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
1 change: 1 addition & 0 deletions src/lang/en.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
1 change: 1 addition & 0 deletions src/lang/fr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
5 changes: 4 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit c327121

Please sign in to comment.