Repository is archived
No commit activity in last 3 years
No release in over 3 years
I18n backend, based on redis, with frontend panel for translations
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0.4.0
>= 0
>= 2.0.0.beta

Runtime

>= 3.0.0
 Project Readme

TranslationPanel

Using with Redis:

  • Add gem ‘translation_panel’ in your Gemfile
  • 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
  • Wrap your translations in span with ‘data-tranlation-key’ attribute, if you
    want to highlight your translation, and edit-on-click. Eg (in haml format):

    %span{:data => {'tranlation-key' => "some.key"}}
        = t("some.key")

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 backend 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