From ad8ddba6a71ebb3c025edcff6d2b69bc321e9e7f Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 21 Jul 2021 17:44:51 +0530 Subject: [PATCH] chore(ui,localization): add translations for `replyToMessageLabel` Signed-off-by: xsahil03x --- packages/stream_chat_flutter/example/lib/main.dart | 12 ++---------- .../lib/src/localization/translations.dart | 5 +++++ .../stream_chat_flutter/lib/src/message_input.dart | 6 +++--- .../lib/src/stream_chat_localizations_en.dart | 3 +++ .../lib/src/stream_chat_localizations_hi.dart | 3 +++ 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/packages/stream_chat_flutter/example/lib/main.dart b/packages/stream_chat_flutter/example/lib/main.dart index d643dfea..f7609f6b 100644 --- a/packages/stream_chat_flutter/example/lib/main.dart +++ b/packages/stream_chat_flutter/example/lib/main.dart @@ -70,16 +70,8 @@ class MyApp extends StatelessWidget { Widget build(BuildContext context) => MaterialApp( theme: ThemeData.light(), darkTheme: ThemeData.dark(), - supportedLocales: const [ - Locale('en'), - Locale('hi'), - ], - localizationsDelegates: const [ - GlobalStreamChatLocalizations.delegate, - GlobalCupertinoLocalizations.delegate, - GlobalMaterialLocalizations.delegate, - GlobalWidgetsLocalizations.delegate, - ], + supportedLocales: const [Locale('en'), Locale('hi')], + localizationsDelegates: GlobalStreamChatLocalizations.delegates, builder: (context, widget) => StreamChat( client: client, child: widget, diff --git a/packages/stream_chat_flutter/lib/src/localization/translations.dart b/packages/stream_chat_flutter/lib/src/localization/translations.dart index 4344dc8a..7ce7a507 100644 --- a/packages/stream_chat_flutter/lib/src/localization/translations.dart +++ b/packages/stream_chat_flutter/lib/src/localization/translations.dart @@ -196,6 +196,8 @@ abstract class Translations { String get ofText; String get fileText; + + String get replyToMessageLabel; } class DefaultTranslations implements Translations { @@ -548,4 +550,7 @@ class DefaultTranslations implements Translations { @override String get fileText => 'File'; + + @override + String get replyToMessageLabel => 'Reply to Message'; } diff --git a/packages/stream_chat_flutter/lib/src/message_input.dart b/packages/stream_chat_flutter/lib/src/message_input.dart index e5e6ca48..9d9ada07 100644 --- a/packages/stream_chat_flutter/lib/src/message_input.dart +++ b/packages/stream_chat_flutter/lib/src/message_input.dart @@ -357,9 +357,9 @@ class MessageInputState extends State { color: _streamChatTheme.colorTheme.disabled, ), ), - const Text( - 'Reply to Message', - style: TextStyle(fontWeight: FontWeight.bold), + Text( + context.translations.replyToMessageLabel, + style: const TextStyle(fontWeight: FontWeight.bold), ), IconButton( visualDensity: VisualDensity.compact, 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 88b88840..2cd88989 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 @@ -351,4 +351,7 @@ class StreamChatLocalizationsEn extends GlobalStreamChatLocalizations { @override String get fileText => 'File'; + + @override + String get replyToMessageLabel => 'Reply to Message'; } 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 5666b77d..c4c4a33a 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 @@ -350,4 +350,7 @@ class StreamChatLocalizationsHi extends GlobalStreamChatLocalizations { @override String get fileText => 'फ़ाइल'; + + @override + String get replyToMessageLabel => 'संदेश का जवाब'; }