Skip to content

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

Merge #374: Russian interface

aionggf359098e8e63
diff --cc crates/ui-egui/src/i18n.rs
index 255cf889f,c0e221c90..d3fff5cc8
--- a/crates/ui-egui/src/i18n.rs
+++ b/crates/ui-egui/src/i18n.rs
@@@ -3498,13 -2868,12 +3504,13 @@@ pub fn tr<'a>(lang: &str, s: &'a str) -
/// Context-sensitive UI captions; unsupported contexts keep the shared translation.
pub fn tr_context<'a>(lang: &str, s: &'a str, context: &str) -> &'a str {
- if lang == "uk" {
- return uk::CONTEXT.iter().find(|(key, scope, _)| *key == s && *scope == context).map_or_else(|| tr(lang, s), |(_, _, text)| text);
- }
- if lang == "ja" {
- return ja::CONTEXT.iter().find(|(key, scope, _)| *key == s && *scope == context).map_or_else(|| tr(lang, s), |(_, _, text)| text);
- }
- tr(lang, s)
+ let contexts = match lang {
+ "uk" => uk::CONTEXT,
+ "ru" => ru::CONTEXT,
++ "ja" => ja::CONTEXT,
+ _ => return tr(lang, s),
+ };
+ contexts.iter().find(|(key, scope, _)| *key == s && *scope == context).map_or_else(|| tr(lang, s), |(_, _, text)| text)
}
#[cfg(test)]