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

Commit 9b25573

Browse filesBrowse files
committed
bug #26661 [Translation] XLIFF2: Make sure to trim source if it is too long for "name" (Nyholm)
This PR was merged into the 4.1-dev branch. Discussion ---------- [Translation] XLIFF2: Make sure to trim source if it is too long for "name" | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | This PR is a follow-up on @javiereguiluz's comment here: symfony/symfony-docs#9302 This feature was introduced in #26149 Commits ------- ca41fec Make sure to trim source if it is too long
2 parents f568271 + ca41fec commit 9b25573
Copy full SHA for 9b25573

File tree

1 file changed

+5
-1
lines changed
Filter options

1 file changed

+5
-1
lines changed

‎src/Symfony/Component/Translation/Dumper/XliffFileDumper.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Translation/Dumper/XliffFileDumper.php
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,11 @@ private function dumpXliff2($defaultLocale, MessageCatalogue $messages, $domain,
146146
foreach ($messages->all($domain) as $source => $target) {
147147
$translation = $dom->createElement('unit');
148148
$translation->setAttribute('id', strtr(substr(base64_encode(hash('sha256', $source, true)), 0, 7), '/+', '._'));
149-
$translation->setAttribute('name', $source);
149+
$name = $source;
150+
if (strlen($source) > 80) {
151+
$name = substr(md5($source), -7);
152+
}
153+
$translation->setAttribute('name', $name);
150154
$metadata = $messages->getMetadata($source, $domain);
151155

152156
// Add notes section

0 commit comments

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