Sha256: 677cdd961c207ef233abfc209462ce6c1cf8b002ffbbbf0b0e6f0b8f13b525ee

Contents?: true

Size: 797 Bytes

Versions: 5

Compression:

Stored size: 797 Bytes

Contents

module Admin
  module TranslationsHelper
  
    def display_available_locales
      I18n.available_locales.map{|locale| t("translations.locales.#{locale}") }.join(", ")
    end
  
    def display_translation_if_exist(translation)
      other_locales = I18n.available_locales - [translation[:locale].to_sym]
      other_locale = other_locales.first
      if other_locale
        other_translation = Translation.find_by_key_and_locale(translation[:key], other_locale)
        if other_translation
          html = "<p>#{other_translation.value}</p>"
        else
          html = "<p class='no_translation'>#{t('translations.no_translation')}</p>"
        end
      else
        html = "<p class='no_translation'>#{t('translations.no_translation')}</p>"
      end
      raw html
    end
  
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
merrycms-0.1.7 app/helpers/admin/translations_helper.rb
merrycms-0.1.4 app/helpers/admin/translations_helper.rb
merrycms-0.1.2 app/helpers/admin/translations_helper.rb
merrycms-0.1.1 app/helpers/admin/translations_helper.rb
merrycms-0.1.0 app/helpers/admin/translations_helper.rb