From 69093995ade71fd8174c2b627dff92b89c484157 Mon Sep 17 00:00:00 2001 From: Max Gramser Date: Sat, 19 Sep 2026 14:59:42 +0200 Subject: [PATCH] Keep a separator of one space: French, Polish and Portuguese write thousands with it Co-Authored-By: Claude Opus 5 --- components/smart_display/screen_text_gen.py | 3 ++- screen_manager/app/i18n.py | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) 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('|')]