TranslationPanel

Using with Redis:

  • Run redis-server
  • Set up redis connection settings and register RedisTranslator::Backend as i18n backend in initializers:

    I18n.backend = TranslationPanel::RedisBackend.new(Redis.new)
    # or in chain with another backend
  • Create predicate method translation_panel? in ApplicationController, define in it, when panel can be shown and when translates can be saved. By default always.

    def translation_panel?
      params[:translator].present?
    end

Dependencies

TranslationPanel uses assets, scss, coffeescript, as all its work in Rails 3.1.

If you want to use panel with Rails 3.0, you need to use sprockets gem. Also you need at least i18n-0.6.0 for proper work with i18n keys

Pluralization

Redis backen? support pluralization.

1. You need to use Simple backend with included I18n::Pluralization in chain:


    I18n::Backend::Simple.include I18n::Backend::Pluralization
    redis_backend = TranslationPanel::RedisBackend.new(Redis.new)
    I18n.backend = I18n::Backend::Chain.new(redis_backend, I18n::Backend::Simple.new)

2. You need to add in config/locales/*.yml files rules for pluralization:


    i18n:
      plural:
        keys:
          - one
          - other