mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
fix log missing entries
This commit is contained in:
parent
622d7c5033
commit
7c9b2cf74f
@ -230,7 +230,8 @@ pub struct LocalizationHandle {
|
||||
// RAII guard returned from Localization::read(), resembles AssetGuard
|
||||
pub struct LocalizationGuard {
|
||||
active: AssetGuard<Language>,
|
||||
fallback: Option<AssetGuard<Language>>,
|
||||
fallback: Option<AssetGuard<Language>>, // optional display for missing translations
|
||||
reference: Option<AssetGuard<Language>>, // to determine missing translations
|
||||
}
|
||||
|
||||
// arbitrary choice to minimize changing all of veloren
|
||||
@ -271,7 +272,7 @@ impl LocalizationGuard {
|
||||
|
||||
/// Return the missing keys compared to the reference language
|
||||
fn list_missing_entries(&self) -> (HashSet<String>, HashSet<String>) {
|
||||
if let Some(ref_lang) = &self.fallback {
|
||||
if let Some(ref_lang) = self.fallback.as_ref().or(self.reference.as_ref()) {
|
||||
let reference_string_keys: HashSet<_> = ref_lang.string_map.keys().cloned().collect();
|
||||
let string_keys: HashSet<_> = self.active.string_map.keys().cloned().collect();
|
||||
let strings = reference_string_keys
|
||||
@ -329,6 +330,11 @@ impl LocalizationHandle {
|
||||
} else {
|
||||
None
|
||||
},
|
||||
reference: if !self.use_english_fallback {
|
||||
self.fallback.map(|f| f.read())
|
||||
} else {
|
||||
None
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user