0.01
No commit activity in last 3 years
No release in over 3 years
Plugin for active admin which allows to easy modify I18n translations
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

ActiveI18n

ActiveI18n is an translation panel designed to work inside an activeadmin.

Gem Version Code Climate Build Status RST RST

how it looks:

ActiveAdmin and Rails version

This library was tested only on rails 3.2.x. with activeadmin 0.6.x. If you would like to use it with 4.x rails version - just let me know I will port it.

Prerequisites

  1. activeadmin gem
  2. active_skin gem (optional for better looking)

Installation

0. make sure you have activeadmin installed
1. add gems to your gemfile:
# gemfile
gem "activeadmin", "~> 0.6.3"
gem "active_skin" #for better looking
gem "active_i18n"
gem "haml" # because aa views are in haml
gem "redis" # when you are using Redis as a translations store

and then run: bundle install

2. add rails initializer

create file active_i18n.rb in config/initializers

# config/initializers/active_i18n.rb
ActiveI18n.config(
  store: I18n::Backend::KeyValue.new(Redis.new),
  except: ["testtranslationkey", "date", "datetime"]
)

store: sets translation store (in this example redis database - required) except: removes some of the keys from the sidebar menu (optional)

If you are using redis you also will need to run the redis server redis-server in console

3. define languages to translate

now having everything set up you could narrow the list of available languages and select base locale (if you don't - your users will see in selectboxes list of all available locales). You will do this in application.rb

config.i18n.default_locale = :en
config.i18n.available_locales = [:en, :pl, :de] #placing :en again allows users to change default texts on your website
4. add translation to the active admin menu

in your app/admin folder create new file called translations.rb (or whatever)

ActiveAdmin.register_translation "Translations", 
  :parent => "CMS",
  :priority => 2, 
  :label => "Translations"

hash is the same as in menu function in ActiveAdmin.

5. add css and js

inside active_admin.js add active_i18n:

...
//= require active_admin/base
...

//= require active_i18n

and inside active_admin.css.scss also add active_i18n:

...
@import "active_admin/mixins";
@import "active_admin/base";
@import "active_skin";
...

@import "active_i18n";
and you are ready to go

Contributing

  1. Fork it ( http://github.com/rstgroup/active_i18n/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request