Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

ahandsel
ahandsel

Posted on • Edited on • Originally published atgithub.com

     

Phrase CLI Debug locale_mapping Error

Thelocale_mapping parameter is required when using thephrase push command to upload a CSV file to update a Phrase Strings project.

Table of Contents

Problem

When using thephrase push command to upload a CSV file to update a Phrase Strings project, I kept encountering the following error:

API response: {"message":"Validation failed","errors":[{"resource":"Upload","field":"locale_mapping","message":"You must provide a locale_mapping parameter."}]}ERROR: 422 Unprocessable Entity
Enter fullscreen modeExit fullscreen mode

Solution

Contrary to what the Phrase StringsUpload a new file API documentation suggests, thelocale_mapping parameter is mandatory when using thephrase push command with a CSV file.

Here is the correct configuration for the.phrase.yml file:

phrase:access_token:#access_tokenproject_id:#project_idfile_format:csvpush:sources:-file:./upload-translations.csvparams:file_format:csvlocale_mapping:{"en":"2"}pull:targets:-file:./<locale_name>-translations.csv
Enter fullscreen modeExit fullscreen mode

How to Configurelocale_mapping Parameter

Below is a snippet from the.phrase.yml template file:

locale_mapping:{"LANGUAGE_CODE":"COLUMN"}(object)#Optional, format specific (Excel, CSV) mapping between locale names and the columns the translations to those locales are contained in.
Enter fullscreen modeExit fullscreen mode

In my case, I had to map theen locale to the2 column in the CSV file.

locale_mapping:{"en":"2"}
Enter fullscreen modeExit fullscreen mode

If you need to map multiple locales, you can configure it as follows:

locale_mapping:{"en":"2","ja":"3"}
Enter fullscreen modeExit fullscreen mode

Warning - Plural Forms

⚠️Warning: If you are working withplural forms, ensure you use the correct plural suffixes for each language specified in thelocale_mapping parameter.

For example, English and Japanese have different plural forms:

  • For English, usezero,one, andother.
  • For Japanese, usezero andother.

Adding a Japanese translation for theone plural form generates a new key instead of updating the existing key for theother plural form.

Background & Environment

  • Phrase CLI version: 2.23.2
  • Device:
    • ProductName: macOS
    • ProductVersion: 14.4.1
    • BuildVersion: 23E224

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Developer Advocate and UX writer working on the product and API documentation.Based in Tokyo 🗼. Either writing or hiking 🥾
  • Location
    Tokyo
  • Education
    University of California, Santa Cruz
  • Work
    Developer Advocate at Kintone
  • Joined

More fromahandsel

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp