8000 minor #53507 [Validator] Make it explicit when English translation di… · symfony/symfony@db2c6e4 · GitHub
[go: up one dir, main page]

Skip to content

Commit db2c6e4

Browse files
minor #53507 [Validator] Make it explicit when English translation differs from its resource name (nicolas-grekas)
This PR was merged into the 5.4 branch. Discussion ---------- [Validator] Make it explicit when English translation differs from its resource name | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT Inspired by #53505 Follows #53420 Commits ------- eaedae6 [Validator] Make it explicit when English translation differs from its resource name
2 parents 5e98336 + eaedae6 commit db2c6e4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+629
-617
lines changed

.github/sync-translations.php

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ function dumpXliff1(string $defaultLocale, MessageCatalogue $messages, string $d
3333
$metadata = $messages->getMetadata($source, $domain);
3434

3535
$translation->setAttribute('id', $metadata['id']);
36+
if (isset($metadata['resname'])) {
37+
$translation->setAttribute('resname', $metadata['resname']);
38+
}
3639

3740
$s = $translation->appendChild($dom->createElement('source'));
3841
$s->appendChild($dom->createTextNode($source));
@@ -64,23 +67,32 @@ function dumpXliff1(string $defaultLocale, MessageCatalogue $messages, string $d
6467
$dir = __DIR__.'/../src/Symfony/Component/'.$component.'/Resources/translations';
6568

6669
$enCatalogue = (new XliffFileLoader())->load($dir.'/'.$domain.'.en.xlf', 'en', $domain);
70+
file_put_contents($dir.'/'.$domain.'.en.xlf', dumpXliff1('en', $enCatalogue, $domain));
71+
6772
$finder = new Finder();
6873

6974
foreach ($finder->files()->in($dir)->name('*.xlf') as $file) {
7075
$locale = substr($file->getBasename(), 1 + strlen($domain), -4);
7176

77+
if ('en' === $locale) {
78+
continue;
79+
}
80+
7281
$catalogue = (new XliffFileLoader())->load($file, $locale, $domain);
7382
$localeCatalogue = new MessageCatalogue($locale);
7483

75-
foreach ($enCatalogue->all($domain) as $id => $translation) {
84+
foreach ($enCatalogue->all($domain) as $resname => $source) {
7685
$metadata = [];
77-
if ($catalogue->defines($id, $domain)) {
78-
$translation = $catalogue->get($id, $domain);
79-
$metadata = $catalogue->getMetadata($id, $domain);
86+
if ($catalogue->defines($resname, $domain)) {
87+
$translation = $catalogue->get($resname, $domain);
88+
$metadata = $catalogue->getMetadata($resname, $domain);
89+
}
90+
$metadata['id'] = $enCatalogue->getMetadata($resname, $domain)['id'];
91+
if ($resname !== $source) {
92+
$metadata['resname'] = $resname;
8093
}
81-
$metadata['id'] = $enCatalogue->getMetadata($id, $domain)['id'];
82-
$localeCatalogue->set($id, $translation, $domain);
83-
$localeCatalogue->setMetadata($id, $metadata, $domain);
94+
$localeCatalogue->set($source, $translation, $domain);
95+
$localeCatalogue->setMetadata($source, $metadata, $domain);
8496
}
8597

8698
file_put_contents($file, dumpXliff1('en', $localeCatalogue, $domain));

src/Symfony/Component/Validator/Resources/translations/validators.af.xlf

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@
134134
<source>This file is not a valid image.</source>
135135
<target>Hierdie lêer is nie 'n geldige beeld nie.</target>
136136
</trans-unit>
137-
<trans-unit id="37">
138-
<source>This is not a valid IP address.</source>
137+
<trans-unit id="37" resname="This is not a valid IP address.">
138+
<source>This value is not a valid IP address.</source>
139139
<target state="needs-review-translation">Hierdie waarde is nie 'n geldige IP-adres nie.</target>
140140
</trans-unit>
141141
<trans-unit id="38">
@@ -190,9 +190,9 @@
190190
<source>No file was uploaded.</source>
191191
<target>Geen lêer is opgelaai nie.</target>
192192
</trans-unit>
193-
<trans-unit id="51">
194-
<source>No temporary folder was configured in php.ini.</source>
195-
<target>Geen tydelike lêer is ingestel in php.ini nie.</target>
193+
<trans-unit id="51" resname="No temporary folder was configured in php.ini.">
194+
<source>No temporary folder was configured in php.ini, or the configured folder does not exist.</source>
195+
<target state="needs-review-translation">Geen tydelike gids is in php.ini opgestel nie, of die opgestelde gids bestaan nie.</target>
196196
</trans-unit>
197197
<trans-unit id="52">
198198
<source>Cannot write temporary file to disk.</source>
@@ -222,8 +222,8 @@
222222
<source>Unsupported card type or invalid card number.</source>
223223
<target>Nie-ondersteunde tipe kaart of ongeldige kredietkaart nommer.</target>
224224
</trans-unit>
225-
<trans-unit id="59">
226-
<source>This is not a valid International Bank Account Number (IBAN).</source>
225+
<trans-unit id="59" resname="This is not a valid International Bank Account Number (IBAN).">
226+
<source>This value is not a valid International Bank Account Number (IBAN).</source>
227227
<target state="needs-review-translation">Hierdie waarde is nie 'n geldige Internasionale Bankrekeningnommer (IBAN) nie.</target>
228228
</trans-unit>
229229
<trans-unit id="60">
@@ -310,16 +310,16 @@
310310
<source>This value does not match the expected {{ charset }} charset.</source>
311311
<target>Die waarde stem nie ooreen met die verwagte {{ charset }} karakterstel nie.</target>
312312
</trans-unit>
313-
<trans-unit id="81">
314-
<source>This is not a valid Business Identifier Code (BIC).</source>
313+
<trans-unit id="81" resname="This is not a valid Business Identifier Code (BIC).">
314+
<source>This value is not a valid Business Identifier Code (BIC).</source>
315315
<target state="needs-review-translation">Hierdie waarde is nie 'n geldige Besigheid Identifiseerder Kode (BIC) nie.</target>
316316
</trans-unit>
317317
<trans-unit id="82">
318318
<source>Error</source>
319319
<target>Fout</target>
320320
</trans-unit>
321-
<trans-unit id="83">
322-
<source>This is not a valid UUID.</source>
321+
<trans-unit id="83" resname="This is not a valid UUID.">
322+
<source>This value is not a valid UUID.</source>
323323
<target state="needs-review-translation">Hierdie waarde is nie 'n geldige UUID nie.</target>
324324
</trans-unit>
325325
<trans-unit id="84">

src/Symfony/Component/Validator/Resources/translations/validators.ar.xlf

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@
134134
<source>This file is not a valid image.</source>
135135
<target>هذا الملف ليس صورة صحيحة.</target>
136136
</trans-unit>
137-
<trans-unit id="37">
138-
<source>This is not a valid IP address.</source>
137+
<trans-unit id="37" resname="This is not a valid IP address.">
138+
<source>This value is not a valid IP address.</source>
139139
<target state="needs-review-translation">هذه القيمة ليست عنوان IP صالحًا.</target>
140140
</trans-unit>
141141
<trans-unit id="38">
@@ -190,9 +190,9 @@
190190
<source>No file was uploaded.</source>
191191
<target>لم يتم ارسال اى ملف.</target>
192192
</trans-unit>
193-
<trans-unit id="51">
194-
<source>No temporary folder was configured in php.ini.</source>
195-
<target>لم يتم تهيئة حافظة مؤقتة فى ملف php.ini.</target>
193+
<trans-unit id="51" resname="No temporary folder was configured in php.ini.">
194+
<source>No temporary folder was configured in php.ini, or the configured folder does not exist.</source>
195+
<target state="needs-review-translation">لم يتم تكوين مجلد مؤقت في ملف php.ini، أو المجلد المعد لا يوجد.</target>
196196
</trans-unit>
197197
<trans-unit id="52">
198198
<source>Cannot write temporary file to disk.</source>
@@ -222,8 +222,8 @@
222222
<source>Unsupported card type or invalid card number.</source>
223223
<target>نوع البطاقه غير مدعوم او الرقم غير صحيح.</target>
224224
</trans-unit>
225-
<trans-unit id="59">
226-
<source>This is not a valid International Bank Account Number (IBAN).</source>
225+
<trans-unit id="59" resname="This is not a valid International Bank Account Number (IBAN).">
226+
<source>This value is not a valid International Bank Account Number (IBAN).</source>
227227
<target state="needs-review-translation">هذه القيمة ليست رقم حساب بنكي دولي (IBAN) صالحًا.</target>
228228
</trans-unit>
229229
<trans-unit id="60">
@@ -310,16 +310,16 @@
310310
<source>This value does not match the expected {{ charset }} charset.</source>
311311
<target>هذه القيمة غير متطابقة مع صيغة التحويل {{ charset }}.</target>
312312
</trans-unit>
313-
<trans-unit id="81">
314-
<source>This is not a valid Business Identifier Code (BIC).</source>
313+
<trans-unit id="81" resname="This is not a valid Business Identifier Code (BIC).">
314+
<source>This value is not a valid Business Identifier Code (BIC).</source>
315315
<target state="needs-review-translation">هذه القيمة ليست رمز معرف الأعمال (BIC) صالحًا.</target>
316316
</trans-unit>
317317
<trans-unit id="82">
318318
<source>Error</source>
319319
<target>خطأ</target>
320320
</trans-unit>
321-
<trans-unit id="83">
322-
<source>This is not a valid UUID.</source>
321+
<trans-unit id="83" resname="This is not a valid UUID.">
322+
<source>This value is not a valid UUID.</source>
323323
<target state="needs-review-translation">هذه القيمة ليست UUID صالحًا.</target>
324324
</trans-unit>
325325
<trans-unit id="84">

src/Symfony/Component/Validator/Resources/translations/validators.az.xlf

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@
134134
<source>This file is not a valid image.</source>
135135
<target>Bu fayl düzgün bir şəkil deyil.</target>
136136
</trans-unit>
137-
<trans-unit id="37">
138-
<source>This is not a valid IP address.</source>
137+
<trans-unit id="37" resname="This is not a valid IP address.">
138+
<source>This value is not a valid IP address.</source>
139139
<target state="needs-review-translation">Bu dəyər etibarlı bir IP ünvanı deyil.</target>
140140
</trans-unit>
141141
<trans-unit id="38">
@@ -190,9 +190,9 @@
190190
<source>No file was uploaded.</source>
191191
<target>Fayl yüklənmədi.</target>
192192
</trans-unit>
193-
<trans-unit id="51">
194-
<source>No temporary folder was configured in php.ini.</source>
195-
<target>php.ini'də müvəqqəti qovluq quraşdırılmayıb.</target>
193+
<trans-unit id="51" resname="No temporary folder was configured in php.ini.">
194+
<source>No temporary folder was configured in php.ini, or the configured folder does not exist.</source>
195+
<target state="needs-review-translation">php.ini-də müvəqqəti qovluq quraşdırılmayıb, və ya quraşdırılmış qovluq mövcud deyil.</target>
196196
</trans-unit>
197197
<trans-unit id="52">
198198
<source>Cannot write temporary file to disk.</source>
@@ -222,8 +222,8 @@
222222
<source>Unsupported card type or invalid card number.</source>
223223
<target>Dəstəklənməyən kart tipi və ya yanlış kart nömrəsi.</target>
224224
</trans-unit>
225-
<trans-unit id="59">
226-
<source>This is not a valid International Bank Account Number (IBAN).</source>
225+
<trans-unit id="59" resname="This is not a valid International Bank Account Number (IBAN).">
226+
<source>This value is not a valid International Bank Account Number (IBAN).</source>
227227
<target state="needs-review-translation">Bu dəyər etibarlı bir Beynəlxalq Bank Hesab Nömrəsi (IBAN) deyil.</target>
228228
</trans-unit>
229229
<trans-unit id="60">
@@ -310,16 +310,16 @@
310310
<source>This value does not match the expected {{ charset }} charset.</source>
311311
<target>Bu dəyər gözlənilən {{ charset }} simvol cədvəli ilə uyğun gəlmir.</target>
312312
</trans-unit>
313-
<trans-unit id="81">
314-
<source>This is not a valid Business Identifier Code (BIC).</source>
313+
<trans-unit id="81" resname="This is not a valid Business Identifier Code (BIC).">
314+
<source>This value is not a valid Business Identifier Code (BIC).</source>
315315
<target state="needs-review-translation">Bu dəyər etibarlı bir Biznes Təyinat Kodu (BIC) deyil.</target>
316316
</trans-unit>
317317
<trans-unit id="82">
318318
<source>Error</source>
319319
<target>Xəta</target>
320320
</trans-unit>
321-
<trans-unit id="83">
322-
<source>This is not a valid UUID.</source>
321+
<trans-unit id="83" resname="This is not a valid UUID.">
322+
<source>This value is not a valid UUID.</source>
323323
<target state="needs-review-translation">Bu dəyər etibarlı bir UUID deyil.</target>
324324
</trans-unit>
325325
<trans-unit id="84">

src/Symfony/Component/Validator/Resources/translations/validators.be.xlf

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@
134134
<source>This file is not a valid image.</source>
135135
<target>Гэты файл не з'яўляецца сапраўднай выявай.</target>
136136
</trans-unit>
137-
<trans-unit id="37">
138-
<source>This is not a valid IP address.</source>
137+
<trans-unit id="37" resname="This is not a valid IP address.">
138+
<source>This value is not a valid IP address.</source>
139139
<target state="needs-review-translation">Гэта значэнне не з'яўляецца сапраўдным IP-адрасам.</target>
140140
</trans-unit>
141141
<trans-unit id="38">
@@ -190,8 +190,8 @@
190190
<source>No file was uploaded.</source>
191191
<target>Файл не быў запампаваны.</target>
19 10000 2192
</trans-unit>
193-
<trans-unit id="51">
194-
<source>No temporary folder was configured in php.ini.</source>
193+
<trans-unit id="51" resname="No temporary folder was configured in php.ini.">
194+
<source>No temporary folder was configured in php.ini, or the configured folder does not exist.</source>
195195
<target>У php.ini не была налажана часовая папка, або часовая папка не існуе.</target>
196196
</trans-unit>
197197
<trans-unit id="52">
@@ -222,8 +222,8 @@
222222
<source>Unsupported card type or invalid card number.</source>
223223
<target>Тып карты не падтрымліваецца або несапраўдны нумар карты.</target>
224224
</trans-unit>
225-
<trans-unit id="59">
226-
<source>This is not a valid International Bank Account Number (IBAN).</source>
225+
<trans-unit id="59" resname="This is not a valid International Bank Account Number (IBAN).">
226+
<source>This value is not a valid International Bank Account Number (IBAN).</source>
227227
<target state="needs-review-translation">Гэта значэнне не з'яўляецца сапраўдным міжнародным нумарам банкаўскага рахунку (IBAN).</target>
228228
</trans-unit>
229229
<trans-unit id="60">
@@ -310,16 +310,16 @@
310310
<source>This value does not match the expected {{ charset }} charset.</source>
311311
<target>Гэта значэнне не супадае з чаканай {{ charset }} кадыроўкай.</target>
312312
</trans-unit>
313-
<trans-unit id="81">
314-
<source>This is not a valid Business Identifier Code (BIC).</source>
313+
<trans-unit id="81" resname="This is not a valid Business Identifier Code (BIC).">
314+
<source>This value is not a valid Business Identifier Code (BIC).</source>
315315
<target state="needs-review-translation">Гэта значэнне не з'яўляецца сапраўдным кодам ідэнтыфікацыі бізнесу (BIC).</target>
316316
</trans-unit>
317317
<trans-unit id="82">
318318
<source>Error</source>
319319
<target>Памылка</target>
320320
</trans-unit>
321-
<trans-unit id="83">
322-
<source>This is not a valid UUID.</source>
321+
<trans-unit id="83" resname="This is not a valid UUID.">
322+
<source>This value is not a valid UUID.</source>
323323
<target state="needs-review-translation">Гэта значэнне не з'яўляецца сапраўдным UUID.</target>
324324
</trans-unit>
325325
<trans-unit id="84">

0 commit comments

Comments
 (0)
0