gettext style translations for the MyPlay platform.
MP::Translations
provides a UI for managing translations and backends that allow applications to use them.
It was designed around Ruby's I18n, but translations can be retrieved by any client.
Translation modifications are pushed to Redis and saved to the database (I18n is used to push the translations to Redis).
Translations can also be exported to gettext PO files.
Translations are saved in Redis using the following keys:
language."text"
Where language
is an ISO 639-1 language code and "text"
is the source translation.
For example, if the English source text "The rats sleep in the subway" was translated into Portuguese and Spanish the following keys
would be created:
es."The rats sleep in the subway"
pt."The rats sleep in the subway"
TODO: escaping quotes and "."
There's a thor
task for this
TODO; for now See config/schema.rb
You need a MySQL database.
git clone git@github.com:rgenerator/mp-translations.git
cd mp-translations
cp config/database.yml.default config/database.yml
- Add DB connection info to
config/database.yml
- Install Redis (optional -but recommended)
bundle install
bundle exec rails s
Capistrano is used for deployments.
- Install Redis somewhere that can be accessed by
MP::Translations
- Edit
config/initializers/translation_cache.rb
(should not be required unless there's a server change) - Edit
config/deploy/production.rb
(orstaging.rb
, ... should not be required unless there's a server change) - Deploy from the build server as the build user (or elsewhere):
cap production deploy # or staging