From 7c9b2cf74f006052d8f8438700c7046725820ea7 Mon Sep 17 00:00:00 2001 From: Christof Petig Date: Mon, 3 May 2021 23:55:19 +0200 Subject: [PATCH] fix log missing entries --- voxygen/src/i18n.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/voxygen/src/i18n.rs b/voxygen/src/i18n.rs index cd3f823f68..e054eaa023 100644 --- a/voxygen/src/i18n.rs +++ b/voxygen/src/i18n.rs @@ -230,7 +230,8 @@ pub struct LocalizationHandle { // RAII guard returned from Localization::read(), resembles AssetGuard pub struct LocalizationGuard { active: AssetGuard, - fallback: Option>, + fallback: Option>, // optional display for missing translations + reference: Option>, // 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, HashSet) { - 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 + }, } }