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 Italian locale messages #26

Closed
wants to merge 10 commits into from
Closed
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
1 change: 1 addition & 0 deletions lib/get_time_ago.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export 'package:get_time_ago/src/_get_time_ago.dart';
export 'package:get_time_ago/src/messages/languages/it_msg.dart';
export 'package:get_time_ago/src/messages/languages/ar_msg.dart';
export 'package:get_time_ago/src/messages/languages/de_msg.dart';
export 'package:get_time_ago/src/messages/languages/en_msg.dart';
Expand Down
6 changes: 4 additions & 2 deletions lib/src/_get_time_ago.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:get_time_ago/src/messages/languages/ar_msg.dart';
import 'package:get_time_ago/src/messages/languages/de_msg.dart';
import 'package:get_time_ago/src/messages/languages/en_msg.dart';
import 'package:get_time_ago/src/messages/languages/es_msg.dart';
import 'package:get_time_ago/src/messages/languages/it_msg.dart';
import 'package:get_time_ago/src/messages/languages/fa_msg.dart';
import 'package:get_time_ago/src/messages/languages/fr_msg.dart';
import 'package:get_time_ago/src/messages/languages/hi_msg.dart';
Expand Down Expand Up @@ -38,6 +39,7 @@ class GetTimeAgo {
'ko': KoreanMessages(),
'de': GermanMessages(),
'id': IndonesianMessages(),
'it' :ItalianMessages(),
'tr': TurkishMessages(),
'ur': UrduMessages(),
'vi': VietnameseMessages(),
Expand Down Expand Up @@ -90,8 +92,8 @@ class GetTimeAgo {
}) {
final _locale = locale ?? _defaultLocale;
final _message = _messageMap[_locale] ?? EnglishMessages();
final _pattern = pattern ?? "dd MMM, yyyy hh:mm aa";
final date = DateFormat(_pattern).format(dateTime);
final _pattern = locale == "en" ? (pattern ?? "dd MMM yyyy HH:mm aa") : (pattern ?? "dd MMM yyyy HH:mm");
final date = DateFormat(_pattern, locale).format(dateTime);
var _currentClock = DateTime.now();
var elapsed =
(_currentClock.millisecondsSinceEpoch - dateTime.millisecondsSinceEpoch)
Expand Down
34 changes: 34 additions & 0 deletions lib/src/messages/languages/it_msg.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import '../../utils/utility.dart';
import '../messages.dart';

class ItalianMessages implements Messages {
@override
String prefixAgo() => '';

@override
String suffixAgo() => 'fa';

@override
String secsAgo(int seconds) => '$seconds secondi';

@override
String minAgo(int minutes) => 'un minuto';

@override
String minsAgo(int minutes) => '$minutes minuti';

@override
String hourAgo(int minutes) => 'un ora';

@override
String hoursAgo(int hours) => '$hours ore';

@override
String dayAgo(int hours) => 'un giorno';

@override
String daysAgo(int days) => '$days giorni';

@override
String wordSeparator() => ' ';
}
Loading