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