Skip to content

Commit 9bdda52

Browse files
Merge pull request #42 from huypq6/vietnamese
support Vietnamese
2 parents 3f917b9 + 830517e commit 9bdda52

File tree

4 files changed

+92
-10
lines changed

4 files changed

+92
-10
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ Validators support default errorText messages in this languages:
100100
- Turkish (tr)
101101
- Malay (ms)
102102
- Mongolian (mn)
103+
- Vietnamese (vi)
103104

104105
And you can still add your custom error messages.
105106

lib/l10n/intl_vi.arb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"@@locale": "vi",
3+
"requiredErrorText": "Không được bỏ trống.",
4+
"minErrorText": "Giá trị phải lớn hơn hoặc bằng {min}.",
5+
"minLengthErrorText": "Độ dài phải lớn hơn hoặc bằng {minLength}",
6+
"maxErrorText": "Giá trị phải nhỏ hơn hoặc bằng {max}",
7+
"maxLengthErrorText": "Độ dài phải nhỏ hơn hoặc bằng {maxLength}",
8+
"equalLengthErrorText": "Độ dài phải bằng {length}",
9+
"emailErrorText": "Nhập đúng email.",
10+
"integerErrorText": "Yêu cầu nhập một số nguyên.",
11+
"equalErrorText": "Bắt buộc bằng {value}.",
12+
"notEqualErrorText": "Bắt buộc khác {value}.",
13+
"urlErrorText": "Nhập đúng địa chỉ URL.",
14+
"matchErrorText": "Giá trị không khớp.",
15+
"numericErrorText": "Yêu cầu nhập một số.",
16+
"creditCardErrorText": "Yêu cầu nhập đúng số thẻ tín dụng.",
17+
"ipErrorText": "Yêu cầu nhập đúng địa chỉ IP.",
18+
"dateStringErrorText": "Yêu cầu nhập đúng định dạng ngày."
19+
}

lib/localization/intl/messages.dart

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import 'package:flutter/widgets.dart';
55
import 'package:flutter_localizations/flutter_localizations.dart';
66
import 'package:intl/intl.dart' as intl;
77

8-
import 'messages_al.dart';
98
import 'messages_ar.dart';
109
import 'messages_bn.dart';
1110
import 'messages_bs.dart';
@@ -27,9 +26,7 @@ import 'messages_ko.dart';
2726
import 'messages_lo.dart';
2827
import 'messages_mn.dart';
2928
import 'messages_ms.dart';
30-
import 'messages_my.dart';
3129
import 'messages_nl.dart';
32-
import 'messages_ne.dart';
3330
import 'messages_pl.dart';
3431
import 'messages_pt.dart';
3532
import 'messages_ro.dart';
@@ -41,6 +38,7 @@ import 'messages_ta.dart';
4138
import 'messages_th.dart';
4239
import 'messages_tr.dart';
4340
import 'messages_uk.dart';
41+
import 'messages_vi.dart';
4442
import 'messages_zh.dart';
4543

4644
/// Callers can lookup localized strings with an instance of FormBuilderLocalizationsImpl
@@ -124,7 +122,6 @@ abstract class FormBuilderLocalizationsImpl {
124122

125123
/// A list of this localizations delegate's supported locales.
126124
static const List<Locale> supportedLocales = <Locale>[
127-
Locale('al'),
128125
Locale('ar'),
129126
Locale('bn'),
130127
Locale('bs'),
@@ -146,9 +143,7 @@ abstract class FormBuilderLocalizationsImpl {
146143
Locale('lo'),
147144
Locale('mn'),
148145
Locale('ms'),
149-
Locale('my'),
150146
Locale('nl'),
151-
Locale('ne'),
152147
Locale('pl'),
153148
Locale('pt'),
154149
Locale('ro'),
@@ -160,6 +155,7 @@ abstract class FormBuilderLocalizationsImpl {
160155
Locale('th'),
161156
Locale('tr'),
162157
Locale('uk'),
158+
Locale('vi'),
163159
Locale('zh'),
164160
Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant')
165161
];
@@ -270,7 +266,7 @@ class _FormBuilderLocalizationsImplDelegate extends LocalizationsDelegate<FormBu
270266
}
271267

272268
@override
273-
bool isSupported(Locale locale) => <String>['al','ar', 'bn', 'bs', 'ca', 'cs', 'de', 'el', 'en', 'es', 'et', 'fa', 'fr', 'hr', 'hu', 'id', 'it', 'ja', 'ko', 'lo', 'mn', 'ms', 'my', 'nl', 'ne', 'pl', 'pt', 'ro', 'ru', 'sk', 'sl', 'sw', 'ta', 'th', 'tr', 'uk', 'zh'].contains(locale.languageCode);
269+
bool isSupported(Locale locale) => <String>['ar', 'bn', 'bs', 'ca', 'cs', 'de', 'el', 'en', 'es', 'et', 'fa', 'fr', 'hr', 'hu', 'id', 'it', 'ja', 'ko', 'lo', 'mn', 'ms', 'nl', 'pl', 'pt', 'ro', 'ru', 'sk', 'sl', 'sw', 'ta', 'th', 'tr', 'uk', 'vi', 'zh'].contains(locale.languageCode);
274270

275271
@override
276272
bool shouldReload(_FormBuilderLocalizationsImplDelegate old) => false;
@@ -290,7 +286,6 @@ FormBuilderLocalizationsImpl lookupFormBuilderLocalizationsImpl(Locale locale) {
290286

291287
// Lookup logic when only language code is specified.
292288
switch (locale.languageCode) {
293-
case 'al': return FormBuilderLocalizationsImplAl();
294289
case 'ar': return FormBuilderLocalizationsImplAr();
295290
case 'bn': return FormBuilderLocalizationsImplBn();
296291
case 'bs': return FormBuilderLocalizationsImplBs();
@@ -312,9 +307,7 @@ FormBuilderLocalizationsImpl lookupFormBuilderLocalizationsImpl(Locale locale) {
312307
case 'lo': return FormBuilderLocalizationsImplLo();
313308
case 'mn': return FormBuilderLocalizationsImplMn();
314309
case 'ms': return FormBuilderLocalizationsImplMs();
315-
case 'my': return FormBuilderLocalizationsImplMy();
316310
case 'nl': return FormBuilderLocalizationsImplNl();
317-
case 'ne': return FormBuilderLocalizationsImplNe();
318311
case 'pl': return FormBuilderLocalizationsImplPl();
319312
case 'pt': return FormBuilderLocalizationsImplPt();
320313
case 'ro': return FormBuilderLocalizationsImplRo();
@@ -326,6 +319,7 @@ FormBuilderLocalizationsImpl lookupFormBuilderLocalizationsImpl(Locale locale) {
326319
case 'th': return FormBuilderLocalizationsImplTh();
327320
case 'tr': return FormBuilderLocalizationsImplTr();
328321
case 'uk': return FormBuilderLocalizationsImplUk();
322+
case 'vi': return FormBuilderLocalizationsImplVi();
329323
case 'zh': return FormBuilderLocalizationsImplZh();
330324
}
331325

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import 'messages.dart';
2+
3+
/// The translations for Vietnamese (`vi`).
4+
class FormBuilderLocalizationsImplVi extends FormBuilderLocalizationsImpl {
5+
FormBuilderLocalizationsImplVi([String locale = 'vi']) : super(locale);
6+
7+
@override
8+
String get requiredErrorText => 'Không được bỏ trống.';
9+
10+
@override
11+
String minErrorText(Object min) {
12+
return 'Giá trị phải lớn hơn hoặc bằng $min.';
13+
}
14+
15+
@override
16+
String minLengthErrorText(Object minLength) {
17+
return 'Độ dài phải lớn hơn hoặc bằng $minLength';
18+
}
19+
20+
@override
21+
String maxErrorText(Object max) {
22+
return 'Giá trị phải nhỏ hơn hoặc bằng $max';
23+
}
24+
25+
@override
26+
String maxLengthErrorText(Object maxLength) {
27+
return 'Độ dài phải nhỏ hơn hoặc bằng $maxLength';
28+
}
29+
30+
@override
31+
String equalLengthErrorText(Object length) {
32+
return 'Độ dài phải bằng $length';
33+
}
34+
35+
@override
36+
String get emailErrorText => 'Nhập đúng email.';
37+
38+
@override
39+
String get integerErrorText => 'Yêu cầu nhập một số nguyên.';
40+
41+
@override
42+
String equalErrorText(Object value) {
43+
return 'Bắt buộc bằng $value.';
44+
}
45+
46+
@override
47+
String notEqualErrorText(Object value) {
48+
return 'Bắt buộc khác $value.';
49+
}
50+
51+
@override
52+
String get urlErrorText => 'Nhập đúng địa chỉ URL.';
53+
54+
@override
55+
String get matchErrorText => 'Giá trị không khớp.';
56+
57+
@override
58+
String get numericErrorText => 'Yêu cầu nhập một số.';
59+
60+
@override
61+
String get creditCardErrorText => 'Yêu cầu nhập đúng số thẻ tín dụng.';
62+
63+
@override
64+
String get ipErrorText => 'Yêu cầu nhập đúng địa chỉ IP.';
65+
66+
@override
67+
String get dateStringErrorText => 'Yêu cầu nhập đúng định dạng ngày.';
68+
}

0 commit comments

Comments
 (0)