更新默认本地语言
This commit is contained in:
@@ -5,6 +5,8 @@ import 'package:ef/ef.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
import 'package:vbvs_app/enum/APPPackageType.dart';
|
||||
import 'package:vbvs_app/language/AppLanguage.dart';
|
||||
|
||||
part 'mh_language_controller.g.dart'; // 由json_serializable自动生成的部分
|
||||
@@ -47,10 +49,25 @@ class MHLanguageController extends GetControllerEx<MHLanguageModel> {
|
||||
final Map<String, dynamic> manifestMap = json.decode(manifestContent);
|
||||
|
||||
// 筛选出 langs 目录下的 .json 文件
|
||||
final langFiles = manifestMap.keys
|
||||
.where((String key) =>
|
||||
key.startsWith('assets/mhlangs/') && key.endsWith('.json'))
|
||||
.toList();
|
||||
|
||||
int code = AppConstants().ent_type;
|
||||
final langFiles;
|
||||
if (APPPackageType.TH.code == code) {
|
||||
langFiles = manifestMap.keys
|
||||
.where((String key) =>
|
||||
key.startsWith('assets/langs/') && key.endsWith('.json'))
|
||||
.toList();
|
||||
} else if (APPPackageType.MHT.code == code) {
|
||||
langFiles = manifestMap.keys
|
||||
.where((String key) =>
|
||||
key.startsWith('assets/mhlangs/') && key.endsWith('.json'))
|
||||
.toList();
|
||||
} else {
|
||||
langFiles = manifestMap.keys
|
||||
.where((String key) =>
|
||||
key.startsWith('assets/langs/') && key.endsWith('.json'))
|
||||
.toList();
|
||||
}
|
||||
|
||||
// 2. 遍历所有语言文件
|
||||
for (final filePath in langFiles) {
|
||||
|
||||
Reference in New Issue
Block a user