33 lines
948 B
Dart
33 lines
948 B
Dart
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;
|
|
}
|
|
}
|