Skip to content
zoombody edited this page Sep 14, 2014 · 1 revision

Translating Tracks

Translating Tracks into another language is not very difficult, does not require you to be a developer and can be done from your web browser.

Overview

In general the steps are:

  • get a copy of Tracks
    • either make a copy of your running tracks (to make sure you always have a working version)
    • or get it from git using git clone https://github.com/TracksApp/tracks.git
  • Make sure the database is current: bundle exec rake db:migrate
    • this will require you to configure a database in config/databases.yml for the development environment. To be safe, do not use your production database, but use a copy of your database or make backups!
    • Furthermore for languages that require special character sets like Hebrew, configure the correct character set both in config/database.yml and for your database (i.e. in /etc/my.cfg for mysql). Mysql uses latin1 by default and that won’t work for Hebrew.
  • Import the existing translations into the Tolk database: bundle exec rake tolk:sync && bundle exec rake tolk:import
  • launch the built-in Tracks server in development mode:
    • bundle exec rails s
    • this will run tracks on localhost on port 3000
  • Point your browser to http://localhost:3000/tolk
    • Select the language you want to work on or create a new one
    • When you are done, dump the languages back to the YAML files
      • bundle exec rake tolk:dump_all will write all changes to the locale .yml files in /path/to/tracks/config/locale. You can then test it on http://localhost:3000
      • Or: download the locale file: http://localhost:3000/tolk/locales/XX.yml where XX is the name of your locale (for example nl or de or cz)

Some pages need to be translated manually:

  • app/views/integrations/index.en.html. Create an index.XX.html in this directory with XX being your language
  • Same goes for app/views/data/index.en.html and yaml_form.en.html

For the datepicker in the edit and new todo form, you need to add a translation file in public/javascripts/i18n. They can be found in http://jqueryui.com/demos/datepicker/#localization which references the following repository of translations: http://jquery-ui.googlecode.com/svn/trunk/ui/i18n/

Help and troubleshooting

  • you can switch languages by changing the URL on every page
    • http://localhost:3000?locale=nl will switch to dutch.
    • if your page gives errors, first check with locale=en if the error is caused by your language changes. Remember that auto translate can mess up parameters, sometimes putting a space between $ and {param} and sometimes translating the name of the parameter!
    • see the i18n documentation for rails for more technical details http://guides.rubyonrails.org/i18n.html
  • if you see a question mark (?) instead of a special language character, there is most likely a wrong encoding setting somewhere. I had latin1 for my character set in mysql preventing special characters to be imported correctly by Tolk. Beware that you need to alter the tolk_* tables to have utf-8 as its encoding. Also be aware that you need to update the character set of the TEXT field in the tolk-* tables too!

Getting your changes into the next release

  • the easiest for the maintainer of Tracks is to create a clone of Tracks on GitHub, merge your changes and issue a pull request.
    • make sure you only add your changes needed for the translation
Clone this wiki locally