Module: Decidim::LanguageChooserHelper

Defined in:
decidim-core/app/helpers/decidim/language_chooser_helper.rb

Overview

A Helper to render language names in their own language.

Instance Method Summary collapse

Instance Method Details

#locale_name(locale) ⇒ Object

Gets the name of the given locale, in that language.

Example:

locale_name(:es) => "Castellano"

locale - a String representing the symbol of the locale. It will usually be 2 letters.

Returns a String.



15
16
17
# File 'decidim-core/app/helpers/decidim/language_chooser_helper.rb', line 15

def locale_name(locale)
  I18n.with_locale(locale) { I18n.t("name", scope: "locale") }
end