|
|
@ -65,9 +65,11 @@ def load_all_locales
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def translate(locale : String?, key : String, text : String | Nil = nil) : String
|
|
|
|
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)
|
|
|
|
if !LOCALES["en-US"].has_key?(key)
|
|
|
|
LOGGER.warn("i18n: Missing translation key \"#{key}\"")
|
|
|
|
LOGGER.warn("i18n: Missing translation key \"#{key}\"")
|
|
|
|
|
|
|
|
return key
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# Default to english, whenever the locale doesn't exist,
|
|
|
|
# Default to english, whenever the locale doesn't exist,
|
|
|
|