🌐 Localize dashboard

This commit is contained in:
LittleSheep 2024-09-03 23:21:46 +08:00
parent baa6b401d3
commit e4a6ff2da4
4 changed files with 25 additions and 8 deletions

View File

@ -1,4 +1,5 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:get/get.dart';
import 'package:solian/models/account.dart';
part 'daily_sign.g.dart';
@ -39,10 +40,10 @@ class DailySignRecord {
};
String get overviewSuggestion => switch (resultTier) {
0 => '诸事不宜',
1 => '有些不宜',
2 => '平平淡淡',
3 => '有些事宜',
_ => '诸事皆宜',
0 => 'dailySignTier0'.tr,
1 => 'dailySignTier1'.tr,
2 => 'dailySignTier2'.tr,
3 => 'dailySignTier3'.tr,
_ => 'dailySignTier4'.tr,
};
}

View File

@ -144,10 +144,10 @@ class _DashboardScreenState extends State<DashboardScreen> {
).paddingSymmetric(horizontal: 9),
).paddingOnly(left: 4),
title: _signRecord == null
? const Text('签到')
? Text('dailySign'.tr)
: Text(_signRecord!.overviewSuggestion),
subtitle: _signRecord == null
? const Text('今日未拜访佛祖')
? Text('dailySignNone'.tr)
: Text('+${_signRecord!.resultExperience} EXP'),
trailing: AnimatedSwitcher(
switchInCurve: Curves.fastOutSlowIn,
@ -414,7 +414,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
style: TextStyle(color: _unFocusColor, fontSize: 12),
),
Text(
'占卜多少都是玩,人生还得靠自己',
'dashboardFooter'.tr,
style: GoogleFonts.notoSerifHk(
color: _unFocusColor,
fontSize: 12,

View File

@ -24,6 +24,14 @@ const i18nEnglish = {
'feedUnreadCount': '@count posts you may missed',
'messages': 'Messages',
'messagesUnreadCount': '@count messages unread',
'dailySign': 'Daily Sign',
'dailySignNone': 'You haven\'t sign today',
'dailySignTier0': 'Everything may not be good',
'dailySignTier1': 'Something may be wrong',
'dailySignTier2': 'Just so so',
'dailySignTier3': 'Something may goes well',
'dailySignTier4': 'Everything will be awesome',
'dashboardFooter': 'Don\'t be serious, just for fun.',
'visitProfilePage': 'Visit Profile Page',
'profilePosts': 'Posts',
'profileAlbum': 'Album',

View File

@ -32,6 +32,14 @@ const i18nSimplifiedChinese = {
'feedUnreadCount': '@count 条你可能错过的帖子',
'messages': '消息',
'messagesUnreadCount': '@count 条未读的消息',
'dailySign': '签到',
'dailySignNone': '今日未拜访佛祖',
'dailySignTier0': '诸事不宜',
'dailySignTier1': '有些不宜',
'dailySignTier2': '平平淡淡',
'dailySignTier3': '有些事宜',
'dailySignTier4': '诸事皆宜',
'dashboardFooter': '占卜多少沾点玩,人生还得靠实力',
'visitProfilePage': '造访个人主页',
'profilePosts': '帖子',
'profileAlbum': '相簿',