Skip to content

DesignCraft: An open-source page and layout design editor written by scratch in pure Rust

Merge #272: i18n: translate the whole interface into Japanese

aionggebe646e917f1
diff --cc crates/ui-egui/src/i18n.rs
index e6de3dbd3,c049bc37d..e447fbaac
--- a/crates/ui-egui/src/i18n.rs
+++ b/crates/ui-egui/src/i18n.rs
@@@ -4,9 -4,8 +4,10 @@@
use std::{collections::HashMap, sync::OnceLock};
mod ar;
+mod it;
+ mod ja;
mod pt_br;
+mod uk;
/// Supported interface languages: (code, name in that language).
pub const LANGUAGES: &[(&str, &str)] = &[
@@@ -2808,11 -2731,10 +2809,12 @@@ fn column(lang: &str) -> Option<usize>
/// `s` in `lang` (English, or the string itself, when there's no translation).
pub fn tr<'a>(lang: &str, s: &'a str) -> &'a str {
+ static JAPANESE: OnceLock<HashMap<&'static str, &'static str>> = OnceLock::new();
static TRANSLATIONS: OnceLock<HashMap<&'static str, [&'static str; 5]>> = OnceLock::new();
static ARABIC: OnceLock<HashMap<&'static str, &'static str>> = OnceLock::new();
+ static UKRAINIAN: OnceLock<HashMap<&'static str, &'static str>> = OnceLock::new();
static PORTUGUESE_BR: OnceLock<HashMap<&'static str, &'static str>> = OnceLock::new();
+ static ITALIAN: OnceLock<HashMap<&'static str, &'static str>> = OnceLock::new();
if lang == "ar" {
return ARABIC.get_or_init(|| ar::TABLE.iter().copied().collect()).get(s).copied().unwrap_or(s);
}