[mob] Use custom assetPickerTextDelegate to use en as default (#1844)
## Description ## Tests Tested locally
This commit is contained in:
commit
3c8d29bcdc
1 changed files with 40 additions and 1 deletions
|
@ -167,7 +167,13 @@ class AddPhotosPhotoWidget extends StatelessWidget {
|
|||
|
||||
Future<void> _onPickFromDeviceClicked(BuildContext context) async {
|
||||
try {
|
||||
final List<AssetEntity>? result = await AssetPicker.pickAssets(context);
|
||||
final assetPickerTextDelegate = await _getAssetPickerTextDelegate();
|
||||
final List<AssetEntity>? result = await AssetPicker.pickAssets(
|
||||
context,
|
||||
pickerConfig: AssetPickerConfig(
|
||||
textDelegate: assetPickerTextDelegate,
|
||||
),
|
||||
);
|
||||
if (result != null && result.isNotEmpty) {
|
||||
final ca = CollectionActions(
|
||||
CollectionsService.instance,
|
||||
|
@ -204,6 +210,39 @@ class AddPhotosPhotoWidget extends StatelessWidget {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// _getAssetPickerTextDelegate returns the text delegate for the asset picker
|
||||
// This custom method is required to enforce English as the default fallback
|
||||
// instead of Chinese.
|
||||
Future<AssetPickerTextDelegate> _getAssetPickerTextDelegate() async {
|
||||
final Locale locale = await getLocale();
|
||||
switch (locale.languageCode.toLowerCase()) {
|
||||
case "en":
|
||||
return const EnglishAssetPickerTextDelegate();
|
||||
case "he":
|
||||
return const HebrewAssetPickerTextDelegate();
|
||||
case "de":
|
||||
return const GermanAssetPickerTextDelegate();
|
||||
case "ru":
|
||||
return const RussianAssetPickerTextDelegate();
|
||||
case "ja":
|
||||
return const JapaneseAssetPickerTextDelegate();
|
||||
case "ar":
|
||||
return const ArabicAssetPickerTextDelegate();
|
||||
case "fr":
|
||||
return const FrenchAssetPickerTextDelegate();
|
||||
case "vi":
|
||||
return const VietnameseAssetPickerTextDelegate();
|
||||
case "tr":
|
||||
return const TurkishAssetPickerTextDelegate();
|
||||
case "ko":
|
||||
return const KoreanAssetPickerTextDelegate();
|
||||
case "zh":
|
||||
return const AssetPickerTextDelegate();
|
||||
default:
|
||||
return const EnglishAssetPickerTextDelegate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class DelayedGallery extends StatefulWidget {
|
||||
|
|
Loading…
Reference in a new issue