Class: Decidim::Log::ValueTypes::LocalePresenter

Inherits:
DefaultPresenter show all
Defined in:
decidim-core/app/presenters/decidim/log/value_types/locale_presenter.rb

Overview

This class presents the given value as a locale. Check the `DefaultPresenter` for more info on how value presenters work.

Instance Method Summary collapse

Methods inherited from DefaultPresenter

#initialize

Constructor Details

This class inherits a constructor from Decidim::Log::ValueTypes::DefaultPresenter

Instance Method Details

#presentObject

Public: Presents the value as a locale.

Returns an HTML-safe String.


13
14
15
16
17
# File 'decidim-core/app/presenters/decidim/log/value_types/locale_presenter.rb', line 13

def present
  return unless value

  I18n.with_locale(value) { I18n.t("locale.name") }
end