Upgraded i18n mapping gem (#2756)

* Upgraded i18n mapping gem

* Rubocop
This commit is contained in:
Ahmad Farhat 2021-06-03 17:48:19 -04:00 committed by GitHub
parent 4dcfc29608
commit bb9e33d993
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 5 deletions

View File

@ -19,7 +19,7 @@ gem 'coveralls', '~> 0.8.23', require: false
gem 'font-awesome-sass', '~> 5.9.0'
gem 'google-cloud-storage', '~> 1.30.0'
gem 'http_accept_language', '~> 2.1.1'
gem 'i18n-language-mapping', '~> 0.1.1'
gem 'i18n-language-mapping', '~> 0.1.3.1'
gem 'jbuilder', '~> 2.11.2'
gem 'jquery-rails', '~> 4.4.0'
gem 'jquery-ui-rails', '~> 6.0.1'

View File

@ -186,7 +186,7 @@ GEM
httpclient (2.8.3)
i18n (1.8.10)
concurrent-ruby (~> 1.0)
i18n-language-mapping (0.1.2)
i18n-language-mapping (0.1.3.1)
jbuilder (2.11.2)
activesupport (>= 5.0.0)
jmespath (1.4.0)
@ -479,7 +479,7 @@ DEPENDENCIES
google-cloud-storage (~> 1.30.0)
hiredis (~> 0.6.3)
http_accept_language (~> 2.1.1)
i18n-language-mapping (~> 0.1.1)
i18n-language-mapping (~> 0.1.3.1)
jbuilder (~> 2.11.2)
jquery-rails (~> 4.4.0)
jquery-ui-rails (~> 6.0.1)

View File

@ -44,12 +44,16 @@ module UsersHelper
# Returns language selection options for user edit
def language_options
locales = I18n.available_locales
language_opts = [["<<<< #{t('language_default')} >>>>", "default"]]
languages = [["<<<< #{t('language_default')} >>>>", "default"]]
language_opts = []
locales.each do |locale|
language_mapping = I18n::Language::Mapping.language_mapping_list[locale.to_s.gsub("_", "-")]
language_opts.push([language_mapping["nativeName"], locale.to_s])
end
language_opts.sort
language_opts.sort_by!(&:last)
languages + language_opts
end
# Returns a list of roles that the user can have