From 2ea0590b032c397868c77a3920661348e7944731 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Thu, 25 Nov 2021 19:46:34 +0100 Subject: [PATCH] i18n: return 'key' if 'key' is not in locales files --- src/invidious/helpers/i18n.cr | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/invidious/helpers/i18n.cr b/src/invidious/helpers/i18n.cr index ab959c13..6e29b498 100644 --- a/src/invidious/helpers/i18n.cr +++ b/src/invidious/helpers/i18n.cr @@ -65,9 +65,11 @@ def load_all_locales end def translate(locale : String?, key : String, text : String | Nil = nil) : String - # Log a warning if "key" doesn't exist in en-US locale + # Log a warning if "key" doesn't exist in en-US locale and return + # that key as the text, so this is more or less transparent to the user. if !LOCALES["en-US"].has_key?(key) LOGGER.warn("i18n: Missing translation key \"#{key}\"") + return key end # Default to english, whenever the locale doesn't exist,