From b343b6138b36ef89ecc37591f95fff2550c1e543 Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Wed, 5 Jul 2023 13:26:28 -0700 Subject: [PATCH] Better display missing localizations --- src/i18n.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/i18n.rs b/src/i18n.rs index f5867a2..2e8057a 100644 --- a/src/i18n.rs +++ b/src/i18n.rs @@ -86,7 +86,17 @@ pub fn i18n_filter( .unwrap_or_else(|| vec![DEFAULT]); for lang in langs { if let Some(catalog) = catalogs.get(lang) { - return Ok(Value::String(catalog.gettext(key).to_owned())); + return Ok(Value::String({ + let mut value = catalog.gettext(key); + if value.is_empty() { + value = key; + } + if value.eq(key) { + format!("❓ {value} ❓") + } else { + value.to_owned() + } + })); } } panic!("Missing catalog");