Keeping multiple Phrase projects for one localization project

This guide describes how to use multiple projects in Phrase to keep your growing localization project manageable.

As software projects grow and become more complex it helps to split them into modules to keep things manageable. The same holds true for the localization of software projects. You may want to limit the scope of your Phrase projects by splitting the translations into smaller categories, like frontend and backend for example.

Workflow

  1. Create your projects in Phrase: For our example we will have the project “Frontend” and the project “Backend”.
  2. Create source locale files that correspond to the projects in Phrase.
  3. Create a CLI tool configuration that includes the locations of the source locale files in your project and match them to the corresponding Phrase projects:
phrase:
  access_token: "3d7e6598d955bfcabaf1b9459df5692ac4c28a17793"
  file_format: yml
  push:
    sources:
    # frontend
    - file: ./path/to/locales/frontend/en.yml
      project_id: "5c05692a2a995c0c45c0c3cbfcab1"
      params:
        locale_id: "159d48e76802f789d9b8fb6d368e61bc"

    # backend
    - file: ./path/to/locales/backend/en.yml
      project_id: "0c45c0c3cbfcab15c05692a2a995c"
      params:
        locale_id: "fb6d368e61bc159d48e76802f789d9b8"
  pull:
    targets:
    # frontend
    - file: ./path/to/locales/frontend/<locale_name>.yml
      project_id: "5c05692a2a995c0c45c0c3cbfcab1"

    # backend
    - file: ./path/to/locales/backend/<locale_name>.yml
    project_id: "0c45c0c3cbfcab15c05692a2a995c"

 

Providing a config via --config flag

By default, the CLI will try to use a file called .phrase.yml on the same level at which phrase is run. To support more complex workflows, it is possible to use multiple configuration files for different purposes. 
To force the CLI to use a configuration file for certain commands, please supply the corresponding .yml file via the --config flag like this:

$ phrase push --config ./path/to/config.yml