Thanks to visit codestin.com
Credit goes to github.com

Skip to content

PoEditor translation provider pulls wrong translation keys #41374

Closed
@majermi4

Description

@majermi4

Symfony version(s) affected: 5.3.0-RC1

Description

The translation keys pushed to PoEditor translation provider with bin/console translation:push poeditor are not the same as the ones pulled back using bin/console translation:pull poeditor --format yml.

How to reproduce

Create a Symfony project and install symfony/translation with symfony/po-editor-translation-provider.

Configure a poeditor provider and create 2 translation files for locales en and cs in the messages domain.

Screenshot 2021-05-21 at 23 36 16

Run bin/console translation:push poeditor which pushes the translations to Po Editor as it should.

Screenshot 2021-05-21 at 23 37 05

Run bin/console translation:pull poeditor --format yml. The local translation file was updated:

Screenshot 2021-05-21 at 23 45 29

I would expect that nothing should have happened because nothing was changed in Po Editor. Instead, it seems that the pull command uses the english translation as key when it reads data exported from Po Editor.

Possible Solution

I was able to fix the problem when I replaced this line:
$source = isset($attributes['resname']) && $attributes['resname'] ? $attributes['resname'] : $translation->source;
with:
$source = $attributes['id'];

Additional context

In the Po Editor project settings, I have set English as the Default Reference Language.

Screenshot 2021-05-21 at 23 53 44

I'm not sure if it's related to the issue but before I did that, the pull command would respond with these errors:

Screenshot 2021-05-21 at 23 55 02

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