更新法语语言包
This commit is contained in:
@@ -121,6 +121,19 @@ class CityModelController extends GetControllerEx<CityModel> {
|
||||
return jsonList.map((json) => CityModel.fromJson(json)).toList();
|
||||
} catch (e) {
|
||||
ef.log("_loadCityData 失败:$e");
|
||||
String currentLanguageCode = "en_US";
|
||||
|
||||
// 根据当前语言代码构建文件名
|
||||
final String fileName = 'assets/city/city_$currentLanguageCode.json';
|
||||
|
||||
// 读取对应语言的JSON文件
|
||||
final String jsonString = await rootBundle.loadString(fileName);
|
||||
|
||||
// 解析JSON数据并转换为 CityModel 列表
|
||||
final List<dynamic> jsonList = jsonDecode(jsonString);
|
||||
|
||||
// 将 Map 转换为 CityModel
|
||||
return jsonList.map((json) => CityModel.fromJson(json)).toList();
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user