Sha256: e63d6a84513f84ac941b2c40182af70f72b1a397e25e632a78313393a59f83a7

Contents?: true

Size: 506 Bytes

Versions: 5

Compression:

Stored size: 506 Bytes

Contents

# frozen_string_literal: true
module Decidim
  # A Helper to render language names in their own language.
  module LanguageChooserHelper
    # 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.
    def locale_name(locale)
      I18n.with_locale(locale) { I18n.t("name", scope: "locale") }
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
decidim-core-0.1.0 app/helpers/decidim/language_chooser_helper.rb
decidim-core-0.0.8.1 app/helpers/decidim/language_chooser_helper.rb
decidim-core-0.0.7 app/helpers/decidim/language_chooser_helper.rb
decidim-core-0.0.6 app/helpers/decidim/language_chooser_helper.rb
decidim-core-0.0.5 app/helpers/decidim/language_chooser_helper.rb