minor changes
This commit is contained in:
@@ -30,15 +30,15 @@ const kStreamChatSupportedLanguages = {'en'};
|
|||||||
/// Generally speaking, this method is only intended to be used by
|
/// Generally speaking, this method is only intended to be used by
|
||||||
/// [GlobalStreamChatLocalizations.delegate].
|
/// [GlobalStreamChatLocalizations.delegate].
|
||||||
GlobalStreamChatLocalizations? getStreamChatTranslation(Locale locale) {
|
GlobalStreamChatLocalizations? getStreamChatTranslation(Locale locale) {
|
||||||
|
final languageCode = locale.languageCode;
|
||||||
|
assert(
|
||||||
|
kStreamChatSupportedLanguages.contains(languageCode),
|
||||||
|
'getStreamChatTranslation() called for unsupported locale "$locale"',
|
||||||
|
);
|
||||||
switch (locale.languageCode) {
|
switch (locale.languageCode) {
|
||||||
case 'en':
|
case 'en':
|
||||||
return const StreamChatLocalizationsEn();
|
return const StreamChatLocalizationsEn();
|
||||||
}
|
}
|
||||||
assert(
|
|
||||||
false,
|
|
||||||
'getStreamChatTranslation() called for unsupported locale "$locale"',
|
|
||||||
);
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Implementation of localized strings for the stream chat widgets
|
/// Implementation of localized strings for the stream chat widgets
|
||||||
@@ -134,8 +134,7 @@ class _StreamChatLocalizationsDelegate
|
|||||||
assert(isSupported(locale), '');
|
assert(isSupported(locale), '');
|
||||||
return _loadedTranslations.putIfAbsent(
|
return _loadedTranslations.putIfAbsent(
|
||||||
locale,
|
locale,
|
||||||
() =>
|
() => SynchronousFuture<StreamChatLocalizations>(
|
||||||
SynchronousFuture<StreamChatLocalizations>(
|
|
||||||
getStreamChatTranslation(locale)!,
|
getStreamChatTranslation(locale)!,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user