Examples of more complex ways of using the Phrase Client

View examples of more complex ways to use the Phrase Client.

Multiple localization files for one project

It’s usually best to use one file for each locale in your project. If your tools or framework force you to use multiple files, refer to the guide on structuring localization files for details on how to set up your project.

Multiple Phrase projects for one localization project

When working on a large localization project, you may find it more manageable to distribute your translations over multiple Phrase projects. Learn how to configure your CLI to work with multiple localization files for one localization project.

Using format options

Some file formats let you specify format options for greater control over the syntax of your files. You can specify format options in your .phraseapp.yml configuration file, like this:

phraseapp:
  pull:
    targets:
    - file: file.xml
      params:
        format_options:
          convert_placeholder: true

  push:
    sources:
    - file: file.csv
      params:
        format_options:
          column_separator: ";"

All available format options for each format are listed in the format guide.

Configuration for Android projects

It’s best to specify each locale explicitly in your .phraseapp.yml file. This example shows how .phraseapp.yml should look with English as the default language, a German locale, and a German region locale for Austrian German:

phraseapp:
  access_token: 930dfe3c2736d745c610c46b3d050b5526a45fcs5d01d007e5103a481f9a40cs
  project_id: 3dbc6dc4d79eaa48a7af7ebc7ea12ef5
  file_format: xml
  pull:
    targets:
    - file: ./app/src/main/res/values/strings.xml
      params:
        file_format: xml
        # Unique locale id for English
        locale_id: 17326bf9e3eb422fe1a33bb2faas7af1
    - file: ./app/src/main/res/values-de/strings.xml
      params:
        file_format: xml
        # Unique locale id for German
        locale_id: 273dxbf9e3eb422fe1a33bb2fad87af1
    - file: ./app/src/main/res/values-de-rAU/strings.xml
      params:
        file_format: xml
        # Unique locale id for Austrian
        locale_id: 37326bf9e3eb422fe1a33bb2fad87aas
  push:
    sources:
    - file: ./app/src/main/res/values/strings.xml
      params:
        file_format: xml
        locale_id: 17326bf9e3eb422fe1a33bb2faas7af1
    - file: ./app/src/main/res/values-de/strings.xml
      params:
        file_format: xml
        locale_id: 273dxbf9e3eb422fe1a33bb2fad87af1
    - file: ./app/src/main/res/values-de-rAU/strings.xml
      params:
        file_format: xml
        locale_id: 37326bf9e3eb422fe1a33bb2fad87aas

Note: Android doesn’t use the standard ISO language codes as the file pattern. You should specify the required pattern in .phraseapp.yml. For more information about this, refer to the Google Developer Documentation.