Skip to content

meshumi/multilang

 
 

Repository files navigation

Multilang

Build Status

Multilang This gem provides a web interface for managing translations for your website

It allows:

  • Search by key
  • Search for text translation
  • Adding and editing languages
  • Adding and editing keys
  • Remove language or key

Install

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

Configure

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

Configure redis backend

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

Usage

Usage

Export translaitons keys

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

Export/Import translaitons keys with capistrano

add to Capfile:

require 'multilang/capistrano'

usage:

get locales cap production multilang:get_locales

set locales cap production multilang:set_locales

TODO

  • Remove Rails dependency

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CSS 40.7%
  • Ruby 38.8%
  • JavaScript 10.1%
  • HTML 8.6%
  • CoffeeScript 1.0%
  • SCSS 0.7%
  • Slim 0.1%