diff --git a/app/lib/link_details_extractor.rb b/app/lib/link_details_extractor.rb index cf273e4967d59e..6fa4338c70f4a1 100644 --- a/app/lib/link_details_extractor.rb +++ b/app/lib/link_details_extractor.rb @@ -232,14 +232,6 @@ def valid_url_or_nil(str, same_origin_only: false) nil end - def valid_locale_or_nil(str) - return nil if str.blank? - - code, = str.split(/_-/) # Strip out the region from e.g. en_US or ja-JA - locale = ISO_639.find(code) - locale&.alpha2 - end - def link_tag(name) document.xpath("//link[@rel=\"#{name}\"]").map { |link| link['href'] }.first end diff --git a/spec/helpers/languages_helper_spec.rb b/spec/helpers/languages_helper_spec.rb index 6db617824db8f8..b455cee33d1a3a 100644 --- a/spec/helpers/languages_helper_spec.rb +++ b/spec/helpers/languages_helper_spec.rb @@ -3,9 +3,9 @@ require 'rails_helper' describe LanguagesHelper do - describe 'the HUMAN_LOCALES constant' do - it 'includes all I18n locales' do - expect(described_class::HUMAN_LOCALES.keys).to include(*I18n.available_locales) + describe 'the SUPPORTED_LOCALES constant' do + it 'includes all i18n locales' do + expect(Set.new(described_class::SUPPORTED_LOCALES.keys + described_class::REGIONAL_LOCALE_NAMES.keys)).to include(*I18n.available_locales) end end