- Search by key
- Search for text translation
- Adding and editing languages
- Adding and editing keys
- Remove language or key
install gem
gem 'rails-i18n'
gem 'multilang', github: 'kelevro/multilang'
for using redis
backend (optional)
gem 'redis'
add to routes.rb
mount Multilang::Engine => '/multilang'
if you need authorization
authenticate :admin do
mount Multilang::Engine => '/multilang'
end
create initializer
rails g multilang:install
run migrations
rake multilang:install:migrations
rake db:migrate
In
config/initializers/multilang.rb
edit
config.root_path
- url for return main app
config.force_export
- if set true
will export after each save translation
config.backends
- backends list. Available [:file, :redis]
. :file
- always enable
for example
Multilang.configure do |config|
config.root_path = :admin_path
config.force_export = true
config.backends << :redis
end
For cofigure redis backend edit config file config/multilang.yml
for example
development: &default
redis:
host: 'localhost'
port: 6379
db: 0
password: ''
namespace: 'multilang'
test:
<<: *default
production:
<<: *default
After adding translations to your locales files you can run
rake multilang:pull path=config/locales
after thet all your tralslations will be available in multilang console. If in console key already exists this key will be skip. If you want override translation in console you can run
rake multilang:pull force
rake multilang:pull
- pull to console all translation from your project
add to Capfile
:
require 'multilang/capistrano'
usage:
get locales cap production multilang:get_locales
set locales cap production multilang:set_locales
- Remove Rails dependency