diff --git a/components/smart_display/screen_text_gen.py b/components/smart_display/screen_text_gen.py index a3e4371..09f1d51 100644 --- a/components/smart_display/screen_text_gen.py +++ b/components/smart_display/screen_text_gen.py @@ -103,7 +103,8 @@ def table(code, folder=TRANSLATIONS): for key, text in screen_pairs(english): keys.append(key) translated = own.get(key) - texts.append(translated if isinstance(translated, str) and translated.strip() else text) + # Only an empty text is missing: a separator of one space (French thousands) is a text. + texts.append(translated if isinstance(translated, str) and translated != '' else text) meta = (load(language, folder) or {}).get('_meta', {}) rule = meta.get('plural') if meta.get('plural') in PLURAL_RULES else 'one_other' return language, keys, texts, rule diff --git a/screen_manager/app/i18n.py b/screen_manager/app/i18n.py index a8e2029..0f368d9 100644 --- a/screen_manager/app/i18n.py +++ b/screen_manager/app/i18n.py @@ -100,8 +100,11 @@ class Translations: def text(self, key, language='en', **params): """`key` in `language`, English where it has none, with {placeholders} filled; `n` picks a plural form.""" language = self.resolve(language) - text = self.flat.get(language, {}).get(key) or self.flat['en'].get(key) - if not isinstance(text, str) or not text.strip(): + text = self.flat.get(language, {}).get(key) + # Only an empty text is missing: a separator of one space (French thousands) is a text. + if not isinstance(text, str) or text == '': + text = self.flat['en'].get(key) + if not isinstance(text, str) or text == '': return key if '|' in text and 'n' in params: forms = [form.strip() for form in text.split('|')]