Better display missing localizations
This commit is contained in:
parent
4e2230d6f3
commit
b343b6138b
1 changed files with 11 additions and 1 deletions
12
src/i18n.rs
12
src/i18n.rs
|
@ -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…
Add table
Reference in a new issue