Rails PhraseApp Setup for Ruby I18n
- 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.
1. Install the PhraseApp command line client
2. Configure the command line tool for your project
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.
3. Upload locale files
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.
4. Download locale files
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
Optional: Add your custom locale download directory to your i18n load path
If you downloaded your localization files to a folder other than
./config/localesyou 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 ./custom/locales.
After restarting your application, the new files you downloaded from PhraseApp should be visible in your application.
Optional: Install the phraseapp-ruby gem
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
and install it using the
$ bundle install
Where to go from here?
Working with PhraseApp
Learn how to work efficiently with PhraseApp in this getting started guide.
Enable In-Context Editor
When localizing a web application we recommend using the In-Context Editor. See this guide for installation instructions: In-Context-Editor Documentation