-
Notifications
You must be signed in to change notification settings - Fork 6
Multiple Locales
This page describes possible support for multiple locales in Text Tractor, and what would be necessary to implement that.
The client side of Copycopter already supports multiple locales, and will synchronise all locales that exist within a Rails application, so assuming that works correctly users of Text Tractor will be able to continue using the official client gem.
Currently Text Tractor stores all translations in a single Redis set, keyed by the names that they are referred to within the Rails application, such as en.application.home.title. In order to support multiple locales it would make sense to have the definitive source for each translation be a hash instead, containing the original source translation from the application, as well as versions of it for all supported languages.
Changes to those hashes would then result in the cached set of translations sent to the application being updated to ensure responses remain as quick as possible.
A Rake task will be included to allow migrating earlier versions of the data into the new format.
Changes would need to be made to the user interface to allow editing of multiple locales. The way I currently see that is to replace the "Projects" navigation option which currently exists with a pair of drop down lists, the first of which would allow selecting the project, and the second selecting the locale you wish to work with.
Each project will allow setting the default locale, which would probably be set to the same value as in the Rails application. If no locale is explicitly selected then the default will be used instead.
## Translating ##
The interface for editing the default locale will remain much as it is now, with a simple list of keys and editable values.
If the user switches to a non-default locale then as well as the key and value the default locale's version of that key will also be displayed so that the user can see what exactly they should be translating.
When viewing a non-default locale the status of a translation will be indicated using an icon, with each translation having 3 possible states:
| Untranslated | The phrase has never been translated into the current locale. |
|---|---|
| Translated | The phrase has been translated into the current locale. |
| Stale | The phrase has been translated into the current locale, but since then the default locale's version of the phrase has been changed. |
Making use of those states a translator could then filter the list of translations to show them only phrases that need to be either translated, or reviewed for possible changes.