How do I specify a mixture of %two_letter_code% and %locale_with_underscore% directories in crowdin.yml?

I maintain a Thunderbird extension which uses the same i18n system as Firefox, so my source file is _locales/en/messages.json and my translations are the other _locales/*/messages.json files.

Most of the directories underneath _locales use the two-letter code as the directory name, but there are a couple that don’t, when there are multiple translations for the same language. For example, I’ve got both pt and pt_BR, and both zh and zh_TW underneath _locales.

I’m trying to figure out how to specify that appropriately in my crowdin.yml. Right now what I’ve got is this:

"files": [
  {
    "source" : "/_locales/en/messages.json",
    "translation" : "/_locales/%two_letters_code%/messages.json"
  }
]

I think if I use just this, then pt_BR and zh_TW won’t be translated. However, I think if I replace %two_letters_code% with %locale_with_underscore%, then all the other locales that only use the two-letter code won’t be translated.

Do I just list both, i.e., this?

"files": [
  {
    "source" : "/_locales/en/messages.json",
    "translation" : "/_locales/%two_letters_code%/messages.json"
  },
  {
    "source" : "/_locales/en/messages.json",
    "translation" : "/_locales/%locale_with_underscore%/messages.json"
  }
]

Will that work, or will that break something? If it won’t work, what’s the right way to do this?

Thanks.

Hello,

I recommend utilizing the initial configuration example provided below:

"files": [
  {
    "source" : "/_locales/en/messages.json",
    "translation" : "/_locales/%two_letters_code%/messages.json"
  }
]

Subsequently, you can proceed to the project settings, then navigate to Languages and Language mapping. Here, you’ll be able to specify the two-letter language codes for “pt_BR” and “zh_TW”:

1 Like