Skip to content

Commit 10ee312

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: [Serializer] Save missing arguments in MissingConstructorArgumentsException remove support for deprecated "threadKey" parameter Remove useless comment in test [DomCrawler] Added Crawler::innerText() method [Form] Add the EnumType Fix iterrator in ServiceConfigurator [Console] Add support of RGB functional notation for output colors Add Slovak lang translation #41081 [Validator] Add error's uid to `Count` and `Length` constraints with "exactly" option enabled [Validator] Add missing thai translation [Yaml] Add 0 to float repr [Translation] Add Burmese translation [Notifier] Update FirebaseTransport.php fix: #43086 remove shortcut e for option exclude of Yaml/LintCommand - solve conflict with --env -e Map `multipart/form-data` as `form` Content-Type [Serializer] Throw NotNormalizableValueException when type is not known or not in body in discriminator map [Yaml] Use more concise float representation in dump [FrameworkBundle] Remove translation data_collector BEFORE adding it to profiler
2 parents 52ec885 + b4c513d commit 10ee312

File tree

9 files changed

+558
-27
lines changed

9 files changed

+558
-27
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ CHANGELOG
2323

2424
* Deprecate calling `FormErrorIterator::children()` if the current element is not iterable.
2525
* Allow to pass `TranslatableMessage` objects to the `help` option
26+
* Add the `EnumType`
2627

2728
5.3
2829
---

Extension/Core/Type/EnumType.php

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Form\Extension\Core\Type;
13+
14+
use Symfony\Component\Form\AbstractType;
15+
use Symfony\Component\OptionsResolver\Options;
16+
use Symfony\Component\OptionsResolver\OptionsResolver;
17+
18+
/**
19+
* A choice type for native PHP enums.
20+
*
21+
* @author Alexander M. Turek <[email protected]>
22+
*/
23+
final class EnumType extends AbstractType
24+
{
25+
public function configureOptions(OptionsResolver $resolver): void
26+
{
27+
$resolver
28+
->setRequired(['class'])
29+
->setAllowedTypes('class', 'string')
30+
->setAllowedValues('class', \Closure::fromCallable('enum_exists'))
31+
->setDefault('choices', static function (Options $options): array {
32+
return $options['class']::cases();
33+
})
34+
->setDefault('choice_label', static function (\UnitEnum $choice): string {
35+
return $choice->name;
36+
})
37+
->setDefault('choice_value', static function (Options $options): ?\Closure {
38+
if (!is_a($options['class'], \BackedEnum::class, true)) {
39+
return null;
40+
}
41+
42+
return static function (?\BackedEnum $choice): ?string {
43+
if (null === $choice) {
44+
return null;
45+
}
46+
47+
return (string) $choice->value;
48+
};
49+
})
50+
;
51+
}
52+
53+
public function getParent(): string
54+
{
55+
return ChoiceType::class;
56+
}
57+
}
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
<?xml version="1.0"?>
2+
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3+
<file source-language="en" datatype="plaintext" original="file.ext">
4+
<body>
5+
<trans-unit id="28">
6+
<source>This form should not contain extra fields.</source>
7+
<target>ဤ ဖောင်သည် field အပိုများ မပါ၀င်သင့်ပါ။</target>
8+
</trans-unit>
9+
<trans-unit id="29">
10+
<source>The uploaded file was too large. Please try to upload a smaller file.</source>
11+
<target>Upload တင်သောဖိုင်သည်အလွန်ကြီးလွန်းသည်။ ကျေးဇူးပြု၍ သေးငယ်သည့်ဖိုင်ကိုတင်ရန်ကြိုးစားပါ။</target>
12+
</trans-unit>
13+
<trans-unit id="30">
14+
<source>The CSRF token is invalid. Please try to resubmit the form.</source>
15+
<target>သင့်လျှော်သော် CSRF တိုကင် မဟုတ်ပါ။ ကျေးဇူးပြု၍ဖောင်ကိုပြန်တင်ပါ။</target>
16+
</trans-unit>
17+
<trans-unit id="99">
18+
<source>This value is not a valid HTML5 color.</source>
19+
<target>ဤတန်ဖိုးသည် သင့်လျှော်သော် HTML5 အရောင်မဟုတ်ပါ။</target>
20+
</trans-unit>
21+
<trans-unit id="100">
22+
<source>Please enter a valid birthdate.</source>
23+
<target>ကျေးဇူးပြု၍ မှန်ကန်သောမွေးနေ့ကိုထည့်ပါ။</target>
24+
</trans-unit>
25+
<trans-unit id="101">
26+
<source>The selected choice is invalid.</source>
27+
<target>သင့် ရွေးချယ်မှုသည်မမှန်ကန်ပါ။</target>
28+
</trans-unit>
29+
<trans-unit id="102">
30+
<source>The collection is invalid.</source>
31+
<target>ဤ collection သည်သင့်လျှော်သော် collection မဟုတ်ပါ။</target>
32+
</trans-unit>
33+
<trans-unit id="103">
34+
<source>Please select a valid color.</source>
35+
<target>ကျေးဇူးပြု၍ မှန်ကန်သောအရောင်ကိုရွေးပါ။</target>
36+
</trans-unit>
37+
<trans-unit id="104">
38+
<source>Please select a valid country.</source>
39+
<target>ကျေးဇူးပြု၍ မှန်ကန်သောနိုင်ငံကိုရွေးပါ။</target>
40+
</trans-unit>
41+
<trans-unit id="105">
42+
<source>Please select a valid currency.</source>
43+
<target>ကျေးဇူးပြု၍ မှန်ကန်သောငွေကြေးကိုရွေးပါ။</target>
44+
</trans-unit>
45+
<trans-unit id="106">
46+
<source>Please choose a valid date interval.</source>
47+
<target>ကျေးဇူးပြု၍ မှန်ကန်သောနေ ရက်စွဲကိုရွေးပါ။</target>
48+
</trans-unit>
49+
<trans-unit id="107">
50+
<source>Please enter a valid date and time.</source>
51+
<target>ကျေးဇူးပြု၍ မှန်ကန်သောနေ ရက်စွဲနှင့်အချိန် ကိုထည့်ပါ။</target>
52+
</trans-unit>
53+
<trans-unit id="108">
54+
<source>Please enter a valid date.</source>
55+
<target>ကျေးဇူးပြု၍ မှန်ကန်သောနေ ရက်စွဲကိုထည့်ပါ။</target>
56+
</trans-unit>
57+
<trans-unit id="109">
58+
<source>Please select a valid file.</source>
59+
<target>ကျေးဇူးပြု၍ မှန်ကန်သောနေ ဖိုင်ကိုရွေးချယ်ပါ။</target>
60+
</trans-unit>
61+
<trans-unit id="110">
62+
<source>The hidden field is invalid.</source>
63+
<target>မသင့် လျှော်သော် hidden field ဖြစ်နေသည်။</target>
64+
</trans-unit>
65+
<trans-unit id="111">
66+
<source>Please enter an integer.</source>
67+
<target>ကျေးဇူးပြု၍ Integer တန်ဖိုးသာထည့်ပါ။</target>
68+
</trans-unit>
69+
<trans-unit id="112">
70+
<source>Please select a valid language.</source>
71+
<target>ကျေးဇူးပြု၍ မှန်ကန်သော ဘာသာစကားကိုရွေးချယ်ပါ။</target>
72+
</trans-unit>
73+
<trans-unit id="113">
74+
<source>Please select a valid locale.</source>
75+
<target>ကျေးဇူးပြု၍ မှန်ကန်သော locale ကိုရွေးချယ်ပါ။</target>
76+
</trans-unit>
77+
<trans-unit id="114">
78+
<source>Please enter a valid money amount.</source>
79+
<target>ကျေးဇူးပြု၍ မှန်ကန်သော ပိုက်ဆံပမာဏ ကိုထည့်ပါ။</target>
80+
</trans-unit>
81+
<trans-unit id="115">
82+
<source>Please enter a number.</source>
83+
<target>ကျေးဇူးပြု၍ မှန်ကန်သော နံပါတ် ကိုရွေးချယ်ပါ။</target>
84+
</trans-unit>
85+
<trans-unit id="116">
86+
<source>The password is invalid.</source>
87+
<target>မှန်ကန်သောစကား၀ှက်မဟုတ်ပါ။</target>
88+
</trans-unit>
89+
<trans-unit id="117">
90+
<source>Please enter a percentage value.</source>
91+
<target>ကျေးဇူးပြု၍ ရာခိုင်နှုန်းတန်ဖိုးထည့်ပါ။</target>
92+
</trans-unit>
93+
<trans-unit id="118">
94+
<source>The values do not match.</source>
95+
<target>တန်ဖိုးများကိုက်ညီမှုမရှိပါ။</target>
96+
</trans-unit>
97+
<trans-unit id="119">
98+
<source>Please enter a valid time.</source>
99+
<target>ကျေးဇူးပြု၍ မှန်ကန်သောအချိန်ကိုထည့်ပါ။</target>
100+
</trans-unit>
101+
<trans-unit id="120">
102+
<source>Please select a valid timezone.</source>
103+
<target>ကျေးဇူးပြု၍ မှန်ကန်သောအချိန်ဇုန်ကိုရွေးပါ။</target>
104+
</trans-unit>
105+
<trans-unit id="121">
106+
<source>Please enter a valid URL.</source>
107+
<target>ကျေးဇူးပြု၍ သင့်လျှော်သော် URL ကိုရွေးပါ။</target>
108+
</trans-unit>
109+
<trans-unit id="122">
110+
<source>Please enter a valid search term.</source>
111+
<target>ကျေးဇူးပြု၍ သင့် လျှော်သော်ရှာဖွေမှု term များထည့်ပါ။</target>
112+
</trans-unit>
113+
<trans-unit id="123">
114+
<source>Please provide a valid phone number.</source>
115+
<target>ကျေးဇူးပြု၍ သင့် လျှော်သော်ရှာဖွေမှု ဖုန်းနံပါတ်ထည့်ပါ။</target>
116+
</trans-unit>
117+
<trans-unit id="124">
118+
<source>The checkbox has an invalid value.</source>
119+
<target>Checkbox တန်ဖိုးသည် မှန်ကန်မှုမရှိပါ။</target>
120+
</trans-unit>
121+
<trans-unit id="125">
122+
<source>Please enter a valid email address.</source>
123+
<target>ကျေးဇူးပြု၍ မှန်ကန်သော် email လိပ်စာထည့်ပါ။</target>
124+
</trans-unit>
125+
<trans-unit id="126">
126+
<source>Please select a valid option.</source>
127+
<target>ကျေးဇူးပြု၍ မှန်ကန်သော် ရွေးချယ်မှု ကိုရွေးပါ။</target>
128+
</trans-unit>
129+
<trans-unit id="127">
130+
<source>Please select a valid range.</source>
131+
<target>ကျေးဇူးပြု၍ မှန်ကန်သော အပိုင်းအခြား ကိုရွေးပါ။</target>
132+
</trans-unit>
133+
<trans-unit id="128">
134+
<source>Please enter a valid week.</source>
135+
<target>ကျေးဇူးပြု၍ မှန်ကန်သောရက်သတ္တပတ်ကိုထည့်ပါ။</target>
136+
</trans-unit>
137+
</body>
138+
</file>
139+
</xliff>

0 commit comments

Comments
 (0)