kete_translatable_content

Kete Translatable Content is a gem that is an add-on for Kete web applications that takes advantage of the mongo_translatable gem’s functionality. As you would expect, you use it to add the ability to translate content in your Kete web site.

Obviously, your site should be set up to support to support multiples locales for this add-on to be useful. See below for details.

Usage

Currently only tested against Rails 2.3.5. When Kete moves to Rails 3, this gem will be updated to.

As you would expect, multiple locale support is only necessary if your site is set up to support multiple locales. Update config/locales.yml and config/locales/ appropriately for the locales you want to support. See here for details:

kete.net.nz/documentation/topics/show/289-using-translate-plugin-to-translate-your-kete-installation

You’ll want to review the mongo_translatable gem’s installation details for steps to install MongoDB, etc.

github.com/kete/mongo_translatable

Then install the needed gems:

gem install mongo_translatable kete_translatable_content

After installing the gem do the following to add kete_translatable_content to your app:

In the Rails::Initializer.run config block config/environment.rb:

config.gem "mongo_translatable"
config.gem "kete_translatable_content"

Create the file config/initializers/mongo_mapper.rb and put this in it:

MongoMapper.database = 'your_app'

Now you need to run the migration generator to add the columns that kete_translatable_content needs to work. Do this in your Kete application’s root directory.

$ script/generate kete_translatable_content_migration
$ rake db:migrate # add environment if necessary, i.e. rake db:migrate RAILS_ENV=production

Next you’ll need to update the system settings that are translatable from the console:

$ script/console # production if need be > SystemSetting.update_translatables

It’s a good idea to generate the tests and run them before proceeding:

$ script/generate kete_translatable_content_tests
# Run you normal Kete tests
$ rake test

Note some tests may fail, as they have functionality that is overridden that will return a different result than the test expects (unit/oai_dc_helpers_test.rb has several). You may want to adjust your tests accordingly.

If the tests run ok, restart your application and it should be ready to use from the web interface.

Your tests should also now include testing for the kete_translatable_content add-on.

Lastly you will want restart your Kete server and backgroundrb:

$ touch tmp/restart.txt $ script/backgroundrb stop … $ script/backgroundrb start

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix to a branch following this convention: enhancement_[ticket #]_short_description or bugfix_[ticket #]_short_description replace [ticket #] with ticket number from kete.lighthouseapp.com/projects/61585-kete_translatable_content

  • Add tests for it. This is important so we don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request.

Copyright © 2010 Horowhenua Library Trust. See LICENSE for details.