Add zh_CN

This commit is contained in:
2024-06-02 12:03:33 +00:00
committed by GitHub
parent cc67380afe
commit 26415d9349
5 changed files with 6 additions and 17 deletions

View File

@@ -317,7 +317,7 @@ enum Lang {
case Lang.english:
return const Locale("en");
case Lang.simplifiedChinese:
return const Locale("zh");
return const Locale("zh", "CN");
default:
return PlatformDispatcher.instance.locale;
}

3
lib/l10n/app_zh_CN.arb Normal file
View File

@@ -0,0 +1,3 @@
{
"@@locale": "zh_CN"
}

View File

@@ -1,4 +1,3 @@
import 'package:chinese_font_library/chinese_font_library.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
@@ -336,8 +335,8 @@ class MainApp extends StatefulWidget {
class _MainApp extends State<MainApp> with WidgetsBindingObserver {
ThemeMode _themeMode = ThemeMode.system;
ThemeData _themeData = ThemeData(useMaterial3: true);
ThemeData _darkThemeData = ThemeData.dark(useMaterial3: true);
final ThemeData _themeData = ThemeData(useMaterial3: true);
final ThemeData _darkThemeData = ThemeData.dark(useMaterial3: true);
ThemeMode get themeMode => _themeMode;
Lang _lang = Lang.system;
Lang get lang => _lang;
@@ -357,10 +356,6 @@ class _MainApp extends State<MainApp> with WidgetsBindingObserver {
} catch (e) {
_log.warning("Failed to read lang from prefs:", e);
}
if (isWindows) {
_themeData = _themeData.useSystemChineseFont(Brightness.light);
_darkThemeData = _darkThemeData.useSystemChineseFont(Brightness.dark);
}
WidgetsBinding.instance.addObserver(this);
if (WidgetsBinding.instance.lifecycleState != null) {
_lifecycleState = WidgetsBinding.instance.lifecycleState;

View File

@@ -129,14 +129,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.3"
chinese_font_library:
dependency: "direct main"
description:
name: chinese_font_library
sha256: f6c18eb58c1514a95e4ed9a7e2f6702be1333b67e4226976b333e5918021c1df
url: "https://pub.dev"
source: hosted
version: "1.2.0"
clock:
dependency: transitive
description:

View File

@@ -7,7 +7,6 @@ environment:
sdk: '>=3.0.5 <4.0.0'
dependencies:
chinese_font_library: ^1.0.2
cryptography: ^2.5.0
cryptography_flutter: ^2.3.0
dio: ^5.3.2