Rails PhraseApp Setup for Ruby I18n
This guide will lead you through the integration of PhraseApp into your Ruby on Rails application.
- Install the PhraseApp command line client
- phraseapp init
- phraseapp push
- phraseapp pull
Note: This guide assumes you have signed up for a PhraseApp account and set up your first project. See the getting started guide for more information.
To initialize the project configuration, just follow the instructions to initialize the PhraseApp command line tool:
$ phraseapp init
This will guide you through the necessary steps to configure your sources and targets for your project. Make sure you select
yml as your locale file format.
Assuming you have stored your existing localization files in the default location at
./config/locales uploading your data to PhraseApp is easy. Just execute the
$ phraseapp push
All existing localization files found in your source path will be uploaded to your PhraseApp project. Log into Translation Center to see your existing translations and add new languages or keys.
Once you have finished working on your translation in Translation Center or the In-Context Editor, you might want to download the data back into your project. This can be done by executing the
$ phraseapp pull
If you downloaded your localization files to a folder other than
./config/locales you might need to configure the i18n load path of your application so that the new localization files can be accessed. To do so, open the
development/staging/production.rb and add the configuration:
config.i18n.load_path += Dir[Rails.root.join('custom', 'locales', '**', '*.yml').to_s]
This assumes you downloaded the localization files to
After restarting your application, the new files you downloaded from PhraseApp should be visible in your application.
If you want to write your own workflow using the PhraseApp API, you can use our
phraseapp-ruby gem to your application by adding it to your
group :staging, :development do gem 'phraseapp-ruby' end
and install it using the
$ bundle install
Learn how to work efficiently with PhraseApp in this getting started guide.
When localizing a web application we recommend using the In-Context Editor. See this guide for installation instructions: In-Context-Editor Documentation