diff --git a/app/shared/app-data/src/commonMain/kotlin/data/models/subject/Tag.kt b/app/shared/app-data/src/commonMain/kotlin/data/models/subject/Tag.kt index 4f7a53f72d..8125e9691e 100644 --- a/app/shared/app-data/src/commonMain/kotlin/data/models/subject/Tag.kt +++ b/app/shared/app-data/src/commonMain/kotlin/data/models/subject/Tag.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 OpenAni and contributors. + * Copyright (C) 2024-2025 OpenAni and contributors. * * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. * Use of this source code is governed by the GNU AGPLv3 license, which can be found at the following link. @@ -41,6 +41,7 @@ val Tag.kind: CanonicalTagKind? /** * Bangumi 定义的公共标签种类. + * TODO: 国际化 */ // https://bgm.tv/wiki/tag/list // Generated by GPT-4o diff --git a/app/shared/app-lang/src/androidMain/res/values-zh-rCN/strings.xml b/app/shared/app-lang/src/androidMain/res/values-zh-rCN/strings.xml index 4fe9f49495..42c6ce20ec 100644 --- a/app/shared/app-lang/src/androidMain/res/values-zh-rCN/strings.xml +++ b/app/shared/app-lang/src/androidMain/res/values-zh-rCN/strings.xml @@ -389,9 +389,19 @@ 探索 设置 搜索 + 关键词 + 返回顶部 + 此内容不适合展示 + 显示 + 未找到结果 + 找到 %1$d 个结果 + 最佳匹配 + 最多收藏 + 最高评分 最高热度 新番时间表 继续观看 + 将番剧收藏为 "在看" 后将在这里显示 推荐 按住 Shift + 鼠标滚轮 同样可以水平滚动 @@ -417,6 +427,8 @@ 服务器区域 + 自动 + 自动选择: %1$s 全球加速 提升访问全球服务器的速度\n在中国大陆内启用会减速 连接速度测试 @@ -447,9 +459,11 @@ 全局代理设置 应用于所有数据源以及 Bangumi 代理类型 + 正在使用 %1$s 禁用 + 目前未使用代理 系统代理 - 自定义 + 自定义代理 自动检测结果 正在检测 未检测到系统代理 @@ -459,6 +473,18 @@ 可选 密码 + 正在检测连接,请稍后… + 正在检测连接,请稍后… + 部分服务连接失败,请考虑启用代理 + 部分服务连接失败,请更换代理模式或代理地址 + 所有服务连接正常 + 重新测试 + 保存并测试 + 弹幕服务 + 收藏数据服务 + 评论服务 + 使用 %1$s 连接成功 + 使用 %1$s 连接失败 BT 设置 @@ -477,7 +503,7 @@ 自动缓存 - 自动缓存 \"在看\" 分类中未观看的剧集 + 自动缓存 "在看" 分类中未观看的剧集 启用自动缓存 最大自动缓存话数 若手动缓存数量超过该设置值,将不会自动缓存 @@ -486,9 +512,21 @@ 缓存数量 当前设置: 仅缓存最近看过的 %d 部番剧 管理已缓存的剧集 - 退出登录 - 已退出登录 账号 + + + 登录 + 未登录 + 退出登录 + 确定要退出登录吗? + 已退出登录 + 登录或注册 + 编辑个人资料 + 更换头像 + + + 取消 + 修改 diff --git a/app/shared/app-lang/src/androidMain/res/values-zh-rHK/strings.xml b/app/shared/app-lang/src/androidMain/res/values-zh-rHK/strings.xml index 6bf65433d4..09e4237326 100644 --- a/app/shared/app-lang/src/androidMain/res/values-zh-rHK/strings.xml +++ b/app/shared/app-lang/src/androidMain/res/values-zh-rHK/strings.xml @@ -371,9 +371,19 @@ 探索 設置 搜索 + 关键词 + 返回頂部 + 此內容不適合展示 + 顯示 + 沒有找到相關結果 + 找到 %1$d 個結果 + 最佳匹配 + 最多收藏 + 最高評分 最高熱度 新番時間表 繼續觀看 + 將番劇收藏為 "在看" 後將在這裡顯示 推薦 按住 Shift + 滑鼠滾輪 同樣可以水平滾動 @@ -399,6 +409,8 @@ 伺服器區域 + 自動 + 自動選擇: %1$s 全球加速 提升存取全球伺服器的速度\n在中國大陸內啟用會減速 連接速度測試 @@ -429,9 +441,11 @@ 全局代理設置 應用於所有數據源以及 Bangumi 代理類型 + 正在透過 %1$s 禁用 + 目前未使用代理 系統代理 - 自定義 + 自定義代理 自動檢測結果 正在檢測 未檢測到系統代理 @@ -441,6 +455,18 @@ 可選 密碼 + 正在檢測連接,請稍後… + 正在檢測連接,請稍後… + 部分服務連接失敗,請考慮啟用代理 + 部分服務連接失敗,請更換代理模式或代理地址 + 所有服務連接正常 + 重新測試 + 保存並測試 + 彈幕服務 + 收藏數據服務 + 評論服務 + 使用 %1$s 連接成功 + 使用 %1$s 連接失敗 BT 設置 @@ -468,6 +494,19 @@ 緩存數量 當前設置: 僅緩存最近看過的 %d 部番劇 管理已緩存的劇集登出已登出賬戶 + 登出 + 已登出 + 賬戶 + + + 登入 + 未登入 + 登出 + 確定要登出嗎? + 已登出 + 登入 / 註冊 + 編輯個人資料 + 更換頭像 版本過期 @@ -476,6 +515,11 @@ 如果新版本要求導入設置,請點擊: 已複製到剪貼板,請到新版本點擊導入 導出設置 + 管理已緩存的劇集 + + + 取消 + 編輯 diff --git a/app/shared/app-lang/src/androidMain/res/values-zh-rTW/strings.xml b/app/shared/app-lang/src/androidMain/res/values-zh-rTW/strings.xml index 5acdd4bc31..6dc27c1ec0 100644 --- a/app/shared/app-lang/src/androidMain/res/values-zh-rTW/strings.xml +++ b/app/shared/app-lang/src/androidMain/res/values-zh-rTW/strings.xml @@ -371,9 +371,19 @@ 探索 設定 搜尋 + 关键词 + 返回頂部 + 此內容不適合展示 + 顯示 + 沒有找到相關結果 + 找到 %1$d 個結果 + 最佳匹配 + 最多收藏 + 最高評分 最高熱度 新番時間表 繼續觀看 + 將番劇收藏為 "在看" 後將在這裡顯示 推薦 按住 Shift + 滑鼠滾輪 同樣可以水平滾動 @@ -399,6 +409,8 @@ 伺服器區域 + 自動 + 自動選擇: %1$s 全球加速 提升存取全球伺服器的速度\n在中國大陸內啟用會減速 連線速度測試 @@ -429,9 +441,11 @@ 全域代理設定 應用於所有資料源以及 Bangumi 代理類型 + 正在透過 %1$s 停用 + 目前未使用代理 系統代理 - 自訂 + 自訂代理 自動偵測結果 正在偵測 未偵測到系統代理 @@ -441,6 +455,18 @@ 可選 密碼 + 正在偵測連接,請稍後… + 正在偵測連接,請稍後… + 部分服務連接失敗,請考慮啟用代理 + 部分服務連接失敗,請更換代理模式或代理地址 + 所有服務連接正常 + 重新測試 + 保存並測試 + 彈幕服務 + 收藏數據服務 + 評論服務 + 使用 %1$s 連接成功 + 使用 %1$s 連接失敗 BT 設置 @@ -459,7 +485,7 @@ 自動快取 - 自動快取 \"在看\" 分類中未觀看的劇集 + 自動快取 "在看" 分類中未觀看的劇集 啟用自動快取 最大自動快取話數 若手動快取數量超過該設定值,將不會自動快取 @@ -467,7 +493,22 @@ 僅快取最近看過的番劇 快取數量 目前設定: 僅快取最近看過的 %d 部番劇 - 管理已快取的劇集登出已登出賬戶 + 管理已快取的劇集 + 賬戶 + + + 登入 + 未登入 + 登出 + 確定要登出嗎? + 已登出 + 登入 / 註冊 + 編輯個人資料 + 更換頭像 + + + 取消 + 編輯 diff --git a/app/shared/app-lang/src/androidMain/res/values/strings.xml b/app/shared/app-lang/src/androidMain/res/values/strings.xml index bc501fbdb4..0bb4f0bbe2 100644 --- a/app/shared/app-lang/src/androidMain/res/values/strings.xml +++ b/app/shared/app-lang/src/androidMain/res/values/strings.xml @@ -350,9 +350,19 @@ Explore Settings Search + Keyword + Back to top + NSFW content is hidden + Display + No results found + Results: %1$d + Match + Collection + Rank Trending Anime Schedule Continue Watching + Collect an anime as "Watching" and it will appear here Recommendations Hold Shift + mouse wheel to scroll horizontally @@ -378,6 +388,8 @@ Server Region + Auto + Auto Select: %1$s Global Acceleration Improves speed when accessing global servers\nEnabling this within mainland China will slow it down Connection Speed Test @@ -408,9 +420,11 @@ Global Proxy Settings Applied to all data sources and Bangumi Proxy Type + Using %1$s Disabled + No proxy is used System Proxy - Custom + Custom Proxy Auto-detection Result Detecting No system proxy detected @@ -420,6 +434,18 @@ Optional None Password + Testing connection, please wait… + Testing connection, please wait… + Some services failed to connect, consider enabling proxy + Some services failed to connect, consider changing proxy mode or address + All services connected successfully + Retest + Save and Test + Danmaku Service + Collection Data Service + Comments Service + Connected successfully using %1$s + Failed to connect using %1$s BT Settings @@ -446,7 +472,22 @@ Only cache recently watched anime Cache count Current setting: Only cache the most recent %d anime - Manage cached episodesLogoutLogged outAccount + Manage cached episodes + Account + + + Login + Not logged in + Logout + Are you sure you want to log out? + Logged out + Login / Register + Edit profile settings + Edit avatar + + + Cancel + Edit diff --git a/app/shared/src/commonMain/kotlin/ui/main/MainScreen.kt b/app/shared/src/commonMain/kotlin/ui/main/MainScreen.kt index 9950a4e47a..cc8a5aafd0 100644 --- a/app/shared/src/commonMain/kotlin/ui/main/MainScreen.kt +++ b/app/shared/src/commonMain/kotlin/ui/main/MainScreen.kt @@ -97,6 +97,7 @@ import me.him188.ani.app.ui.user.SelfInfoUiState import me.him188.ani.utils.platform.isAndroid import org.koin.mp.KoinPlatform import me.him188.ani.app.ui.lang.Lang +import me.him188.ani.app.ui.lang.settings import me.him188.ani.app.ui.lang.settings_update_version_expired_title import me.him188.ani.app.ui.lang.settings_update_version_expired_message import me.him188.ani.app.ui.lang.settings_update_version_expired_message_with_latest @@ -195,7 +196,7 @@ private fun MainScreenContent( onClick = { onNavigateToSettings(null) }, icon = { Icon(Icons.Rounded.Settings, null) }, enabled = true, - label = { Text("设置") }, + label = { Text(stringResource(Lang.settings)) }, alwaysShowLabel = true, colors = itemColors, ) diff --git a/app/shared/src/commonMain/kotlin/ui/profile/UserInfoRow.kt b/app/shared/src/commonMain/kotlin/ui/profile/UserInfoRow.kt index d0e79b013e..692737590e 100644 --- a/app/shared/src/commonMain/kotlin/ui/profile/UserInfoRow.kt +++ b/app/shared/src/commonMain/kotlin/ui/profile/UserInfoRow.kt @@ -37,6 +37,9 @@ import me.him188.ani.app.data.models.UserInfo import me.him188.ani.app.ui.external.placeholder.placeholder import me.him188.ani.app.ui.foundation.ProvideCompositionLocalsForPreview import me.him188.ani.app.ui.foundation.avatar.AvatarImage +import me.him188.ani.app.ui.lang.Lang +import me.him188.ani.app.ui.lang.settings +import org.jetbrains.compose.resources.stringResource import org.jetbrains.compose.ui.tooling.preview.Preview @@ -119,7 +122,7 @@ fun UserInfoRow( Column(Modifier.align(Alignment.Top)) { IconButton(onClickSettings) { - Icon(Icons.Rounded.Settings, "设置") + Icon(Icons.Rounded.Settings, stringResource(Lang.settings)) } } } diff --git a/app/shared/ui-exploration/src/commonMain/kotlin/ui/exploration/followed/FollowedSubjectsLazyRow.kt b/app/shared/ui-exploration/src/commonMain/kotlin/ui/exploration/followed/FollowedSubjectsLazyRow.kt index 721aa253f9..443ecc19de 100644 --- a/app/shared/ui-exploration/src/commonMain/kotlin/ui/exploration/followed/FollowedSubjectsLazyRow.kt +++ b/app/shared/ui-exploration/src/commonMain/kotlin/ui/exploration/followed/FollowedSubjectsLazyRow.kt @@ -43,6 +43,7 @@ import me.him188.ani.app.ui.foundation.stateOf import me.him188.ani.app.ui.foundation.widgets.NsfwMask import me.him188.ani.app.ui.search.* import me.him188.ani.app.ui.subject.SubjectProgressState +import org.jetbrains.compose.resources.stringResource // https://www.figma.com/design/LET1n9mmDa6npDTIlUuJjU/Animeko?node-id=62-4581&node-type=frame&t=Evw0PwXZHXQNgEm3-0 @Composable @@ -101,7 +102,7 @@ fun FollowedSubjectsLazyRow( LoadErrorCardRole.Unimportant, content = { ListItem( - headlineContent = { Text("将番剧收藏为 \"在看\" 后将在这里显示") }, + headlineContent = { Text(stringResource(Lang.exploration_continue_watching_hint)) }, colors = listItemColors, ) }, diff --git a/app/shared/ui-exploration/src/commonMain/kotlin/ui/exploration/search/SearchFilter.kt b/app/shared/ui-exploration/src/commonMain/kotlin/ui/exploration/search/SearchFilter.kt index b0c8675db6..136eaa5372 100644 --- a/app/shared/ui-exploration/src/commonMain/kotlin/ui/exploration/search/SearchFilter.kt +++ b/app/shared/ui-exploration/src/commonMain/kotlin/ui/exploration/search/SearchFilter.kt @@ -165,6 +165,7 @@ private fun renderChipLabel( if (state.hasSelection) { return state.selected.joinToString(",") } + // TODO: 国际化 return when (state.kind) { CanonicalTagKind.Audience -> "受众" CanonicalTagKind.Category -> "分类" diff --git a/app/shared/ui-exploration/src/commonMain/kotlin/ui/exploration/search/SearchPage.kt b/app/shared/ui-exploration/src/commonMain/kotlin/ui/exploration/search/SearchPage.kt index 650a59a529..5269fc231a 100644 --- a/app/shared/ui-exploration/src/commonMain/kotlin/ui/exploration/search/SearchPage.kt +++ b/app/shared/ui-exploration/src/commonMain/kotlin/ui/exploration/search/SearchPage.kt @@ -58,8 +58,13 @@ import me.him188.ani.app.ui.foundation.layout.currentWindowAdaptiveInfo1 import me.him188.ani.app.ui.foundation.layout.paneVerticalPadding import me.him188.ani.app.ui.foundation.navigation.BackHandler import me.him188.ani.app.ui.foundation.widgets.BackNavigationIconButton +import me.him188.ani.app.ui.lang.Lang +import me.him188.ani.app.ui.lang.exploration_search +import me.him188.ani.app.ui.lang.exploration_search_back_to_top +import me.him188.ani.app.ui.lang.exploration_search_keyword import me.him188.ani.app.ui.search.collectHasQueryAsState import me.him188.ani.utils.platform.isDesktop +import org.jetbrains.compose.resources.stringResource @Composable fun SearchPage( @@ -91,7 +96,7 @@ fun SearchPage( SuggestionSearchBar( state.suggestionSearchBarState, Modifier.padding(bottom = 16.dp), - placeholder = { Text("关键词") }, + placeholder = { Text(stringResource(Lang.exploration_search_keyword)) }, windowInsets = contentWindowInsets.only(WindowInsetsSides.Horizontal), ) }, @@ -194,7 +199,7 @@ fun SearchPage( } }, ) { - Icon(Icons.Rounded.KeyboardArrowUp, "回到顶部") + Icon(Icons.Rounded.KeyboardArrowUp, stringResource(Lang.exploration_search_back_to_top)) } } }, @@ -246,7 +251,7 @@ internal fun SearchPageListDetailScaffold( navigator, listPaneTopAppBar = { AniTopAppBar( - title = { Text("搜索") }, + title = { Text(stringResource(Lang.exploration_search)) }, Modifier.fillMaxWidth(), navigationIcon = { if (navigator.canNavigateBack()) { diff --git a/app/shared/ui-exploration/src/commonMain/kotlin/ui/exploration/search/SearchPageResultColumn.kt b/app/shared/ui-exploration/src/commonMain/kotlin/ui/exploration/search/SearchPageResultColumn.kt index 730eb33850..bc64f85920 100644 --- a/app/shared/ui-exploration/src/commonMain/kotlin/ui/exploration/search/SearchPageResultColumn.kt +++ b/app/shared/ui-exploration/src/commonMain/kotlin/ui/exploration/search/SearchPageResultColumn.kt @@ -63,7 +63,6 @@ import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import androidx.paging.compose.LazyPagingItems import androidx.paging.compose.itemContentType -import androidx.paging.compose.itemKey import kotlinx.coroutines.flow.collectLatest import me.him188.ani.app.data.models.preference.NsfwMode import me.him188.ani.app.domain.search.SearchSort @@ -81,6 +80,12 @@ import me.him188.ani.app.ui.foundation.layout.paneHorizontalPadding import me.him188.ani.app.ui.foundation.layout.paneVerticalPadding import me.him188.ani.app.ui.foundation.widgets.NsfwMask import me.him188.ani.app.ui.foundation.widgets.SelectableDropdownMenuItem +import me.him188.ani.app.ui.lang.Lang +import me.him188.ani.app.ui.lang.exploration_search_res_cnt +import me.him188.ani.app.ui.lang.exploration_search_res_collection +import me.him188.ani.app.ui.lang.exploration_search_res_empty +import me.him188.ani.app.ui.lang.exploration_search_res_match +import me.him188.ani.app.ui.lang.exploration_search_res_rank import me.him188.ani.app.ui.search.LoadErrorCard import me.him188.ani.app.ui.search.SearchDefaults.IconTextButton import me.him188.ani.app.ui.search.SearchResultLazyVerticalGrid @@ -89,6 +94,7 @@ import me.him188.ani.app.ui.search.isFinishedAndEmpty import me.him188.ani.app.ui.subject.SubjectCoverCard import me.him188.ani.app.ui.subject.SubjectGridDefaults import me.him188.ani.app.ui.subject.SubjectGridLayoutParams +import org.jetbrains.compose.resources.stringResource @Composable @@ -342,7 +348,7 @@ private fun LazyGridItemScope.SearchResultColumnScopeImpl( when { itemsState.value.isFinishedAndEmpty -> { ListItem( - headlineContent = { Text("无搜索结果") }, + headlineContent = { Text(stringResource(Lang.exploration_search_res_empty)) }, modifier = modifier1, colors = ListItemDefaults.colors(containerColor = MaterialTheme.colorScheme.surfaceContainerLowest), ) @@ -355,7 +361,10 @@ private fun LazyGridItemScope.SearchResultColumnScopeImpl( verticalArrangement = Arrangement.aligned(Alignment.CenterVertically), itemVerticalAlignment = Alignment.CenterVertically, ) { - Text("已显示 ${itemsState.value.itemCount} 个结果", style = MaterialTheme.typography.bodyLarge) + Text( + stringResource(Lang.exploration_search_res_cnt, itemsState.value.itemCount), + style = MaterialTheme.typography.bodyLarge, + ) Row( Modifier.weight(1f).align(Alignment.Bottom), verticalAlignment = Alignment.CenterVertically, @@ -459,8 +468,9 @@ private fun SortButton( } } +@Composable private fun getSortText(currentSort: SearchSort): String = when (currentSort) { - SearchSort.MATCH -> "最佳匹配" - SearchSort.COLLECTION -> "最多收藏" - SearchSort.RANK -> "最高排名" + SearchSort.MATCH -> stringResource(Lang.exploration_search_res_match) + SearchSort.COLLECTION -> stringResource(Lang.exploration_search_res_collection) + SearchSort.RANK -> stringResource(Lang.exploration_search_res_rank) } diff --git a/app/shared/ui-foundation/src/commonMain/kotlin/ui/foundation/session/SelfAvatar.kt b/app/shared/ui-foundation/src/commonMain/kotlin/ui/foundation/session/SelfAvatar.kt index 25decaf5ea..c5ff3a8303 100644 --- a/app/shared/ui-foundation/src/commonMain/kotlin/ui/foundation/session/SelfAvatar.kt +++ b/app/shared/ui-foundation/src/commonMain/kotlin/ui/foundation/session/SelfAvatar.kt @@ -41,7 +41,14 @@ import me.him188.ani.app.navigation.LocalNavigator import me.him188.ani.app.tools.rememberUiMonoTasker import me.him188.ani.app.ui.external.placeholder.placeholder import me.him188.ani.app.ui.foundation.avatar.AvatarImage +import me.him188.ani.app.ui.lang.Lang +import me.him188.ani.app.ui.lang.account_login +import me.him188.ani.app.ui.lang.account_logout +import me.him188.ani.app.ui.lang.account_logout_hint +import me.him188.ani.app.ui.lang.settings +import me.him188.ani.app.ui.lang.ui_btn_cancel import me.him188.ani.app.ui.user.SelfInfoUiState +import org.jetbrains.compose.resources.stringResource import org.koin.core.component.KoinComponent import org.koin.core.component.inject import kotlin.coroutines.CoroutineContext @@ -63,8 +70,9 @@ fun SelfAvatar( ) } else { if (state.isSessionValid == false || state.selfInfo == null) { + // TODO: 优化hover阴影表现 TextButton(onClick) { - Text("登录") + Text(stringResource(Lang.account_login)) } } else { AvatarImage( @@ -121,7 +129,7 @@ private fun SelfAvatarMenus( onClickAny: () -> Unit, ) { DropdownMenuItem( - text = { Text("设置") }, + text = { Text(stringResource(Lang.settings)) }, onClick = { handler.onClickSettings() onClickAny() @@ -133,7 +141,7 @@ private fun SelfAvatarMenus( var showLogoutConfirmation by rememberSaveable { mutableStateOf(false) } val running by logoutTasker.isRunning.collectAsStateWithLifecycle() DropdownMenuItem( - text = { Text("退出登录", color = MaterialTheme.colorScheme.error) }, + text = { Text(stringResource(Lang.account_logout), color = MaterialTheme.colorScheme.error) }, leadingIcon = { Icon(Icons.AutoMirrored.Rounded.Logout, null) }, onClick = { showLogoutConfirmation = true }, enabled = !running, @@ -141,7 +149,7 @@ private fun SelfAvatarMenus( if (showLogoutConfirmation) { AlertDialog( { showLogoutConfirmation = false }, - text = { Text("确定要退出登录吗?") }, + text = { Text(stringResource(Lang.account_logout_hint)) }, confirmButton = { TextButton( { @@ -152,12 +160,12 @@ private fun SelfAvatarMenus( showLogoutConfirmation = false }, ) { - Text("退出登录", color = MaterialTheme.colorScheme.error) + Text(stringResource(Lang.account_logout), color = MaterialTheme.colorScheme.error) } }, dismissButton = { TextButton({ showLogoutConfirmation = false }) { - Text("取消") + Text(stringResource(Lang.ui_btn_cancel)) } }, ) diff --git a/app/shared/ui-foundation/src/commonMain/kotlin/ui/foundation/widgets/NsfwMask.kt b/app/shared/ui-foundation/src/commonMain/kotlin/ui/foundation/widgets/NsfwMask.kt index 7fce4fb585..b79fe35065 100644 --- a/app/shared/ui-foundation/src/commonMain/kotlin/ui/foundation/widgets/NsfwMask.kt +++ b/app/shared/ui-foundation/src/commonMain/kotlin/ui/foundation/widgets/NsfwMask.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 OpenAni and contributors. + * Copyright (C) 2024-2025 OpenAni and contributors. * * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. * Use of this source code is governed by the GNU AGPLv3 license, which can be found at the following link. @@ -34,6 +34,10 @@ import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import me.him188.ani.app.data.models.preference.NsfwMode import me.him188.ani.app.ui.foundation.effects.blurEffect +import me.him188.ani.app.ui.lang.Lang +import me.him188.ani.app.ui.lang.exploration_search_nsfw_hint +import me.him188.ani.app.ui.lang.exploration_search_nsfw_show +import org.jetbrains.compose.resources.stringResource /** * Nsfw 模糊遮罩加提示. 点击可以临时展示. @@ -67,9 +71,12 @@ fun NsfwMask( verticalArrangement = Arrangement.Center, modifier = Modifier.matchParentSize().defaultMinSize(minHeight = 30.dp).padding(top = 10.dp), ) { - Text("此内容不适合展示", textAlign = TextAlign.Center) + Text(stringResource(Lang.exploration_search_nsfw_hint), textAlign = TextAlign.Center) IconButton(onTemporarilyDisplay) { - Icon(Icons.Rounded.RemoveRedEye, contentDescription = "临时展示") + Icon( + Icons.Rounded.RemoveRedEye, + contentDescription = stringResource(Lang.exploration_search_nsfw_show), + ) } } } diff --git a/app/shared/ui-onboarding/src/commonMain/kotlin/ui/oauth/BangumiAuthorizeLayout.kt b/app/shared/ui-onboarding/src/commonMain/kotlin/ui/oauth/BangumiAuthorizeLayout.kt index 20462f2b5c..8308993573 100644 --- a/app/shared/ui-onboarding/src/commonMain/kotlin/ui/oauth/BangumiAuthorizeLayout.kt +++ b/app/shared/ui-onboarding/src/commonMain/kotlin/ui/oauth/BangumiAuthorizeLayout.kt @@ -61,10 +61,13 @@ import me.him188.ani.app.ui.foundation.animation.LocalAniMotionScheme import me.him188.ani.app.ui.foundation.icons.BangumiNext import me.him188.ani.app.ui.foundation.icons.BangumiNextIconColor import me.him188.ani.app.ui.foundation.widgets.HeroIcon +import me.him188.ani.app.ui.lang.Lang +import me.him188.ani.app.ui.lang.account_login_or_register import me.him188.ani.app.ui.search.renderLoadErrorMessage import me.him188.ani.app.ui.settings.SettingsTab import me.him188.ani.app.ui.settings.framework.components.SettingsScope import me.him188.ani.app.ui.settings.framework.components.TextItem +import org.jetbrains.compose.resources.stringResource sealed interface AuthState { data class LoggedInAni(val bound: Boolean) : Idle @@ -162,7 +165,7 @@ private fun AuthorizeButton( } is AuthState.Idle, is AuthState.Failed -> { - Text("登录 / 注册") + Text(stringResource(Lang.account_login_or_register)) } is AuthState.AwaitingResult -> { @@ -352,7 +355,7 @@ private fun SettingsScope.AuthorizeHelpQA( content = { renderHelpOptionContent(option, contactActions) }, expanded = currentSelected == option, showDivider = index != HelpOption.entries.lastIndex, - onClick = { + onClick = { val wasExpanded = currentSelected == option currentSelected = if (wasExpanded) null else option if (!wasExpanded) { diff --git a/app/shared/ui-settings/src/commonMain/kotlin/ui/settings/account/ProfilePopupLayout.kt b/app/shared/ui-settings/src/commonMain/kotlin/ui/settings/account/ProfilePopupLayout.kt index d2aff274cd..f37243949c 100644 --- a/app/shared/ui-settings/src/commonMain/kotlin/ui/settings/account/ProfilePopupLayout.kt +++ b/app/shared/ui-settings/src/commonMain/kotlin/ui/settings/account/ProfilePopupLayout.kt @@ -50,9 +50,18 @@ import me.him188.ani.app.ui.foundation.avatar.AvatarImage import me.him188.ani.app.ui.foundation.interaction.hoverable import me.him188.ani.app.ui.foundation.text.ProvideContentColor import me.him188.ani.app.ui.foundation.widgets.HeroIcon +import me.him188.ani.app.ui.lang.Lang +import me.him188.ani.app.ui.lang.account_edit_avatar +import me.him188.ani.app.ui.lang.account_edit_profile +import me.him188.ani.app.ui.lang.account_login +import me.him188.ani.app.ui.lang.account_login_or_register +import me.him188.ani.app.ui.lang.account_logout +import me.him188.ani.app.ui.lang.account_not_logged_in +import me.him188.ani.app.ui.lang.settings import me.him188.ani.app.ui.settings.SettingsTab import me.him188.ani.app.ui.settings.framework.components.TextItem import me.him188.ani.app.ui.user.SelfInfoUiState +import org.jetbrains.compose.resources.stringResource import org.jetbrains.compose.ui.tooling.preview.Preview @Composable @@ -88,7 +97,7 @@ internal fun ProfilePopupLayout( val showEmail = false Text( - if (isLogin) title else "未登录", + if (isLogin) title else stringResource(Lang.account_not_logged_in), style = MaterialTheme.typography.titleLarge, fontWeight = FontWeight.Bold, modifier = Modifier @@ -125,25 +134,35 @@ internal fun ProfilePopupLayout( Column { if (isLogin) { TextItem( - icon = { Icon(Icons.Outlined.Edit, contentDescription = "Edit profile settings") }, + icon = { + Icon( + Icons.Outlined.Edit, + contentDescription = stringResource(Lang.account_edit_profile), + ) + }, onClick = onClickEditProfile, ) { - Text("编辑个人资料") + Text(stringResource(Lang.account_edit_profile)) } } else { TextItem( - icon = { Icon(Icons.AutoMirrored.Outlined.Login, contentDescription = "Login") }, + icon = { + Icon( + Icons.AutoMirrored.Outlined.Login, + contentDescription = stringResource(Lang.account_login), + ) + }, onClick = onClickLogin, ) { - Text("登录 / 注册") + Text(stringResource(Lang.account_login_or_register)) } } TextItem( - icon = { Icon(Icons.Outlined.Settings, contentDescription = "Settings") }, + icon = { Icon(Icons.Outlined.Settings, contentDescription = stringResource(Lang.settings)) }, onClick = onClickSettings, ) { - Text("设置") + Text(stringResource(Lang.settings)) } if (isLogin) { @@ -152,14 +171,14 @@ internal fun ProfilePopupLayout( ProvideContentColor(MaterialTheme.colorScheme.error) { Icon( Icons.AutoMirrored.Outlined.Logout, - contentDescription = "Logout", + contentDescription = stringResource(Lang.account_logout), ) } }, onClick = onClickLogout, ) { ProvideContentColor(MaterialTheme.colorScheme.error) { - Text("退出登录") + Text(stringResource(Lang.account_logout)) } } } @@ -209,7 +228,7 @@ private fun EditableSelfAvatar( IconButton(onClickEditAvatar) { Icon( Icons.Outlined.Edit, - contentDescription = "Edit avatar", + contentDescription = stringResource(Lang.account_edit_avatar), tint = MaterialTheme.colorScheme.onPrimaryContainer, ) } diff --git a/app/shared/ui-settings/src/commonMain/kotlin/ui/settings/account/SelfInfoBanner.kt b/app/shared/ui-settings/src/commonMain/kotlin/ui/settings/account/SelfInfoBanner.kt index 3c01263606..c0a1584474 100644 --- a/app/shared/ui-settings/src/commonMain/kotlin/ui/settings/account/SelfInfoBanner.kt +++ b/app/shared/ui-settings/src/commonMain/kotlin/ui/settings/account/SelfInfoBanner.kt @@ -32,9 +32,12 @@ import me.him188.ani.app.ui.external.placeholder.placeholder import me.him188.ani.app.ui.foundation.ProvideCompositionLocalsForPreview import me.him188.ani.app.ui.foundation.avatar.AvatarImage import me.him188.ani.app.ui.foundation.text.ProvideTextStyleContentColor +import me.him188.ani.app.ui.lang.Lang +import me.him188.ani.app.ui.lang.account_login_or_register import me.him188.ani.app.ui.user.SelfInfoUiState import me.him188.ani.app.ui.user.TestSelfInfoUiState import me.him188.ani.utils.platform.annotations.TestOnly +import org.jetbrains.compose.resources.stringResource import org.jetbrains.compose.ui.tooling.preview.Preview /** @@ -61,7 +64,7 @@ internal fun SelfInfoBanner( Row(Modifier.padding(horizontal = 16.dp, vertical = 8.dp), verticalAlignment = CenterVertically) { if (!isLogin) { FilledTonalButton(onLoginClick, Modifier.fillMaxWidth()) { - Text("登录 / 注册") + Text(stringResource(Lang.account_login_or_register)) } } else { AvatarImage( diff --git a/app/shared/ui-settings/src/commonMain/kotlin/ui/settings/tabs/DebugTab.kt b/app/shared/ui-settings/src/commonMain/kotlin/ui/settings/tabs/DebugTab.kt index e302e7faa6..a9f423878f 100644 --- a/app/shared/ui-settings/src/commonMain/kotlin/ui/settings/tabs/DebugTab.kt +++ b/app/shared/ui-settings/src/commonMain/kotlin/ui/settings/tabs/DebugTab.kt @@ -33,12 +33,12 @@ import me.him188.ani.app.platform.MeteredNetworkDetector import me.him188.ani.app.ui.foundation.LocalPlatform import me.him188.ani.app.ui.foundation.widgets.LocalToaster import me.him188.ani.app.ui.lang.Lang +import me.him188.ani.app.ui.lang.account_logged_out +import me.him188.ani.app.ui.lang.account_logout import me.him188.ani.app.ui.lang.settings_debug_copied import me.him188.ani.app.ui.lang.settings_debug_enter_onboarding import me.him188.ani.app.ui.lang.settings_debug_episodes import me.him188.ani.app.ui.lang.settings_debug_get_ani_token -import me.him188.ani.app.ui.lang.settings_debug_logged_out -import me.him188.ani.app.ui.lang.settings_debug_logout import me.him188.ani.app.ui.lang.settings_debug_metered_network import me.him188.ani.app.ui.lang.settings_debug_mode import me.him188.ani.app.ui.lang.settings_debug_mode_description @@ -137,11 +137,11 @@ fun DebugTab( } Group(title = { Text(stringResource(Lang.settings_debug_others)) }, useThinHeader = true) { TextItem( - title = { Text(stringResource(Lang.settings_debug_logout)) }, + title = { Text(stringResource(Lang.account_logout)) }, onClick = { scope.launch { GlobalKoin.get().clearSelfInfo() - toaster.toast(getString(Lang.settings_debug_logged_out)) + toaster.toast(getString(Lang.account_logged_out)) } }, ) diff --git a/app/shared/ui-settings/src/commonMain/kotlin/ui/settings/tabs/network/ConfigureProxyGroup.kt b/app/shared/ui-settings/src/commonMain/kotlin/ui/settings/tabs/network/ConfigureProxyGroup.kt index 896a8a7f03..3d084c78c6 100644 --- a/app/shared/ui-settings/src/commonMain/kotlin/ui/settings/tabs/network/ConfigureProxyGroup.kt +++ b/app/shared/ui-settings/src/commonMain/kotlin/ui/settings/tabs/network/ConfigureProxyGroup.kt @@ -55,13 +55,32 @@ import me.him188.ani.app.ui.foundation.text.ProvideContentColor import me.him188.ani.app.ui.lang.Lang import me.him188.ani.app.ui.lang.settings_network_proxy_address import me.him188.ani.app.ui.lang.settings_network_proxy_address_example +import me.him188.ani.app.ui.lang.settings_network_proxy_custom import me.him188.ani.app.ui.lang.settings_network_proxy_detecting import me.him188.ani.app.ui.lang.settings_network_proxy_detection_result +import me.him188.ani.app.ui.lang.settings_network_proxy_disabled +import me.him188.ani.app.ui.lang.settings_network_proxy_disabled_hint +import me.him188.ani.app.ui.lang.settings_network_proxy_mode_via import me.him188.ani.app.ui.lang.settings_network_proxy_none import me.him188.ani.app.ui.lang.settings_network_proxy_not_detected import me.him188.ani.app.ui.lang.settings_network_proxy_optional import me.him188.ani.app.ui.lang.settings_network_proxy_password +import me.him188.ani.app.ui.lang.settings_network_proxy_retry +import me.him188.ani.app.ui.lang.settings_network_proxy_save_and_test +import me.him188.ani.app.ui.lang.settings_network_proxy_service_collection +import me.him188.ani.app.ui.lang.settings_network_proxy_service_comments +import me.him188.ani.app.ui.lang.settings_network_proxy_service_connected_via +import me.him188.ani.app.ui.lang.settings_network_proxy_service_danmaku +import me.him188.ani.app.ui.lang.settings_network_proxy_service_failed_via +import me.him188.ani.app.ui.lang.settings_network_proxy_state_fail_np +import me.him188.ani.app.ui.lang.settings_network_proxy_state_fail_p +import me.him188.ani.app.ui.lang.settings_network_proxy_state_init +import me.him188.ani.app.ui.lang.settings_network_proxy_state_running +import me.him188.ani.app.ui.lang.settings_network_proxy_state_success +import me.him188.ani.app.ui.lang.settings_network_proxy_system +import me.him188.ani.app.ui.lang.settings_network_proxy_title import me.him188.ani.app.ui.lang.settings_network_proxy_username +import me.him188.ani.app.ui.lang.ui_btn_edit import me.him188.ani.app.ui.settings.framework.SettingsState import me.him188.ani.app.ui.settings.framework.components.SettingsScope import me.him188.ani.app.ui.settings.framework.components.TextFieldItem @@ -137,11 +156,11 @@ fun SettingsScope.ConfigureProxyGroup( @Composable private fun renderOverallTestText(state: ProxyOverallTestState): String { return when (state) { - ProxyOverallTestState.INIT -> "正在检测连接,请稍后" - ProxyOverallTestState.RUNNING -> "正在检测连接,请稍后" - ProxyOverallTestState.FAILED_NOT_PROXIED -> "部分服务连接失败,请考虑启用代理" - ProxyOverallTestState.FAILED_PROXIED -> "部分服务连接失败,请更换代理模式或代理地址" - ProxyOverallTestState.SUCCESS -> "所有服务连接正常" + ProxyOverallTestState.INIT -> stringResource(Lang.settings_network_proxy_state_init) + ProxyOverallTestState.RUNNING -> stringResource(Lang.settings_network_proxy_state_running) + ProxyOverallTestState.FAILED_NOT_PROXIED -> stringResource(Lang.settings_network_proxy_state_fail_np) + ProxyOverallTestState.FAILED_PROXIED -> stringResource(Lang.settings_network_proxy_state_fail_p) + ProxyOverallTestState.SUCCESS -> stringResource(Lang.settings_network_proxy_state_success) } } @@ -163,7 +182,7 @@ private fun SettingsScope.ProxyTestStatusGroup( actions = if (state.hasError) { { TextButton(onRequestReTest) { - Text("重新测试") + Text(stringResource(Lang.settings_network_proxy_retry)) } } } else null, @@ -185,9 +204,9 @@ private fun renderTestCaseName(case: ProxyTestCase): String { @Composable private fun renderTestCaseDescription(case: ProxyTestCase): String { return when (case.name) { - ProxyTestCaseEnums.ANI -> "弹幕服务" - ProxyTestCaseEnums.BANGUMI -> "收藏数据服务" - ProxyTestCaseEnums.BANGUMI_NEXT -> "评论服务" + ProxyTestCaseEnums.ANI -> stringResource(Lang.settings_network_proxy_service_danmaku) + ProxyTestCaseEnums.BANGUMI -> stringResource(Lang.settings_network_proxy_service_collection) + ProxyTestCaseEnums.BANGUMI_NEXT -> stringResource(Lang.settings_network_proxy_service_comments) } } @@ -223,12 +242,18 @@ private fun ProxyTestStatusIcon( ProxyTestCaseState.SUCCESS -> ProvideContentColor(MaterialTheme.colorScheme.onSurfaceVariant) { - Icon(Icons.Default.Check, "使用 ${state.name} 连接成功") + Icon( + Icons.Default.Check, + stringResource(Lang.settings_network_proxy_service_connected_via, state.name), + ) } ProxyTestCaseState.FAILED -> ProvideContentColor(MaterialTheme.colorScheme.error) { - Icon(Icons.Default.Close, "使用 ${state.name} 连接失败") + Icon( + Icons.Default.Close, + stringResource(Lang.settings_network_proxy_service_failed_via, state.name), + ) } } } @@ -237,9 +262,9 @@ private fun ProxyTestStatusIcon( @Composable private fun renderProxyConfigModeName(mode: ProxyUIMode): String { return when (mode) { - ProxyUIMode.DISABLED -> "不使用代理" - ProxyUIMode.SYSTEM -> "系统代理" - ProxyUIMode.CUSTOM -> "自定义代理" + ProxyUIMode.DISABLED -> stringResource(Lang.settings_network_proxy_disabled) + ProxyUIMode.SYSTEM -> stringResource(Lang.settings_network_proxy_system) + ProxyUIMode.CUSTOM -> stringResource(Lang.settings_network_proxy_custom) } } @@ -254,7 +279,9 @@ private fun SettingsScope.CurrentProxyTextModePresentation( title = { Text( if (state.config.mode == ProxyUIMode.DISABLED) - "未启用代理" else "正在使用${renderProxyConfigModeName(state.config.mode)}", + stringResource(Lang.settings_network_proxy_disabled_hint) + else + stringResource(Lang.settings_network_proxy_mode_via, state.config.mode), ) }, description = when (state.config.mode) { @@ -276,7 +303,7 @@ private fun SettingsScope.CurrentProxyTextModePresentation( ) { Icon(Icons.Rounded.Edit, null, Modifier.size(ButtonDefaults.IconSize)) Spacer(Modifier.size(ButtonDefaults.IconSpacing)) - Text("修改", softWrap = false) + Text(stringResource(Lang.ui_btn_edit), softWrap = false) } }, ) @@ -303,10 +330,10 @@ private fun SettingsScope.ProxyConfigGroup( } Group( - title = { Text("代理设置") }, + title = { Text(stringResource(Lang.settings_network_proxy_title)) }, actions = { TextButton({ onUpdate(currentConfig.value) }) { - Text("保存并测试") + Text(stringResource(Lang.settings_network_proxy_save_and_test)) } }, useThinHeader = true, diff --git a/app/shared/ui-settings/src/commonMain/kotlin/ui/settings/tabs/network/ServerSelectionGroup.kt b/app/shared/ui-settings/src/commonMain/kotlin/ui/settings/tabs/network/ServerSelectionGroup.kt index 62909621fa..0f0cd5eb4f 100644 --- a/app/shared/ui-settings/src/commonMain/kotlin/ui/settings/tabs/network/ServerSelectionGroup.kt +++ b/app/shared/ui-settings/src/commonMain/kotlin/ui/settings/tabs/network/ServerSelectionGroup.kt @@ -29,6 +29,8 @@ import me.him188.ani.app.data.network.danmaku.AniBangumiSeverBaseUrls import me.him188.ani.app.platform.AniServers import me.him188.ani.app.ui.lang.Lang import me.him188.ani.app.ui.lang.settings_network_danmaku +import me.him188.ani.app.ui.lang.settings_network_danmaku_auto +import me.him188.ani.app.ui.lang.settings_network_danmaku_auto_hint import me.him188.ani.app.ui.lang.settings_network_danmaku_connection_test import me.him188.ani.app.ui.lang.settings_network_danmaku_global import me.him188.ani.app.ui.lang.settings_network_danmaku_global_acceleration @@ -59,7 +61,7 @@ internal fun SettingsScope.ServerSelectionGroup( // Danmaku source selection: null = automatic, true = global, false = mainland/HK val options = listOf( - null to "自动", + null to stringResource(Lang.settings_network_danmaku_auto), true to stringResource(Lang.settings_network_danmaku_global_acceleration), false to stringResource(Lang.settings_network_danmaku_mainland), ) @@ -76,7 +78,7 @@ internal fun SettingsScope.ServerSelectionGroup( } else { stringResource(Lang.settings_network_danmaku_mainland) } - "自动选择:$autoSelected" + stringResource(Lang.settings_network_danmaku_auto_hint, autoSelected) } true -> stringResource(Lang.settings_network_danmaku_global_acceleration_description)