Skip to content

[Translation] [Lokalize] Configure replace_breaks to prevent issues with multilines translations #48222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 19, 2022
Merged

[Translation] [Lokalize] Configure replace_breaks to prevent issues with multilines translations #48222

merged 1 commit into from
Nov 19, 2022

Conversation

Kocal
Copy link
Member

@Kocal Kocal commented Nov 16, 2022

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #...
License MIT
Doc PR symfony/symfony-docs#...

Hi, as seen with @welcoMattic in private messages, I faced an issue when pulling translations from Lokalise.

Given the following translation, with newlines:
image

When I pull it, this is what the translation looks like in the Symfony's .xliff:
image

Which leads to a syntax issue for the ICU formatter:
image

Using replace_breaks: false will fix this issue by preserving newlines:
image

image

@carsonbot carsonbot added this to the 5.4 milestone Nov 16, 2022
@carsonbot carsonbot changed the title [Translation][Lokalize] Configure replace_breaks to prevent issues with multilines translations [Translation] [Lokalize] Configure replace_breaks to prevent issues with multilines translations Nov 16, 2022
@Kocal
Copy link
Member Author

Kocal commented Nov 16, 2022

Failures are unrelated.

@@ -562,6 +562,7 @@ public function testReadForOneLocaleAndOneDomain(string $locale, string $domain,
'filter_langs' => [$locale],
'filter_filenames' => [$domain.'.xliff'],
'export_empty_as' => 'skip',
'replace_breaks' => false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about extending the test with your use case?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we don't contact Lokalise API during tests, is it really useful?

@welcoMattic
Copy link
Member

Related to #45368, I think both PR are needed to fix the issue of ICU translations pulling from Lokalise.

@fabpot
Copy link
Member

fabpot commented Nov 19, 2022

Thank you @Kocal.

@fabpot fabpot merged commit d4162b3 into symfony:5.4 Nov 19, 2022
@fabpot fabpot mentioned this pull request Nov 19, 2022
This was referenced Nov 28, 2022
@Kocal Kocal deleted the fix/translation-lokalize-breaklines branch January 2, 2023 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants