about summary refs log tree commit diff
path: root/app/helpers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-03-09 08:46:05 +0100
committerGitHub <noreply@github.com>2022-03-09 08:46:05 +0100
commitc0327ff31f839e1beae59486bf92d7e1c4689b06 (patch)
tree37d25240f1427ed1c2ee6d62c9359d15afa1432b /app/helpers
parent8f6c67bfdeddd1c2c1085067e3dc549fb53f6ff4 (diff)
Fix invalid language resulting in no fallback being set on statuses (#17722)
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/languages_helper.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/helpers/languages_helper.rb b/app/helpers/languages_helper.rb
index f22cc6d28..9be35ad8e 100644
--- a/app/helpers/languages_helper.rb
+++ b/app/helpers/languages_helper.rb
@@ -241,6 +241,15 @@ module LanguagesHelper
     code
   end
 
+  def valid_locale_cascade(*arr)
+    arr.each do |str|
+      locale = valid_locale_or_nil(str)
+      return locale if locale.present?
+    end
+
+    nil
+  end
+
   def valid_locale?(locale)
     locale.present? && SUPPORTED_LOCALES.key?(locale.to_sym)
   end