8000 bug #48222 [Translation] [Lokalize] Configure `replace_breaks` to pre… · Chi-teck/symfony@d4162b3 · GitHub
[go: up one dir, main page]

Skip to content

Commit d4162b3

Browse files
committed
bug symfony#48222 [Translation] [Lokalize] Configure replace_breaks to prevent issues with multilines translations (Kocal)
This PR was merged into the 5.4 branch. Discussion ---------- [Translation] [Lokalize] Configure `replace_breaks` to prevent issues with multilines translations | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead --> | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> Hi, as seen with `@welcoMattic` in private messages, I faced an issue when pulling translations from Lokalise. Given the following translation, with newlines: ![image](https://user-images.githubusercontent.com/2103975/202193435-a2317097-6b44-4852-ab41-29b6685bc02d.png) When I pull it, this is what the translation looks like in the Symfony's `.xliff`: ![image](https://user-images.githubusercontent.com/2103975/202193506-0fe56a99-4d22-4e91-a1a2-2b23a3730b0a.png) Which leads to a syntax issue for the ICU formatter: ![image](https://user-images.githubusercontent.com/2103975/202193580-a28fda8a-a60d-461d-a84b-86984b237446.png) Using `replace_breaks: false` will fix this issue by preserving newlines: <img width="753" alt="image" src="https://user-images.githubusercontent.com/2103975/202193741-c76d8d9a-34b5-48ba-8ed9-2eb94aade58f.png"> <img width="469" alt="image" src="https://user-images.githubusercontent.com/2103975/202194287-b8d4a1e1-5cf7-4684-9f7c-b3e7c971ffd5.png"> Commits ------- 62c8b0a [Translation][Lokalize] Configure `replace_breaks` to prevent issues with multilines translations
2 parents 38b0c19 + 62c8b0a commit d4162b3

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/Symfony/Component/Translation/Bridge/Lokalise/LokaliseProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ private function exportFiles(array $locales, array $domains): array
151151
'filter_langs' => array_values($locales),
152152
'filter_filenames' => array_map([$this, 'getLokaliseFilenameFromDomain'], $domains),
153153
'export_empty_as' => 'skip',
154+
'replace_breaks' => false,
154155
],
155156
]);
156157

src/Symfony/Component/Translation/Bridge/Lokalise/Tests/LokaliseProviderTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,7 @@ public function testReadForOneLocaleAndOneDomain(string $locale, string $domain,
562562
'filter_langs' => [$locale],
563563
'filter_filenames' => [$domain.'.xliff'],
564564
'export_empty_as' => 'skip',
565+
'replace_breaks' => false,
565566
]);
566567

567568
$this->assertSame('POST', $method);

0 commit comments

Comments
 (0)
0