From 59b4f5568c77ccae4b56d919216bd82058050ffb Mon Sep 17 00:00:00 2001 From: Sacha Arbonel Date: Mon, 2 Aug 2021 15:30:58 -0400 Subject: [PATCH] breaking change: ofText->galleryPaginationText --- .../lib/src/gallery_footer.dart | 6 ++--- .../lib/src/localization/translations.dart | 9 ++++--- .../test/src/default_translations_test.dart | 2 +- .../example/lib/add_new_lang.dart | 4 +++- .../lib/src/stream_chat_localizations_en.dart | 4 +++- .../lib/src/stream_chat_localizations_es.dart | 7 ++++-- .../lib/src/stream_chat_localizations_fr.dart | 4 +++- .../lib/src/stream_chat_localizations_hi.dart | 8 ++++--- .../lib/src/stream_chat_localizations_it.dart | 4 +++- .../lib/src/stream_chat_localizations_ja.dart | 24 +++++++------------ .../test/translations_test.dart | 2 +- 11 files changed, 42 insertions(+), 32 deletions(-) diff --git a/packages/stream_chat_flutter/lib/src/gallery_footer.dart b/packages/stream_chat_flutter/lib/src/gallery_footer.dart index 03d575ae..6df301d3 100644 --- a/packages/stream_chat_flutter/lib/src/gallery_footer.dart +++ b/packages/stream_chat_flutter/lib/src/gallery_footer.dart @@ -136,9 +136,9 @@ class _GalleryFooterState extends State { mainAxisSize: MainAxisSize.min, children: [ Text( - '${widget.currentPage + 1} ' - '${context.translations.ofText} ' - '${widget.totalPages}', + context.translations.galleryPaginationText( + currentPage: widget.currentPage, + totalPages: widget.totalPages), style: galleryFooterThemeData.titleTextStyle, ), ], diff --git a/packages/stream_chat_flutter/lib/src/localization/translations.dart b/packages/stream_chat_flutter/lib/src/localization/translations.dart index d6e5add0..d3b3e8cb 100644 --- a/packages/stream_chat_flutter/lib/src/localization/translations.dart +++ b/packages/stream_chat_flutter/lib/src/localization/translations.dart @@ -296,8 +296,9 @@ abstract class Translations { /// The text shown for "You" String get youText; - /// The text shown for "Of" - String get ofText; + /// Gallery footer pagination text + String galleryPaginationText( + {required int currentPage, required int totalPages}); /// The text shown for "File" String get fileText; @@ -657,7 +658,9 @@ class DefaultTranslations implements Translations { String get youText => 'You'; @override - String get ofText => 'of'; + String galleryPaginationText( + {required int currentPage, required int totalPages}) => + '${currentPage + 1} of $totalPages'; @override String get fileText => 'File'; diff --git a/packages/stream_chat_flutter/test/src/default_translations_test.dart b/packages/stream_chat_flutter/test/src/default_translations_test.dart index e78c0115..14a4a318 100644 --- a/packages/stream_chat_flutter/test/src/default_translations_test.dart +++ b/packages/stream_chat_flutter/test/src/default_translations_test.dart @@ -167,7 +167,7 @@ void main() { expect(translations.withText, isNotNull); expect(translations.inText, isNotNull); expect(translations.youText, isNotNull); - expect(translations.ofText, isNotNull); + expect(translations.galleryPaginationText, isNotNull); expect(translations.fileText, isNotNull); expect(translations.replyToMessageLabel, isNotNull); }); diff --git a/packages/stream_chat_localizations/example/lib/add_new_lang.dart b/packages/stream_chat_localizations/example/lib/add_new_lang.dart index 1412f4e0..2f373691 100644 --- a/packages/stream_chat_localizations/example/lib/add_new_lang.dart +++ b/packages/stream_chat_localizations/example/lib/add_new_lang.dart @@ -374,7 +374,9 @@ class NnStreamChatLocalizations extends GlobalStreamChatLocalizations { String get youText => 'You'; @override - String get ofText => 'of'; + String galleryPaginationText( + {required int currentPage, required int totalPages}) => + '$currentPage of $totalPages'; @override String get fileText => 'File'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart index 5041d398..13de9729 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart @@ -350,7 +350,9 @@ class StreamChatLocalizationsEn extends GlobalStreamChatLocalizations { String get youText => 'You'; @override - String get ofText => 'of'; + String galleryPaginationText( + {required int currentPage, required int totalPages}) => + '${currentPage + 1} of $totalPages'; @override String get fileText => 'File'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_es.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_es.dart index 75bed1e3..f6cd5e7c 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_es.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_es.dart @@ -68,7 +68,8 @@ class StreamChatLocalizationsEs extends GlobalStreamChatLocalizations { String get genericErrorText => 'Hubo un problema'; @override - String get loadingMessagesError => 'Hubo un error mientras se cargaba el mensaje'; + String get loadingMessagesError => + 'Hubo un error mientras se cargaba el mensaje'; @override String resultCountText(int count) => '$count resultados'; @@ -354,7 +355,9 @@ class StreamChatLocalizationsEs extends GlobalStreamChatLocalizations { String get youText => 'Usted'; @override - String get ofText => 'de'; + String galleryPaginationText( + {required int currentPage, required int totalPages}) => + '${currentPage + 1} de $totalPages'; @override String get fileText => 'Archivo'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart index 373558b9..2331b522 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart @@ -354,7 +354,9 @@ class StreamChatLocalizationsFr extends GlobalStreamChatLocalizations { String get youText => 'Vous'; @override - String galleryPaginationText({required int currentPage, required int totalPages}) => '${currentPage+1} de $totalPages'; + String galleryPaginationText( + {required int currentPage, required int totalPages}) => + '${currentPage + 1} de $totalPages'; @override String get fileText => 'Fichier'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart index 850e481b..11d7d486 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart @@ -340,16 +340,18 @@ class StreamChatLocalizationsHi extends GlobalStreamChatLocalizations { String get sendLabel => 'भेजें'; @override - String get withText => 'विद'; + String get withText => 'विद';//TODO: break? @override - String get inText => 'इन'; + String get inText => 'इन';//TODO: break? @override String get youText => 'आप'; @override - String get ofText => 'ऑफ़'; + String galleryPaginationText( + {required int currentPage, required int totalPages}) => + '${currentPage + 1} ऑफ़ $totalPages'; @override String get fileText => 'फ़ाइल'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart index 8b2e1692..313e1e26 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart @@ -351,7 +351,9 @@ Il file è troppo grande per essere caricato. Il limite è di $limitInMB MB.'''; String get youText => 'te'; @override - String get ofText => 'di'; + String galleryPaginationText( + {required int currentPage, required int totalPages}) => + '${currentPage + 1} di $totalPages'; @override String get fileText => 'file'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ja.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ja.dart index 96ffec25..6522fbf7 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ja.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ja.dart @@ -177,8 +177,7 @@ class StreamChatLocalizationsJa extends GlobalStreamChatLocalizations { String get flagMessageSuccessfulLabel => 'フラグ付メッセージ'; @override - String get flagMessageSuccessfulText => - 'このメッセージはモデレーターに報告されました。'; + String get flagMessageSuccessfulText => 'このメッセージはモデレーターに報告されました。'; @override String get deleteLabel => '消す'; @@ -187,13 +186,11 @@ class StreamChatLocalizationsJa extends GlobalStreamChatLocalizations { String get deleteMessageLabel => 'メッセージを削除する '; @override - String get deleteMessageQuestion => - 'このメッセージ' + String get deleteMessageQuestion => 'このメッセージ' '\nを完全に削除してもよろしいですか?'; @override - String get operationCouldNotBeCompletedText => - '操作を完了できませんでした。'; + String get operationCouldNotBeCompletedText => '操作を完了できませんでした。'; @override String get replyLabel => '返信'; @@ -261,8 +258,7 @@ class StreamChatLocalizationsJa extends GlobalStreamChatLocalizations { String get letsStartChattingLabel => 'さあ、チャットを始めよう'; @override - String get sendingFirstMessageLabel => - 'どのように友人にあなたの最初のメッセージを送ることについてはどうですか?'; + String get sendingFirstMessageLabel => 'どのように友人にあなたの最初のメッセージを送ることについてはどうですか?'; @override String get startAChatLabel => 'チャットを開始する'; @@ -274,8 +270,7 @@ class StreamChatLocalizationsJa extends GlobalStreamChatLocalizations { String get deleteConversationLabel => '会話を削除する'; @override - String get deleteConversationQuestion => - 'この会話を削除してもよろしいですか?'; + String get deleteConversationQuestion => 'この会話を削除してもよろしいですか?'; @override String get streamChatLabel => 'ストリームチャット'; @@ -314,8 +309,7 @@ class StreamChatLocalizationsJa extends GlobalStreamChatLocalizations { String get leaveConversationLabel => '会話を離れる'; @override - String get leaveConversationQuestion => - 'この会話を離れてもよろしいですか?'; + String get leaveConversationQuestion => 'この会話を離れてもよろしいですか?'; @override String get showInChatLabel => 'チャットで表示'; @@ -348,9 +342,9 @@ class StreamChatLocalizationsJa extends GlobalStreamChatLocalizations { String get youText => '君'; @override - String get ofText => 'の';//TODO: break - // galleryPaginationText( - // {required int currentPage, required int totalPages}) + String galleryPaginationText( + {required int currentPage, required int totalPages}) => + '$totalPagesの${currentPage + 1}'; @override String get fileText => 'ファイル'; diff --git a/packages/stream_chat_localizations/test/translations_test.dart b/packages/stream_chat_localizations/test/translations_test.dart index 0e621159..c7314a58 100644 --- a/packages/stream_chat_localizations/test/translations_test.dart +++ b/packages/stream_chat_localizations/test/translations_test.dart @@ -174,7 +174,7 @@ void main() { expect(localizations.withText, isNotNull); expect(localizations.inText, isNotNull); expect(localizations.youText, isNotNull); - expect(localizations.ofText, isNotNull); + expect(localizations.galleryPaginationText, isNotNull); expect(localizations.fileText, isNotNull); expect(localizations.replyToMessageLabel, isNotNull); });