summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamantaz Fox <coding@samantaz.fr>2021-11-25 19:46:34 +0100
committerSamantaz Fox <coding@samantaz.fr>2021-11-25 19:46:34 +0100
commit2ea0590b032c397868c77a3920661348e7944731 (patch)
treedcc39882065d842c002392d07adec383c1be1d40
parentbf7952d9c7d1cd7f676cfecb70ba2dbbb0d4c4a5 (diff)
downloadinvidious-2ea0590b032c397868c77a3920661348e7944731.tar.gz
invidious-2ea0590b032c397868c77a3920661348e7944731.tar.bz2
invidious-2ea0590b032c397868c77a3920661348e7944731.zip
i18n: return 'key' if 'key' is not in locales files
-rw-r--r--src/invidious/helpers/i18n.cr4
1 files changed, 3 insertions, 1 deletions
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,