chore: add remaining translations
Signed-off-by: xsahil03x <xdsahil@gmail.com>
This commit is contained in:
@@ -5,32 +5,6 @@ import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||
import 'package:stream_chat_localizations/stream_chat_localizations.dart';
|
||||
|
||||
/// A custom set of localizations for the 'hi' locale.
|
||||
class StreamChatLocalizationsHi extends GlobalStreamChatLocalizations {
|
||||
const StreamChatLocalizationsHi() : super(localeName: 'hi');
|
||||
|
||||
static const LocalizationsDelegate<StreamChatLocalizations> delegate =
|
||||
_HindiStreamChatLocalizationsDelegate();
|
||||
|
||||
@override
|
||||
String get launchUrlError => 'URL लॉन्च नहीं कर सकता';
|
||||
}
|
||||
|
||||
class _HindiStreamChatLocalizationsDelegate
|
||||
extends LocalizationsDelegate<StreamChatLocalizations> {
|
||||
const _HindiStreamChatLocalizationsDelegate();
|
||||
|
||||
@override
|
||||
bool isSupported(Locale locale) => locale.languageCode == 'hi';
|
||||
|
||||
@override
|
||||
Future<StreamChatLocalizations> load(Locale locale) =>
|
||||
SynchronousFuture(const StreamChatLocalizationsHi());
|
||||
|
||||
@override
|
||||
bool shouldReload(_HindiStreamChatLocalizationsDelegate old) => false;
|
||||
}
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
@@ -96,18 +70,12 @@ class MyApp extends StatelessWidget {
|
||||
Widget build(BuildContext context) => MaterialApp(
|
||||
theme: ThemeData.light(),
|
||||
darkTheme: ThemeData.dark(),
|
||||
themeMode: ThemeMode.system,
|
||||
supportedLocales: [
|
||||
Locale('en', 'US'),
|
||||
Locale('hi', 'IN'),
|
||||
],
|
||||
localizationsDelegates: [
|
||||
GlobalStreamChatLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
StreamChatLocalizationsHi.delegate,
|
||||
],
|
||||
localizationsDelegates: const [
|
||||
GlobalStreamChatLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
],
|
||||
builder: (context, widget) => StreamChat(
|
||||
client: client,
|
||||
child: widget,
|
||||
|
||||
@@ -76,7 +76,7 @@ class FileAttachment extends AttachmentWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
attachment.title ?? 'File',
|
||||
attachment.title ?? context.translations.fileText,
|
||||
style: StreamChatTheme.of(context).textTheme.bodyBold,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
|
||||
@@ -200,7 +200,7 @@ class _FullScreenMediaState extends State<FullScreenMedia>
|
||||
);
|
||||
},
|
||||
),
|
||||
if (widget.message.type != 'ephemeral')
|
||||
if (!widget.message.isEphemeral)
|
||||
GalleryFooter(
|
||||
currentPage: _currentPage,
|
||||
totalPages: widget.mediaAttachments.length,
|
||||
|
||||
@@ -136,7 +136,9 @@ class _GalleryFooterState extends State<GalleryFooter> {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'${widget.currentPage + 1} of ${widget.totalPages}',
|
||||
'${widget.currentPage + 1} '
|
||||
'${context.translations.ofText} '
|
||||
'${widget.totalPages}',
|
||||
style: galleryFooterThemeData.titleTextStyle,
|
||||
),
|
||||
],
|
||||
|
||||
@@ -67,7 +67,7 @@ class GalleryHeader extends StatelessWidget implements PreferredSizeWidget {
|
||||
: const SizedBox(),
|
||||
backgroundColor: galleryHeaderThemeData.backgroundColor,
|
||||
actions: <Widget>[
|
||||
if (message.type != 'ephemeral')
|
||||
if (!message.isEphemeral)
|
||||
IconButton(
|
||||
icon: StreamSvgIcon.iconMenuPoint(
|
||||
color: galleryHeaderThemeData.iconMenuPointColor,
|
||||
@@ -78,7 +78,7 @@ class GalleryHeader extends StatelessWidget implements PreferredSizeWidget {
|
||||
),
|
||||
],
|
||||
centerTitle: true,
|
||||
title: message.type != 'ephemeral'
|
||||
title: !message.isEphemeral
|
||||
? InkWell(
|
||||
onTap: onTitleTap,
|
||||
child: SizedBox(
|
||||
|
||||
@@ -190,6 +190,16 @@ abstract class Translations {
|
||||
String get shuffleLabel;
|
||||
|
||||
String get sendLabel;
|
||||
|
||||
String get withText;
|
||||
|
||||
String get inText;
|
||||
|
||||
String get youText;
|
||||
|
||||
String get ofText;
|
||||
|
||||
String get fileText;
|
||||
}
|
||||
|
||||
class DefaultTranslations implements Translations {
|
||||
@@ -514,4 +524,19 @@ class DefaultTranslations implements Translations {
|
||||
|
||||
@override
|
||||
String get sendLabel => 'Send';
|
||||
|
||||
@override
|
||||
String get withText => 'with';
|
||||
|
||||
@override
|
||||
String get inText => 'in';
|
||||
|
||||
@override
|
||||
String get youText => 'You';
|
||||
|
||||
@override
|
||||
String get ofText => 'of';
|
||||
|
||||
@override
|
||||
String get fileText => 'File';
|
||||
}
|
||||
|
||||
@@ -2254,10 +2254,10 @@ class _PickerWidget extends StatefulWidget {
|
||||
final StreamChatThemeData streamChatTheme;
|
||||
|
||||
@override
|
||||
__PickerWidgetState createState() => __PickerWidgetState();
|
||||
_PickerWidgetState createState() => _PickerWidgetState();
|
||||
}
|
||||
|
||||
class __PickerWidgetState extends State<_PickerWidget> {
|
||||
class _PickerWidgetState extends State<_PickerWidget> {
|
||||
Future<bool>? requestPermission;
|
||||
|
||||
@override
|
||||
|
||||
@@ -50,12 +50,14 @@ class MessageSearchItem extends StatelessWidget {
|
||||
title: Row(
|
||||
children: [
|
||||
Text(
|
||||
user.id == StreamChat.of(context).user?.id ? 'You' : user.name,
|
||||
user.id == StreamChat.of(context).user?.id
|
||||
? context.translations.youText
|
||||
: user.name,
|
||||
style: chatThemeData.channelPreviewTheme.title,
|
||||
),
|
||||
if (channelName != null) ...[
|
||||
Text(
|
||||
' in ',
|
||||
' ${context.translations.inText} ',
|
||||
style: chatThemeData.channelPreviewTheme.title?.copyWith(
|
||||
fontWeight: FontWeight.normal,
|
||||
),
|
||||
|
||||
@@ -43,15 +43,10 @@ class MessageText extends StatelessWidget {
|
||||
final mentionedUser = message.mentionedUsers.firstWhereOrNull(
|
||||
(u) => '@${u.name}' == link,
|
||||
);
|
||||
if (mentionedUser == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (onMentionTap != null) {
|
||||
onMentionTap!(mentionedUser);
|
||||
} else {
|
||||
print('tap on ${mentionedUser.name}');
|
||||
}
|
||||
if (mentionedUser == null) return;
|
||||
|
||||
onMentionTap?.call(mentionedUser);
|
||||
} else {
|
||||
if (onLinkTap != null) {
|
||||
onLinkTap!(link);
|
||||
|
||||
@@ -13,8 +13,8 @@ class SystemMessage extends StatelessWidget {
|
||||
/// This message
|
||||
final Message message;
|
||||
|
||||
// ignore: lines_longer_than_80_chars
|
||||
/// The function called when tapping on the message when the message is not failed
|
||||
/// The function called when tapping on the message
|
||||
/// when the message is not failed
|
||||
final void Function(Message)? onMessageTap;
|
||||
|
||||
@override
|
||||
|
||||
@@ -112,7 +112,7 @@ class ThreadHeader extends StatelessWidget implements PreferredSizeWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'with ',
|
||||
'${context.translations.withText} ',
|
||||
style: chatThemeData.channelTheme.channelHeaderTheme.subtitle,
|
||||
),
|
||||
Flexible(
|
||||
|
||||
@@ -323,4 +323,19 @@ class StreamChatLocalizationsEn extends GlobalStreamChatLocalizations {
|
||||
|
||||
@override
|
||||
String get sendLabel => 'Send';
|
||||
|
||||
@override
|
||||
String get withText => 'with';
|
||||
|
||||
@override
|
||||
String get inText => 'in';
|
||||
|
||||
@override
|
||||
String get youText => 'You';
|
||||
|
||||
@override
|
||||
String get ofText => 'of';
|
||||
|
||||
@override
|
||||
String get fileText => 'File';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user