diff --git a/app/helpers/pageflow/admin/entry_translations_helper.rb b/app/helpers/pageflow/admin/entry_translations_helper.rb index cb619ce68e..dee37fd979 100644 --- a/app/helpers/pageflow/admin/entry_translations_helper.rb +++ b/app/helpers/pageflow/admin/entry_translations_helper.rb @@ -2,11 +2,10 @@ module Pageflow module Admin # @api private module EntryTranslationsHelper + include Pageflow::PublicI18n::LocalesHelper + def entry_translation_display_locale(entry) - display_locale = t( - 'pageflow.public._language', - locale: (entry.published_revision || entry.draft).locale - ) + display_locale = public_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..7819be950d 100644 --- a/app/helpers/pageflow/admin/locales_helper.rb +++ b/app/helpers/pageflow/admin/locales_helper.rb @@ -1,19 +1,17 @@ module Pageflow module Admin module LocalesHelper + include Pageflow::PublicI18n::LocalesHelper + def available_locales_collection - locales_collection(Pageflow.config.available_locales, 'language') + Pageflow.config.available_locales.map do |locale| + [I18n.t('language', locale: locale), locale.to_s] + end end def available_public_locales_collection - locales_collection(Pageflow.config.available_public_locales, 'pageflow.public._language') - end - - private - - def locales_collection(locales, i18n_key) - locales.map do |locale| - [I18n.t(i18n_key, locale: locale), locale.to_s] + Pageflow.config.available_public_locales.map do |locale| + [public_locale_name_for(locale), 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..a3efcbd041 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) + public_locale_name_for(entry_template.default_locale) end row :default_author, class: 'default_author' row :default_publisher, class: 'default_publisher' diff --git a/entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb b/entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb index 6ebc86d40a..ab6ce097b1 100644 --- a/entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb +++ b/entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb @@ -9,6 +9,7 @@ module EntryJsonSeedHelper include Pageflow::EntriesHelper include Pageflow::MetaTagsHelper include Pageflow::SocialShareLinksHelper + include Pageflow::PublicI18n::LocalesHelper include PageflowScrolled::I18nHelper include PageflowScrolled::ThemesHelper diff --git a/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry_translations.json.jbuilder b/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry_translations.json.jbuilder index 1aada2b727..b2d1b60f40 100644 --- a/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry_translations.json.jbuilder +++ b/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry_translations.json.jbuilder @@ -1,7 +1,7 @@ json.entry_translations do json.array!(entry.translations(-> { preload(:site) }, include_noindex: true)) do |translation| json.(translation, :id, :locale) - json.display_locale t('pageflow.public._language', locale: translation.locale) + json.display_locale public_locale_name_for(translation.locale) if translation.published_revision? json.url social_share_entry_url(translation) diff --git a/pageflow.gemspec b/pageflow.gemspec index 3cb336e94b..22214f385e 100644 --- a/pageflow.gemspec +++ b/pageflow.gemspec @@ -128,7 +128,7 @@ Gem::Specification.new do |s| s.add_dependency 'http_accept_language', '~> 2.0' # Shared translations - s.add_dependency 'pageflow-public-i18n', '~> 1.27' + s.add_dependency 'pageflow-public-i18n', '~> 1.28' # Password encryption s.add_dependency 'bcrypt', '~> 3.1.7'