diff --git a/app/components/shared/globalize_locales_component.rb b/app/components/shared/globalize_locales_component.rb index 8060cadc2..49034ecc4 100644 --- a/app/components/shared/globalize_locales_component.rb +++ b/app/components/shared/globalize_locales_component.rb @@ -33,16 +33,16 @@ class Shared::GlobalizeLocalesComponent < ApplicationComponent end def first_i18n_content_translation_locale - if I18nContentTranslation.existing_languages.count == 0 || - I18nContentTranslation.existing_languages.include?(I18n.locale) + if I18nContentTranslation.existing_locales.count == 0 || + I18nContentTranslation.existing_locales.include?(I18n.locale) I18n.locale else - I18nContentTranslation.existing_languages.first + I18nContentTranslation.existing_locales.first end end def selected_languages_description - sanitize(t("shared.translations.languages_in_use", count: active_languages_count)) + sanitize(t("shared.translations.languages_in_use", count: active_locales_count)) end def select_language_error @@ -56,9 +56,9 @@ class Shared::GlobalizeLocalesComponent < ApplicationComponent end end - def active_languages_count + def active_locales_count if resource.blank? - no_resource_languages_count + no_resource_locales_count elsif resource.locales_not_marked_for_destruction.size > 0 resource.locales_not_marked_for_destruction.size else @@ -66,8 +66,8 @@ class Shared::GlobalizeLocalesComponent < ApplicationComponent end end - def no_resource_languages_count - count = I18nContentTranslation.existing_languages.count + def no_resource_locales_count + count = I18nContentTranslation.existing_locales.count count > 0 ? count : 1 end diff --git a/app/helpers/site_customization_helper.rb b/app/helpers/site_customization_helper.rb index a002071dd..61dd678e9 100644 --- a/app/helpers/site_customization_helper.rb +++ b/app/helpers/site_customization_helper.rb @@ -1,6 +1,6 @@ module SiteCustomizationHelper def site_customization_enable_translation?(locale) - I18nContentTranslation.existing_languages.include?(locale) || locale == I18n.locale + I18nContentTranslation.existing_locales.include?(locale) || locale == I18n.locale end def information_texts_tabs diff --git a/app/models/i18n_content_translation.rb b/app/models/i18n_content_translation.rb index 4e754a3a5..e15d3e54b 100644 --- a/app/models/i18n_content_translation.rb +++ b/app/models/i18n_content_translation.rb @@ -1,5 +1,5 @@ class I18nContentTranslation < ApplicationRecord - def self.existing_languages + def self.existing_locales self.select(:locale).distinct.map { |l| l.locale.to_sym }.to_a end end