fix: 1、修复国家化繁体台湾、繁体香港问题
This commit is contained in:
parent
2442e599b6
commit
ff1932689a
@ -4,7 +4,7 @@ import 'flavors.dart';
|
||||
import 'main.dart' as runner;
|
||||
|
||||
Future<void> main() async {
|
||||
F.appFlavor = Flavor.sky;
|
||||
F.appFlavor = Flavor.xhj;
|
||||
// AppLog.log('local调用了main函数');
|
||||
await runner.main();
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import 'package:star_lock/mine/mineMultiLanguage/mineMultiLanguage_state.dart';
|
||||
import 'package:star_lock/translations/current_locale_tool.dart';
|
||||
|
||||
import '../../app_settings/app_colors.dart';
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../../tools/commonItem.dart';
|
||||
import '../../tools/titleAppBar.dart';
|
||||
import '../../translations/app_dept.dart';
|
||||
@ -86,6 +87,8 @@ class _MineMultiLanguagePageState extends State<MineMultiLanguagePage> {
|
||||
|
||||
if (state.currentLanguageType.value == lanType) {
|
||||
state.seletLocale = e;
|
||||
AppLog.log(
|
||||
'e:$e lanType:$lanType state.currentLanguageType.value:${state.currentLanguageType.value} Get.locale!.languageCode:${Get.locale!.languageCode} Get.locale!.countryCode:${Get.locale!.countryCode}');
|
||||
}
|
||||
l.add(
|
||||
CommonItem(
|
||||
|
||||
@ -4,20 +4,21 @@ import 'package:star_lock/app_settings/app_settings.dart';
|
||||
|
||||
import '../../tools/store_service.dart';
|
||||
import '../../translations/app_dept.dart';
|
||||
import '../../translations/current_locale_tool.dart';
|
||||
|
||||
class MineMultiLanguageState {
|
||||
// MineMultiLanguageState() {
|
||||
// resetLan();
|
||||
// }
|
||||
MineMultiLanguageState() {}
|
||||
|
||||
List<Locale> get languages {
|
||||
return appDept.deptSupportedLocales;
|
||||
}
|
||||
|
||||
Rx<LanguageType> currentLanguageType =
|
||||
StoreService.to.getLanguageCode()!.isEmpty
|
||||
? LanguageType.system.obs
|
||||
: ExtensionLanguageType.fromLocale(Get.locale!).obs;
|
||||
Rx<LanguageType> currentLanguageType = StoreService.to
|
||||
.getLanguageCode()!
|
||||
.isEmpty
|
||||
? LanguageType.system.obs
|
||||
: ExtensionLanguageType.fromLocale(CurrentLocaleTool.getCurrentLocale())
|
||||
.obs;
|
||||
|
||||
late Locale seletLocale;
|
||||
}
|
||||
|
||||
@ -8,18 +8,15 @@ import 'app_dept.dart';
|
||||
class CurrentLocaleTool {
|
||||
/// 获取当前语言的Locale字符串,没有的话获取系统的
|
||||
static String getCurrentLocaleString() {
|
||||
final Locale locale = StoreService.to.getLanguageCode()!.isNotEmpty
|
||||
final String languageCode = StoreService.to.getLanguageCode()!.isNotEmpty
|
||||
? appDept.deptSupportedLocales
|
||||
.where((Locale element) =>
|
||||
element.languageCode.toString() ==
|
||||
getCurrentLocaleWithLanguageCode(
|
||||
StoreService.to.getLanguageCode()!)
|
||||
.languageCode)
|
||||
element.toString() == StoreService.to.getLanguageCode()!)
|
||||
.first
|
||||
: Get.deviceLocale!; // Get.deviceLocale;
|
||||
final String languageCode = convertLocale(locale).toString();
|
||||
// AppLog.log(
|
||||
// '11111locale.toString(): ${locale.toString()} locale: $locale languageCode:$languageCode 从本地获取code:${StoreService.to.getLanguageCode()}');
|
||||
.toString()
|
||||
: convertLocale(Get.deviceLocale!).toString(); // Get.deviceLocale;
|
||||
// final String languageCode = convertLocale(locale).toString();
|
||||
// AppLog.log('11111locale.toString(): ${locale.toString()} locale: $locale languageCode:$languageCode 从本地获取code:${StoreService.to.getLanguageCode()}');
|
||||
return languageCode;
|
||||
}
|
||||
|
||||
@ -28,15 +25,12 @@ class CurrentLocaleTool {
|
||||
final Locale locale = StoreService.to.getLanguageCode()!.isNotEmpty
|
||||
? appDept.deptSupportedLocales
|
||||
.where((Locale element) =>
|
||||
element.languageCode.toString() ==
|
||||
getCurrentLocaleWithLanguageCode(
|
||||
StoreService.to.getLanguageCode()!)
|
||||
.languageCode)
|
||||
element.toString() == StoreService.to.getLanguageCode()!)
|
||||
.first
|
||||
: Get.deviceLocale!; // Get.deviceLocale;
|
||||
final Locale getLocale = convertLocale(locale);
|
||||
// AppLog.log(
|
||||
// '222locale.toString(): ${locale.toString()} locale: $locale getLocale:$getLocale 从本地获取code:${StoreService.to.getLanguageCode()}');
|
||||
AppLog.log(
|
||||
'222locale.toString(): ${locale.toString()} locale: $locale getLocale:$getLocale 从本地获取code:${StoreService.to.getLanguageCode()}');
|
||||
return getLocale;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user