From 1447125b669a78a73c8490aee679f0a94f10eeb3 Mon Sep 17 00:00:00 2001 From: Jama Mohamed Date: Wed, 15 May 2024 18:18:53 +0300 Subject: [PATCH] Update workflow file --- .github/workflows/ci.yml | 1 + .github/workflows/publish.yml | 4 +++ lib/src/locale/locales/vi_locale.dart | 52 +++++++++++++++++++++++++++ lib/src/locale/supported_locales.dart | 2 ++ 4 files changed, 59 insertions(+) create mode 100644 lib/src/locale/locales/vi_locale.dart diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 94f2c03..55444b8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,7 @@ on: pull_request: branches: - master + workflow_call: jobs: run-tests: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a2c49d3..b77b559 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -6,7 +6,11 @@ on: - "v[0-9]+.[0-9]+.[0-9]+*" jobs: + run-tests: + uses: ./.github/workflows/ci.yml + secrets: inherit publish: permissions: id-token: write + needs: run-tests uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1 diff --git a/lib/src/locale/locales/vi_locale.dart b/lib/src/locale/locales/vi_locale.dart new file mode 100644 index 0000000..693bff6 --- /dev/null +++ b/lib/src/locale/locales/vi_locale.dart @@ -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 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() => ' '; +} diff --git a/lib/src/locale/supported_locales.dart b/lib/src/locale/supported_locales.dart index 67a0437..3cdb5ec 100644 --- a/lib/src/locale/supported_locales.dart +++ b/lib/src/locale/supported_locales.dart @@ -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'; @@ -80,6 +81,7 @@ Map _supportedLocales = { 'th': ThLocale(), 'sk': SkLocale(), 'cs': CsLocale(), + 'vi': ViLocale(), }; Locale getLocale(String locale) {