feat(picker): 统一安卓相册名称本地化
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:wechat_assets_picker/wechat_assets_picker.dart';
|
||||
|
||||
abstract final class AssetPickerLocalization {
|
||||
static String pathName(
|
||||
BuildContext context,
|
||||
AssetPathEntity path,
|
||||
) {
|
||||
final Locale locale = Localizations.maybeLocaleOf(context) ??
|
||||
WidgetsBinding.instance.platformDispatcher.locale;
|
||||
if (locale.languageCode.toLowerCase() != 'zh') {
|
||||
return path.name;
|
||||
}
|
||||
if (path.isAll) {
|
||||
return '最近项目';
|
||||
}
|
||||
|
||||
const Map<String, String> systemPathNames = <String, String>{
|
||||
'recent': '最近项目',
|
||||
'recents': '最近项目',
|
||||
'camera': '相机',
|
||||
'camera roll': '相机',
|
||||
'screenshot': '截屏',
|
||||
'screenshots': '截屏',
|
||||
'download': '下载',
|
||||
'downloads': '下载',
|
||||
'pictures': '图片',
|
||||
'movies': '视频',
|
||||
};
|
||||
return systemPathNames[path.name.trim().toLowerCase()] ?? path.name;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user