DEV: Apply syntax_tree formatting to lib/*

This commit is contained in:
David Taylor
2023-01-09 12:10:19 +00:00
parent b0fda61a8e
commit 6417173082
507 changed files with 16550 additions and 12627 deletions

View File

@ -4,10 +4,10 @@ module HttpLanguageParser
def self.parse(header)
# Rails I18n uses underscores between the locale and the region; the request
# headers use hyphens.
require 'http_accept_language' unless defined? HttpAcceptLanguage
available_locales = I18n.available_locales.map { |locale| locale.to_s.tr('_', '-') }
require "http_accept_language" unless defined?(HttpAcceptLanguage)
available_locales = I18n.available_locales.map { |locale| locale.to_s.tr("_", "-") }
parser = HttpAcceptLanguage::Parser.new(header)
matched = parser.language_region_compatible_from(available_locales)&.tr('-', '_')
matched = parser.language_region_compatible_from(available_locales)&.tr("-", "_")
matched || SiteSetting.default_locale
end
end