Xcstrings requires language placeholder in crowdin.yml config?

I’m trying to add a strings catalog to our project using the Crowdin CLI. My crowdin.yml looks like this:

project_id_env: CROWDIN_PROJECT_ID
api_token_env: CROWDIN_PERSONAL_TOKEN
preserve_hierarchy: true

files:
  - source: /ios/InfoPlist.xcstrings
    dest: /ReactNative/InfoPlist.xcstrings
    translation: /ios/InfoPlist.xcstrings

When I run

crowdin upload --token $CROWDIN_PERSONL_TOKEN --project-id $CROWDIN_PROJECT_ID --dryrun

I get this:

❌ Configuration file is invalid. Check the following parameters in your configuration file:
	- The 'translation' parameter should contain at least one language placeholder (e.g. %locale%)

If I remove the translation key, I get an error about it being required. This file contains all the translations, so I don’t know why I would have to specify a language placeholder. What should I do to get this to work?

FWIW, I’m using cli version 4.3.0.

Hi @kueda ,

Checking everything with the team and will get back to you as soon as possible.

Hi @kueda, in case of xcstrings file format, you need to specify additional multilingual flag in crowdin.yml configuration.

Please refer to the Multilingual Files section of the CLI documentation.

Thanks, that does work. However,

  1. I think the docs should say “you must use the multilingual option” b/c without it you get this error
  2. I think the error should say that the translation parameter must include at least one language placeholder OR you must set multilingual: true for multilingual files.

I mean ideally it would just detect that I’m using a multilingual file format and just not require that extra configuration.

Hello @kueda, thanks for your feedback. We would consider it for the future.

@dima, possibly related: I am trying to download the translations for that file now and I keep getting this error:

⚠️  Due to missing respective sources, the following translations will be omitted:
	- ReactNative/InfoPlist.xcstrings

My source looks like this:

  - source: /ios/InfoPlist.xcstrings
    dest: /ReactNative/InfoPlist.xcstrings
    translation: /ios/InfoPlist.xcstrings
    multilingual: true

but the “Resulting file after translation export” setting on the website is ios/InfoPlist.xcstrings (no leading slash), even though I have used crowdin upload to upload my local changes to the config file. When I try to change this value on the website, I get this error:

I don’t see a way to mark this file as multilingual: true on the website. What am I doing wrong here?

What exactly call are you using? Download language or download project translation?

The dest parameter allows you to specify a file name in Crowdin. Your error says that there are no sources under ReactNative/InfoPlist.xcstrings, have you tried running the command for /ios/InfoPlist.xcstrings?

I ran

crowdin download --token $CROWDIN_PERSONL_TOKEN --project-id $CROWDIN_PROJECT_ID --skip-untranslated-strings --export-only-approved --language he  

but I get the same result with

crowdin download --token $CROWDIN_PERSONL_TOKEN --project-id $CROWDIN_PROJECT_ID

The file exists at /ReactNative/InfoPlist.xcstrings on Crowdin:

There is no file at /ios/InfoPlist.xcstrings on Crowdin or in my repo so no, I have not tried that because there is no such file.

Again, it may be that “Resulting file after translation export” is wrong, because for strings.ftl it has a leading slash, but when I try to change that for InfoPlist.xcstrings, I get the error message above.

Hi @kueda,

We will check from our side

@kueda there is a known issue with the dest option and multilingual formats used together - Failed to download multicolumn spreadsheet file translations with the dest parameter · Issue #486 · crowdin/crowdin-cli · GitHub

If possible, try not to use the dest option in this case until the issue is resolved.

If I don’t use the dest option I think it’s going to write the file to the same path it uses in the repo, correct? That’s not ideal b/c it will be confusing to have one of our React Native translation files in a folder meant for another app, but I guess we can live with it until you fix that issue. So in this case, it would create an ios folder on Crowdin to match /ios/InfoPlist.xcstrings? Translators have already started translating the file at /ReactNative/InfoPlist.xcstrings and I don’t want to lose their work. What will happen if I move the file to that location before running the script? Will the translations and the record of who added them be preserved, along with comments and issues and such?

Hi!
You would need to wait for the release of the fix to use the dest with the .xcstrings file.

Now, you can keep translating your file, but not syncing it back. After the dest is fixed, you’ll be able to either pre-translate the correct file via TM (this way you’ll be an author of added translations) or move translations to the new file this way:

  1. in the Project settings > Import tab enable the option for duplicates to Hide (regular detection) - all duplicates will share the same translation
  2. after you sync the correct content, a newly uploaded file should automatically receive translations from the already translated master file because of the duplicate option
  3. after you verify that translations are moved successfully, you’ll be able to delete the old file