TranslationsSync

This plugin 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’

Installation

  1. As plugin

rails plugin install http://github.com/dima4p/translations_sync/
  1. As gem

sudo gem install translations_sync
translations_sync

Description

There are two rake tasks implemented in the plugin.

  1. rake translations:sync

This task generates the files with missing translations in the directory config/locales. One file per a locale is created with the name missing_#locale.yml Each file contains the text of one of the existing locales, namely the first one existing. The order to check is defined by the LIST parameter. This parameter can also be used to add a new locale. The parameter EXCLUDE may be used to extract one or more locales from the participation in the process. If any locale is mentioned in both lists, it will not participate in the calculation of the missing translations but it’s value may be used in the sample translation. The parameter NAME allows you to write the missing translations to the specified files instead of default ‘missing’. The parameter SOURCE allows you to restrict the synchronization to be done within only one file name. Only the files for all the locales that meet the given name will be loaded for the synchronization. The parameter IN sets both NAME and SOURCE to its value.

  1. rake translations:singles

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

  1. 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’.

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

This task removes the key from the translations. NAME defalts to ‘removed’ here.

So far it works only for rails applications. Suggestions for others are welcome.

Copyright © 2010-2011 Dmitri Koulikoff, released under the MIT license