CLI download: Existing translation overwritten by source

Project setup

In my Android project I prepared the following configuration file:

# Required by CLI
base_path: .
preserve_hierarchy: true

files:
  - source: /app/src/main/res/values/preferences.xml
    translation: /app/src/main/res/values-%android_code%/%original_file_name%
    languages_mapping:
      android_code:
        es-ES: es
  - source: /app/src/main/res/values/strings.xml
    translation: /app/src/main/res/values-%android_code%/%original_file_name%
    languages_mapping:
      android_code:
        es-ES: es

Initialization

I used the following command to upload source files:

$ crowdin upload --verbose -i PROJECT_ID -T API_TOKEN
✔️  Fetching project info     
✔️  File 'preferences.xml'
✔️  File 'strings.xml'

Additionally, I uploaded existing Spanish translation via the web interface:

Download

I used the following command to download only Spanish translations:

$ crowdin download -v -l es-ES -i PROJECT_ID -T API_TOKEN
✔️  Fetching project info     
✔️  Building ZIP archive with the latest translations for 'es-ES'
✔️  Building translation (100%)   
✔️  Downloading translations     
✔️  Extracting archive     
✔️  Extracted: 'app/src/main/res/values-es/preferences.xml'
✔️  Extracted: 'app/src/main/res/values-es/strings.xml'

So far everything seems to be working. Files are written to the correct folders.

Question

When I look at the downloaded files I am badly surprised. All existing Spanish translations are replaced with English strings from the source files.
Where is the configuration or usage mistake?

Is the UI build and download button work? From translation page → build and download the project. If all suggestions are replaced by source that it’s either not build, or something with export settings / configuration settings.

Try the UI approach just to see whether things are build and downloaded. I suggest simple build and download into a .zip and unpacking it. Maybe it’s something with translation, like system says they were uploaded but the progress is 0 because they werent recognized.

The “Build & Download” button works technically. The downloaded ZIP archive however contains English strings only.


Upload scenario 1 (individual files)

The issue seems to be that the upload form does not recognize the Spanish source folder when I pick individual files:

Upload scenario 2 (ZIP with folder structure)

When manually recreate the folder structure, put the folders and files in a ZIP archive, then it looks better:

The pull request branch does not change.
The “Build & Download” archive contains Spanish translations - within a values-es-rES folder, though. The languages_mapping in the configuration file seems to be ignored by the export feature.

The upload procedure I made does not seem very user friendly. How am I supposed to use this feature?

I assume mapping is not saved here.

Try both uploading sources via CLI + uploading translations via CLI.

Also, language mapping map language codes only. You still should received the translated file that is valid and ready to work.

By the way, try checking the file export pattern in Crowdin UI (files tab → settings of file). Maybe it’s different to the one you’ve used in CLI.

So, just to me get you right, do you have you Spanish translation if build and download file from UI?
If yes, then it’s only related to CLI or configuration. Try testing some others configs, maybe with separation of translation path, so translation for Preferences and Strings are holded on a different levels folders.

Try both uploading sources via CLI + uploading translations via CLI.

I followed your advice. I downloaded translations via CLI as well.
If I do this then I end up with the correctly translated strings locally.
I have to ignore what is shown in the web UI and what is happening in the merge/pull request branch though - which is otherwise very confusing.

General feedback for product owners / QA people of Crowdin

Still I must say that the user experience for a beginner is far from pleasant. I am trying to stay positive - but using Crowdin is really hard. I already spent several days to get the configuration and setup right. Here are some facts which I find confusing:

  1. The CLI configuration is not picked up by the web UI.
  2. The web UI creates a sources folder structure different from the CLI - so that 2 folder structures are shown in the web UI.
  3. The merge/pull request (GitHub integration) does follow the CLI configuration nor uploaded translations so that files are reformatted and existing translation is replaced with English.

Hello there,

I’ll try to answer your questions:

1 - They are compatible, something is not right with the configuration because the integration is sensitive to this and “does not forgive” extra parameters or incorrect syntax

2 - With preserve_hierarchy: true specified in the configuration, the folders should be the same; have you activated this opinion after or before you’ve uploaded files into Crowdin?

3 - Export options in the configuration file work only for the CLI, it is written about it in the documentation; please enable options at the project level