Only strip country code when language not listed in SUPPORTED_LOCALES (#27099)

pull/28237/head
gunchleoc 2023-09-28 09:13:44 +01:00 committed by Claire
parent ef149674f0
commit 156d32689b
1 changed files with 1 additions and 0 deletions

View File

@ -254,6 +254,7 @@ module LanguagesHelper
def valid_locale_or_nil(str) def valid_locale_or_nil(str)
return if str.blank? return if str.blank?
return str if valid_locale?(str)
code, = str.to_s.split(/[_-]/) # Strip out the region from e.g. en_US or ja-JP code, = str.to_s.split(/[_-]/) # Strip out the region from e.g. en_US or ja-JP