Better display missing localizations

rust
Elnu 1 year ago
parent 4e2230d6f3
commit b343b6138b

@ -86,7 +86,17 @@ pub fn i18n_filter(
.unwrap_or_else(|| vec![DEFAULT]); .unwrap_or_else(|| vec![DEFAULT]);
for lang in langs { for lang in langs {
if let Some(catalog) = catalogs.get(lang) { 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"); panic!("Missing catalog");

Loading…
Cancel
Save