diff --git a/app/helpers/pageflow/admin/entry_translations_helper.rb b/app/helpers/pageflow/admin/entry_translations_helper.rb index cb619ce68e..f6ef93499b 100644 --- a/app/helpers/pageflow/admin/entry_translations_helper.rb +++ b/app/helpers/pageflow/admin/entry_translations_helper.rb @@ -3,10 +3,7 @@ module Admin # @api private module EntryTranslationsHelper def entry_translation_display_locale(entry) - display_locale = t( - 'pageflow.public._language', - locale: (entry.published_revision || entry.draft).locale - ) + display_locale = locale_name_for((entry.published_revision || entry.draft).locale) if entry.default_translation? t('pageflow.admin.entry_translations.default_translation', display_locale:) diff --git a/app/helpers/pageflow/admin/locales_helper.rb b/app/helpers/pageflow/admin/locales_helper.rb index 0c9456faa9..ab6999e33f 100644 --- a/app/helpers/pageflow/admin/locales_helper.rb +++ b/app/helpers/pageflow/admin/locales_helper.rb @@ -1,19 +1,23 @@ module Pageflow module Admin module LocalesHelper + def locale_name_for(locale, i18n_key = 'pageflow.public._language') + I18n.t(i18n_key, locale: locale) + end + def available_locales_collection locales_collection(Pageflow.config.available_locales, 'language') end def available_public_locales_collection - locales_collection(Pageflow.config.available_public_locales, 'pageflow.public._language') + locales_collection(Pageflow.config.available_public_locales) end private - def locales_collection(locales, i18n_key) + def locales_collection(locales, i18n_key = 'pageflow.public._language') locales.map do |locale| - [I18n.t(i18n_key, locale: locale), locale.to_s] + [locale_name_for(locale, i18n_key), locale.to_s] end end end diff --git a/app/views/admin/accounts/_entry_template_details.html.arb b/app/views/admin/accounts/_entry_template_details.html.arb index 1a067533cc..0373d4b696 100644 --- a/app/views/admin/accounts/_entry_template_details.html.arb +++ b/app/views/admin/accounts/_entry_template_details.html.arb @@ -7,7 +7,7 @@ extensible_attributes_table_for(entry_template, entry_template.theme_name end row :default_locale, class: 'default_locale' do - t('pageflow.public._language', locale: entry_template.default_locale) + locale_name_for(entry_template.default_locale) end row :default_author, class: 'default_author' row :default_publisher, class: 'default_publisher'