Giter Site home page Giter Site logo

multilang's Introduction

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

multilang's People

Contributors

kelevro avatar hanzha-dmitriy avatar

Watchers

James Cloos avatar Dmitriy Ganzha avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.