Skip to content

Helps the developer to synchronize the different locales for the project

License

Notifications You must be signed in to change notification settings

dima4p/translations_sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TranslationsSync
================

This gem is intended to help the developer to synchronize the different
locales for the project that uses yaml based locales, in particular, I18n.


Requirements
------------

    gem 'ya2yaml'
    gem 'active_support'

Installation
------------

1. Add to your Gemfile

    gem 'translations_sync'

2. If you are using the gem without bundle just install it

    gem install translations_sync


Description
-----------

This gem allows different organizations of translation files. They can be
grouped in the directories that correspond to locales, or the locale
may be defined in the suffix of a file name separated by a dot or underscore.
Let us call the file name without locale suffix and extension as
**base name**

When a file name is to be given as parameter in the description below
it should not include nor locale prefix, nor locale suffix and extension
whichever organization is used.

The main goal of the gem to assist in managing the translations for the
project. This can be done by using the `rake` tasks described below.

The following parameters can be given:

* `LIST=comma,separated,list` specifies the locales that should
participate in synchronization.
For example, `LIST=en,de,fr,zh-CN`
If omitted, I18n.available_locales will be used.
The order of the locales is important as the existing for the first
locale in the list will be provided for a missing translation(s).
The locale in LIST must not be present in I18n.available_locales.
This allows easily to add new locales to the project.
* `EXCLUDE=comma,separated,list` specifies the locales that should NOT participate.
* `NAME=name`. By default missing translations are written to the
**base name** "missing".
This parameter tells to use the given name as **base name**.
If any of the corresponding files exist, the missing translations will
be added to them.
* `SOURCE=name`. Only files with the given **base name** will be considered.
* `GEMS=list`. When `SOURCE` is in effect additionally the translations from
the listed gems will be included.
* `IN=name`. It is equivalent to `NAME=name SOURCE=name`
* `KEY=path.to.key`. Points to the key to be moved or removed.
Obviously, it should not include locale.
* `TO=path.to.key`.

Rake tasks
----------

### rake translations:sync

This task verifies that all the translation keys are present in all
files specifed by the given parameters and if any is missing creates/updates
corresponding file(s).

### rake translations:singles

This task generates a single file config/locales/singles.yml that contains the
translations occurring only in one locale.

### rake translations:move KEY=key.to.move TO=where.to.move

This task moves the content of given KEY under the TO.
You can use all the parameters available for the translations:sync task
with the default value for the NAME equal to 'moved'.

### rake translations:remove KEY=key.to.remove

This task removes the key from the translations. NAME defaults to 'removed' here.


Copyright (c) 2010-2016 Dmitri Koulikoff, released under the MIT license

About

Helps the developer to synchronize the different locales for the project

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages