Skip to content

Commit ae60c80

Browse files
committed
1
1 parent 62dcecd commit ae60c80

16 files changed

Lines changed: 315 additions & 91 deletions

assets/images/demo/fxck-chxxa.png

225 KB
Loading

docs/02-国旗图标使用指南.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
目前使用 **Unicode 国旗 Emoji** 方式,这是最简单且无需额外资源的方案:
66

77
- 🇨🇳 简体中文 (zh)
8-
- 🇭🇰 繁体中文 (zh_HK)
8+
- 🇹🇼 正體中文 (zh_TW)
99
- 🇺🇸 英文 (en)
1010
- 🇯🇵 日文 (ja)
1111
- 🌐 跟随系统

docs/03-架构与技术原理图.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ sequenceDiagram
9191
User->>UI: 输入IP地址/子网信息
9292
UI->>Provider: 更新输入状态
9393
Provider->>UI: 触发界面更新
94-
94+
9595
User->>UI: 点击计算按钮
9696
UI->>Service: 调用计算服务
9797
Service->>Service: 执行计算逻辑
9898
Service->>Provider: 返回计算结果
9999
Provider->>UI: 更新结果状态
100100
UI->>User: 显示计算结果
101-
101+
102102
User->>UI: 保存到历史记录
103103
UI->>Service: 调用历史服务
104104
Service->>Storage: 写入文件系统
@@ -194,7 +194,7 @@ graph TB
194194
graph TB
195195
subgraph "本地化文件"
196196
A[app_zh.arb<br/>简体中文] --> B[AppLocalizations<br/>本地化类]
197-
C[app_zh_HK.arb<br/>繁体中文] --> B
197+
C[app_zh_TW.arb<br/>正體中文] --> B
198198
D[app_en.arb<br/>英文] --> B
199199
E[app_ja.arb<br/>日文] --> B
200200
end
@@ -231,38 +231,38 @@ graph TB
231231
```mermaid
232232
graph TB
233233
Start([开始]) --> Check{检查触发条件}
234-
234+
235235
Check -->|Push to main| WebBuild[构建 Web 版本]
236236
Check -->|Tag Release| WindowsBuild[构建 Windows 版本]
237237
Check -->|Both| FullBuild[构建所有版本]
238-
238+
239239
WebBuild --> WebTest[Web 构建测试]
240240
WindowsBuild --> WindowsTest[Windows 构建测试]
241241
FullBuild --> WebTest
242242
FullBuild --> WindowsTest
243-
243+
244244
WebTest -->|失败| WebError[Web 构建失败]
245245
WindowsTest -->|失败| WindowsError[Windows 构建失败]
246-
246+
247247
WebTest -->|成功| WebDeploy[部署到 GitHub Pages]
248248
WindowsTest -->|成功| WindowsPackage[打包 Windows 安装程序]
249-
249+
250250
WebDeploy --> WebVerify[验证 Web 部署]
251251
WindowsPackage --> WindowsVerify[验证 Windows 包]
252-
252+
253253
WebVerify -->|失败| WebError
254254
WindowsVerify -->|失败| WindowsError
255-
255+
256256
WebVerify -->|成功| WebSuccess[Web 部署成功]
257257
WindowsVerify -->|成功| WindowsSuccess[Windows 打包成功]
258-
258+
259259
WebError --> Notify[发送通知]
260260
WindowsError --> Notify
261261
WebSuccess --> Notify
262262
WindowsSuccess --> Notify
263-
263+
264264
Notify --> End([结束])
265-
265+
266266
style Start fill:#e1f5ff
267267
style End fill:#e8f5e9
268268
style WebError fill:#ffebee
@@ -289,7 +289,7 @@ graph LR
289289
K -->|否| M[发送失败通知]
290290
L --> N[完成]
291291
M --> O[回滚/修复]
292-
292+
293293
style A fill:#e1f5ff
294294
style N fill:#e8f5e9
295295
style M fill:#ffebee
@@ -318,7 +318,7 @@ graph TB
318318
O -->|否| Q[发送失败通知]
319319
P --> R[完成]
320320
Q --> S[回滚/修复]
321-
321+
322322
style A fill:#e1f5ff
323323
style R fill:#e8f5e9
324324
style Q fill:#ffebee

lib/core/providers/locale_provider.dart

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,28 @@ class LocaleProvider with ChangeNotifier {
3232
if (systemLocales.isNotEmpty) {
3333
final systemLocale = systemLocales.first;
3434
final languageCode = systemLocale.languageCode;
35-
35+
3636
// 如果系统语言是中文
3737
if (languageCode == 'zh') {
38-
// 如果是繁体中文地区,返回繁体中文
39-
if (systemLocale.countryCode == 'TW' ||
40-
systemLocale.countryCode == 'HK' ||
38+
// 如果是正體中文地区,返回正體中文
39+
if (systemLocale.countryCode == 'TW' ||
40+
systemLocale.countryCode == 'HK' ||
4141
systemLocale.countryCode == 'MO') {
42-
return const Locale('zh', 'HK');
42+
return const Locale('zh', 'TW');
4343
}
4444
// 其他中文地区返回简体中文
4545
return const Locale('zh');
4646
}
47-
47+
4848
// 如果系统语言是日语
4949
if (languageCode == 'ja') {
5050
return const Locale('ja');
5151
}
52-
52+
5353
// 其他所有语言(非中文、非日文)默认返回英文
5454
return const Locale('en');
5555
}
56-
56+
5757
// 如果无法获取系统语言,默认返回英文
5858
return const Locale('en');
5959
}
@@ -63,11 +63,11 @@ class LocaleProvider with ChangeNotifier {
6363
// SharedPreferences 在 Web 上会自动处理 'flutter.' 前缀
6464
final followSystemSetting = prefs.getBool('follow_system_locale');
6565
final localeCode = prefs.getString('locale');
66-
66+
6767
if (followSystemSetting == false && localeCode != null) {
6868
// 用户明确设置了语言
6969
_followSystem = false;
70-
// 解析语言代码(支持 zh_HK 格式)
70+
// 解析语言代码(支持 zh_TW 格式)
7171
final parts = localeCode.split('_');
7272
if (parts.length == 2) {
7373
_locale = Locale(parts[0], parts[1]);
@@ -85,22 +85,22 @@ class LocaleProvider with ChangeNotifier {
8585
/// 设置语言(传入null表示跟随系统)
8686
Future<void> setLocale(Locale? locale) async {
8787
if (_locale == locale && _followSystem == (locale == null)) return;
88-
88+
8989
_locale = locale;
9090
_followSystem = locale == null;
91-
91+
9292
final prefs = await SharedPreferences.getInstance();
9393
await prefs.setBool('follow_system_locale', _followSystem);
9494
if (locale != null) {
95-
// 保存完整的语言代码(包括国家代码,如 zh_HK
96-
final localeString = locale.countryCode != null
95+
// 保存完整的语言代码(包括国家代码,如 zh_TW
96+
final localeString = locale.countryCode != null
9797
? '${locale.languageCode}_${locale.countryCode}'
9898
: locale.languageCode;
9999
await prefs.setString('locale', localeString);
100100
} else {
101101
await prefs.remove('locale');
102102
}
103-
103+
104104
notifyListeners();
105105
}
106106
}

lib/l10n/app_en.arb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"chinese": "中文(中国)",
1515
"english": "English (US)",
1616
"japanese": "日本語",
17-
"traditionalChinese": "繁體中文(中國香港)",
17+
"traditionalChinese": "正體中文(台灣)",
1818
"followSystem": "Follow System",
1919
"preserveInputs": "Preserve Inputs and Results",
2020
"preserveInputsDescription": "Keep input content and calculation results when switching calculators",

lib/l10n/app_ja.arb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"chinese": "中文(中国)",
1818
"english": "英語(米国)",
1919
"japanese": "日本語",
20-
"traditionalChinese": "繁體中文(中國香港)",
20+
"traditionalChinese": "正體中文(台灣)",
2121
"followSystem": "システムに従う",
2222
"preserveInputs": "入力と結果を保持",
2323
"preserveInputsDescription": "計算機を切り替える際に入力内容と計算結果を保持",

lib/l10n/app_localizations.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ abstract class AppLocalizations {
9898
Locale('en'),
9999
Locale('ja'),
100100
Locale('zh'),
101-
Locale('zh', 'HK')
101+
Locale('zh', 'TW')
102102
];
103103

104104
/// 应用程序标题
@@ -188,7 +188,7 @@ abstract class AppLocalizations {
188188
/// No description provided for @traditionalChinese.
189189
///
190190
/// In zh, this message translates to:
191-
/// **'繁體中文(中國香港)'**
191+
/// **'正體中文(台灣)'**
192192
String get traditionalChinese;
193193

194194
/// No description provided for @followSystem.
@@ -1379,8 +1379,8 @@ AppLocalizations lookupAppLocalizations(Locale locale) {
13791379
case 'zh':
13801380
{
13811381
switch (locale.countryCode) {
1382-
case 'HK':
1383-
return AppLocalizationsZhHk();
1382+
case 'TW':
1383+
return AppLocalizationsZhTw();
13841384
}
13851385
break;
13861386
}

lib/l10n/app_localizations_en.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class AppLocalizationsEn extends AppLocalizations {
5151
String get japanese => '日本語';
5252

5353
@override
54-
String get traditionalChinese => '繁體中文(中國香港)';
54+
String get traditionalChinese => '正體中文(台灣)';
5555

5656
@override
5757
String get followSystem => 'Follow System';

lib/l10n/app_localizations_ja.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class AppLocalizationsJa extends AppLocalizations {
5151
String get japanese => '日本語';
5252

5353
@override
54-
String get traditionalChinese => '繁體中文(中國香港)';
54+
String get traditionalChinese => '正體中文(台灣)';
5555

5656
@override
5757
String get followSystem => 'システムに従う';

lib/l10n/app_localizations_zh.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class AppLocalizationsZh extends AppLocalizations {
5151
String get japanese => '日本語';
5252

5353
@override
54-
String get traditionalChinese => '繁體中文(中國香港)';
54+
String get traditionalChinese => '正體中文(台灣)';
5555

5656
@override
5757
String get followSystem => '跟随系统';
@@ -640,9 +640,9 @@ class AppLocalizationsZh extends AppLocalizations {
640640
String get minWindowSize => '最小窗口尺寸:800x700';
641641
}
642642

643-
/// The translations for Chinese, as used in Hong Kong (`zh_HK`).
644-
class AppLocalizationsZhHk extends AppLocalizationsZh {
645-
AppLocalizationsZhHk() : super('zh_HK');
643+
/// The translations for Chinese, as used in Taiwan (`zh_TW`).
644+
class AppLocalizationsZhTw extends AppLocalizationsZh {
645+
AppLocalizationsZhTw() : super('zh_TW');
646646

647647
@override
648648
String get appTitle => '網路計算器';
@@ -687,7 +687,7 @@ class AppLocalizationsZhHk extends AppLocalizationsZh {
687687
String get japanese => '日本語';
688688

689689
@override
690-
String get traditionalChinese => '繁體中文(中國香港)';
690+
String get traditionalChinese => '正體中文(台灣)';
691691

692692
@override
693693
String get followSystem => '跟隨系統';

0 commit comments

Comments
 (0)