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

Added Greek language support #70

Merged
merged 1 commit into from
Aug 21, 2024
Merged
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
86 changes: 86 additions & 0 deletions lib/src/locale/greek.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
part of duration.locale;

class GreekDurationLocale extends DurationLocale {
const GreekDurationLocale();

@override
String year(int amount, [bool abbreviated = true]) {
if (abbreviated) {
return 'χ';
} else {
return 'χρόν' + (amount.abs() != 1 ? 'ια' : 'ος');
}
}

@override
String month(int amount, [bool abbreviated = true]) {
if (abbreviated) {
return 'μην';
} else {
return 'μήν' + (amount.abs() != 1 ? 'ες' : 'ας');
}
}

@override
String week(int amount, [bool abbreviated = true]) {
if (abbreviated) {
return 'ε';
} else {
return 'εβδομάδ' + (amount.abs() != 1 ? 'ες' : 'α');
}
}

@override
String day(int amount, [bool abbreviated = true]) {
if (abbreviated) {
return 'μ';
} else {
return 'μέρ' + (amount.abs() != 1 ? 'ες' : 'α');
}
}

@override
String hour(int amount, [bool abbreviated = true]) {
if (abbreviated) {
return 'ω';
} else {
return 'ώρ' + (amount.abs() != 1 ? 'ες' : 'α');
}
}

@override
String minute(int amount, [bool abbreviated = true]) {
if (abbreviated) {
return 'λεπ';
} else {
return 'λεπτ' + (amount.abs() != 1 ? 'ά' : 'ό');
}
}

@override
String second(int amount, [bool abbreviated = true]) {
if (abbreviated) {
return 'δ';
} else {
return 'δευτερόλεπτ' + (amount.abs() != 1 ? 'α' : 'ο');
}
}

@override
String millisecond(int amount, [bool abbreviated = true]) {
if (abbreviated) {
return 'χ';
} else {
return 'χιλιοστ' + (amount.abs() != 1 ? 'ά' : 'ό');
}
}

@override
String microseconds(int amount, [bool abbreviated = true]) {
if (abbreviated) {
return 'μ';
} else {
return 'μικροδευτερόλεπτ' + (amount.abs() != 1 ? 'α' : 'ο');
}
}
}
5 changes: 5 additions & 0 deletions lib/src/locale/locale.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:duration/duration.dart';

part 'english.dart';
part 'french.dart';
part 'greek.dart';
part 'hebrew.dart';
part 'polish.dart';
part 'portuguese_br.dart';
Expand Down Expand Up @@ -101,6 +102,9 @@ const EnglishDurationLocale englishLocale = EnglishDurationLocale();
/// [DurationLocale] for French language
const FrenchDurationLocale frenchLocale = FrenchDurationLocale();

/// [DurationLocale] for Greek language
const GreekDurationLocale greekLocale = GreekDurationLocale();

/// [DurationLocale] for Hebrew language
const HebrewDurationLocale hebrewLocale = HebrewDurationLocale();

Expand Down Expand Up @@ -174,6 +178,7 @@ const JapaneseDurationLocale japaneseLocale = JapaneseDurationLocale();
const UkrainianDurationLocale ukrainianLocale = UkrainianDurationLocale();

const _locales = <String, DurationLocale>{
'el': greekLocale,
'en': englishLocale,
'fr': frenchLocale,
'he': hebrewLocale,
Expand Down