Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support Vietnamese (vi) #283

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions lib/src/locale/locales/vi_locale.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import '../../enums/start_of_week.dart';
import '../locale.dart';
import '../relative_date_time.dart';

class ViLocale extends Locale {
@override
String code() => 'vi';

@override
List<String> ordinals() => List.from(['Ngày', 'Ngày', 'Ngày', 'Ngày'], growable: false);

@override
StartOfWeek startOfWeek() => StartOfWeek.monday;

@override
RelativeDateTime relativeDateTime() => ViRelativeTime();
}

class ViRelativeTime extends RelativeDateTime {
@override
String prefixAgo() => '';
@override
String prefixFromNow() => '';
@override
String suffixAgo() => 'trước';
@override
String suffixFromNow() => 'sau';
@override
String lessThanOneMinute(int seconds) => 'vài giây';
@override
String aboutAMinute(int minutes) => 'một phút';
@override
String minutes(int minutes) => '$minutes phút';
@override
String aboutAnHour(int minutes) => 'một giờ';
@override
String hours(int hours) => '$hours giờ';
@override
String aDay(int hours) => 'một ngày';
@override
String days(int days) => '$days ngày';
@override
String aboutAMonth(int days) => 'một tháng';
@override
String months(int months) => '$months tháng';
@override
String aboutAYear(int year) => 'một năm';
@override
String years(int years) => '$years năm';
@override
String wordSeparator() => ' ';
}
2 changes: 2 additions & 0 deletions lib/src/locale/supported_locales.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import 'locales/uk_locale.dart';
import 'locales/az_locale.dart';
import 'locales/sv_locale.dart';
import 'locales/tr_locale.dart';
import 'locales/vi_locale.dart';
import 'locales/zh_locale.dart';
import 'locales/bn_locale.dart';

Expand Down Expand Up @@ -80,6 +81,7 @@ Map<String, Locale> _supportedLocales = {
'th': ThLocale(),
'sk': SkLocale(),
'cs': CsLocale(),
'vi': ViLocale(),
};

Locale getLocale(String locale) {
Expand Down