Ruby on Rails

Ruby on Rails has built-in support for internationalization (i18n). This makes it easy to localize your website using YAML files and the Transifex Client. You can also use Transifex Live, our JavaScript based technology. Transifex Live is well suited for websites that have content stored in the database and lets translators work in-context, increasing the overall translation quality.

Below, you'll find instructions for localizing your website using either method – Ruby on Rails's i18n support or Transifex Live.

Localize with Ruby on Rails's built-in i18n support

Before getting started, you'll want to follow the Ruby on Rails documentation and internationalize your website. Once you have done this, there will be at least one source file under a path that looks like myapp/config/locales/en.yml, assuming English is your source language.

The source file will be the foundation for setting up the Transifex Client, which lets you send and receive files over Transifex's REST API. In order to set up your Transifex Client configuration, you first need a project in Transifex and the Transifex Client installed .

After finishing all the steps above, follow the set of commands below to set up your repository configuration in a file called .tx/config. In this example, we named our project in Transifex mytxproject.

$ git clone http://git.example.com/git/myapp.git
$ cd myapp
$ tx init
$ tx add \
    --file-filter=config/locales/<lang>.yml \
    --type=YML \
    --organization=organization-1 \
    --project=mytxproject \
    --resource=default_yml \
     config/locales/en.yml

You should commit the .tx/config file to your repository so the next time you want to push new source content, you can simply use the following commands

$ cd myapp
$ tx push -s

Plurals

To learn more about how Transifex handles plural forms in Ruby on Rails applications, please consult our documentation guide here.