I want to match the locale code to the specific language name. Is there any build in function in I18n/rails which would return the language name to the corresponding locales. Is installing a gem is the only way?
It seems there is no method for this in I18n. If you just need current language name, you can easily include it to corresponding locale file:
# config/locales/en.yml en: language_name: "English"
And get it as usual:
I18n.t('language_name', locale: :en). For general purposes you could use: https://github.com/hexorx/countries or initialize your own mapping.