forked from symfony/symfony
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug symfony#44085 [Translation] Fix TranslationPullCommand with ICU t…
…ranslations (Kocal) This PR was squashed before being merged into the 5.3 branch. Discussion ---------- [Translation] Fix TranslationPullCommand with ICU translations | Q | A | ------------- | --- | Branch? | 5.3 | 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 exist, explain below instead --> | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> Today I've faced an issue when trying to pull (ICU and non-ICU) translations from Loco: - I have a non-ICU translation `say_hello` tagged as `messages` - and a ICU translation `say_hello_icu` tagged as `messages+intl-icu` When running `bin/console translation:pull loco --domains messages --domains messages+intl-icu`, it **only** creates a single file `messages.fr.xlf` that contains the two translations, so `say_hello_icu` will never be interpreted as an ICU-translation: ```xml <?xml version="1.0" encoding="utf-8"?> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2"> <file source-language="fr" target-language="fr" datatype="plaintext" original="file.ext"> <header> <tool tool-id="symfony" tool-name="Symfony"/> </header> <body> <trans-unit id="xQEX2ok" resname="say_hello_icu"> <source>say_hello_icu</source> <target>Bonjour {name} !</target> </trans-unit> <trans-unit id="1IHotcu" resname="say_hello"> <source>say_hello</source> <target>Bonjour %name% !</target> </trans-unit> </body> </file> </xliff> ``` With this fix, it creates two files as expected: - `messages.fr.xlf`: ```xml <?xml version="1.0" encoding="utf-8"?> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2"> <file source-language="fr" target-language="fr" datatype="plaintext" original="file.ext"> <header> <tool tool-id="symfony" tool-name="Symfony"/> </header> <body> <trans-unit id="1IHotcu" resname="say_hello"> <source>say_hello</source> <target>Bonjour %name% !</target> </trans-unit> </body> </file> </xliff> ``` - `messages+intl-icu.fr.xlf`: ```xml <?xml version="1.0" encoding="utf-8"?> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2"> <file source-language="fr" target-language="fr" datatype="plaintext" original="file.ext"> <header> <tool tool-id="symfony" tool-name="Symfony"/> </header> <body> <trans-unit id="xQEX2ok" resname="say_hello_icu"> <source>say_hello_icu</source> <target>Bonjour {name} !</target> </trans-unit> </body> </file> </xliff> ``` I've also added more tests to `LocoProvider` and `TranslationPullCommand`, ensuring it still handle ICU translations in the future. Ping `@welcoMattic` Commits ------- 1802488 [Translation] Fix TranslationPullCommand with ICU translations
- Loading branch information
Showing
5 changed files
with
93 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters