Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Crowdin Translation File Replaced with Partial Data When Pushing Default Locale Without --force #58605

Copy link
Copy link
Open
@IoanaMar

Description

@IoanaMar
Issue body actions

Symfony version(s) affected

5.x - 7.1

Description

Description:

In Symfony versions 5 and above, running the translation:push command for the default locale without the --force option leads to unintended behavior. The Crowdin translation source file is replaced with only the diff between local and remote translations, causing loss of data for all locales.

The root cause of this behavior lies in the following code inside the CrowdinProvider

if ($catalogue->getLocale() === $this->defaultLocale) {
    if (!$fileId) {
        $file = $this->addFile($domain, $content);
    } else {
        $file = $this->updateFile($fileId, $domain, $content);
    }

    if (!$file) {
        continue;
    }

    $fileList[$file['name']] = $file['id'];
}

Here, the method updateFile calls the Crowdin API method PUT files/{fileId}, which fully replaces the file on Crowdin rather than merging the changes. As a result, the translation file on Crowdin is overwritten with only the local diff, leading to the loss of all other translations. If the --force option is used then the newly created translation file contains all keys, old and new, and no data is being lost.

I’m unsure whether this is documented behavior or if there’s something incorrect in how I’m using translations or the Crowdin integration. I wasn't able to find documentation for this specific case, but my use of translations doesn't appear to be out of the ordinary.

How to reproduce

  1. Set up translations and crowdin-translations-provider
  2. Run translation:push for all locales. All translations keys are pushed as intended.
  3. Update the local translation file for the default locale by adding some additional translation keys
  4. Run translation:push for the default locale without the --force option.
  5. Now the translation source file in Crowdin only contains the keys added in step 3, leading to loss of translations for all existing locales

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.