Skip to content

Commit

Permalink
Merge pull request #145 from dmzz-yyhyy/i18n
Browse files Browse the repository at this point in the history
整体翻译优化
  • Loading branch information
yukonisen authored Jan 15, 2025
2 parents c580b70 + e6cb358 commit 2f3e167
Show file tree
Hide file tree
Showing 33 changed files with 534 additions and 232 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ android {
minSdk = 24
targetSdk = 34
// 版本号为x.y.z则versionCode为x*1000000+y*10000+z*100+debug版本号(开发需要时迭代, 两位数)
versionCode = 1_00_00_022
versionCode = 1_00_00_023
versionName = "1.0.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class UpdateCheckRepository @Inject constructor(
private val githubProxyUrl = StringUserData(UserDataPath.Settings.App.ProxyUrl.path, userDataDao)

companion object {
private val _updatePhase = MutableStateFlow("未检查")
private val _updatePhase = MutableStateFlow("Not checked")
val updatePhase: StateFlow<String> get() = _updatePhase
val proxyUrlRegex = Regex("(https?://)+[a-zA-Z0-9.-]+(\\.[a-zA-Z]{2,})(/)")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package indi.dmzz_yyhyy.lightnovelreader.data.web.exploration.filter

open class SingleChoiceFilter(
private val title: String,
val dialogTitle: String,
val description: String,
val dialogTitleId: Int,
val descriptionId: Int,
private val choices: List<String>,
private val defaultChoice: String,
private var onChange: (String) -> Unit
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package indi.dmzz_yyhyy.lightnovelreader.data.web.wenku8


import indi.dmzz_yyhyy.lightnovelreader.R
import indi.dmzz_yyhyy.lightnovelreader.data.book.BookInformation
import indi.dmzz_yyhyy.lightnovelreader.data.book.BookVolumes
import indi.dmzz_yyhyy.lightnovelreader.data.book.ChapterContent
Expand Down Expand Up @@ -380,8 +381,8 @@ object Wenku8Api: WebBookDataSource {
IsCompletedSwitchFilter { this.refresh() },
SingleChoiceFilter(
title = "排序",
dialogTitle = "排序顺序",
description = "书本排序的依据。",
dialogTitleId = R.string.key_pub_filter_title,
descriptionId = R.string.key_pub_filter_desc,
choices = listOf("默认", "按更新时间排序", "按热度排序", "仅动画化"),
defaultChoice = "默认"
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package indi.dmzz_yyhyy.lightnovelreader.data.web.wenku8.exploration.expanedpage.filter

import indi.dmzz_yyhyy.lightnovelreader.R
import indi.dmzz_yyhyy.lightnovelreader.data.web.exploration.filter.SingleChoiceFilter

class FirstLetterSingleChoiceFilter(onChange: (String) -> Unit): SingleChoiceFilter(
title = "首字母",
dialogTitle = "首字母筛选",
description = "根据小说标题的拼音首字母筛选。",
dialogTitleId = R.string.key_letter_filter_title,
descriptionId = R.string.key_letter_filter_desc,
choices = listOf("任意", "0~9", " A ", " B ", " C ", " D ", " E ", " F ", " G ", " H ", " I ", " J ", " K ", " L ", " M ", " N ", " O ", " P ", " Q ", " R ", " S ", " T ", " U ", " V ", " W ", " X ", " Y ", " Z "),
defaultChoice = "任意",
onChange = onChange
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package indi.dmzz_yyhyy.lightnovelreader.data.web.wenku8.exploration.expanedpage.filter

import indi.dmzz_yyhyy.lightnovelreader.R
import indi.dmzz_yyhyy.lightnovelreader.data.book.BookInformation
import indi.dmzz_yyhyy.lightnovelreader.data.web.exploration.filter.LocalFilter
import indi.dmzz_yyhyy.lightnovelreader.data.web.exploration.filter.SingleChoiceFilter

class PublishingHouseSingleChoiceFilter(onChange: (String) -> Unit) : SingleChoiceFilter(
title = "文库",
dialogTitle = "文库筛选",
description = "根据小说的文库筛选",
dialogTitleId = R.string.key_pub_filter_title,
descriptionId = R.string.key_pub_filter_desc,
choices = listOf("全部轻小说", "电击文库", "富士见文库", "角川文库", "MF文库J", "Fami通文库", "GA文库", "HJ文库", "一迅社", "集英社", "小学馆", "讲谈社", "少女文库", "其他文库", "游戏剧本"),
defaultChoice = "全部轻小说",
onChange = onChange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -134,7 +135,7 @@ fun SettingsBottomSheet(
)
Text(
modifier = Modifier.padding(start = 8.dp),
text = "设置预览",
text = stringResource(R.string.settings_preview),
style = MaterialTheme.typography.titleLarge,
fontWeight = FontWeight.Bold
)
Expand Down Expand Up @@ -220,7 +221,7 @@ fun SettingsBottomSheet(
Text(
modifier = Modifier.padding(horizontal = 16.dp),
style = MaterialTheme.typography.titleLarge,
text = "阅读器设置"
text = stringResource(R.string.reader_settings)
)
}

Expand Down Expand Up @@ -314,7 +315,7 @@ fun ContentSettings(
fun LazyListScope.AppearancePage(settingState: SettingState) {
item {
SettingsSliderEntry(
title = "阅读器字体大小",
title = stringResource(R.string.settings_reader_font_size),
unit = "sp",
valueRange = 8f..64f,
value = settingState.fontSize,
Expand All @@ -323,7 +324,7 @@ fun LazyListScope.AppearancePage(settingState: SettingState) {
}
item {
SettingsSliderEntry(
title = "阅读器行距大小",
title = stringResource(R.string.settings_reader_line_spacing),
unit = "sp",
valueRange = 0f..32f,
value = settingState.fontLineHeight,
Expand All @@ -332,40 +333,40 @@ fun LazyListScope.AppearancePage(settingState: SettingState) {
}
item {
SettingsSwitchEntry(
title = "屏幕常亮",
description = "在阅读页时,总是保持屏幕开启。这将导致耗电量增加",
title = stringResource(R.string.settings_reader_keep_screen_on),
description = stringResource(R.string.settings_reader_keep_screen_on_desc),
checked = settingState.keepScreenOn,
booleanUserData = settingState.keepScreenOnUserData,
)
}
item {
SettingsSwitchEntry(
title = "电量指示器",
description = "在页面左下角显示当前电量。",
title = stringResource(R.string.settings_reader_battery_indicator),
description = stringResource(R.string.settings_reader_battery_indicator_desc),
checked = settingState.enableBatteryIndicator,
booleanUserData = settingState.enableBatteryIndicatorUserData,
)
}
item {
SettingsSwitchEntry(
title = "时间指示器",
description = "在页面左下角显示当前时间。",
title = stringResource(R.string.settings_reader_time_indicator),
description = stringResource(R.string.settings_reader_time_indicator_desc),
checked = settingState.enableTimeIndicator,
booleanUserData = settingState.enableTimeIndicatorUserData,
)
}
item {
SettingsSwitchEntry(
title = "名称指示器",
description = "在页面右下角显示当前阅读章节名称。",
title = stringResource(R.string.settings_reader_chapter_indicator),
description = stringResource(R.string.settings_reader_chapter_indicator_desc),
checked = settingState.enableChapterTitleIndicator,
booleanUserData = settingState.enableChapterTitleIndicatorUserData,
)
}
item {
SettingsSwitchEntry(
title = "进度指示器",
description = "在页面右下角显示当前阅读进度。",
title = stringResource(R.string.settings_reader_progress_indicator),
description = stringResource(R.string.settings_reader_progress_indicator_desc),
checked = settingState.enableReadingChapterProgressIndicator,
booleanUserData = settingState.enableReadingChapterProgressIndicatorUserData,
)
Expand All @@ -375,8 +376,8 @@ fun LazyListScope.AppearancePage(settingState: SettingState) {
fun LazyListScope.ActionPage(settingState: SettingState) {
item {
SettingsSwitchEntry(
title = "翻页模式",
description = "切换滚动模式为翻页模式",
title = stringResource(R.string.settings_reader_page_mode),
description = stringResource(R.string.settings_reader_page_mode_desc),
checked = settingState.isUsingFlipPage,
booleanUserData = settingState.isUsingFlipPageUserData,
)
Expand All @@ -385,8 +386,8 @@ fun LazyListScope.ActionPage(settingState: SettingState) {
item {
SettingsSwitchEntry(
modifier = Modifier.animateItem(),
title = "音量键控制",
description = "使用音量+键切换至上一页,使用音量-键切换至下一页。",
title = stringResource(R.string.settings_reader_volume_key_control),
description = stringResource(R.string.settings_reader_volume_key_control_desc),
checked = settingState.isUsingVolumeKeyFlip,
booleanUserData = settingState.isUsingVolumeKeyFlipUserData,
)
Expand All @@ -396,8 +397,8 @@ fun LazyListScope.ActionPage(settingState: SettingState) {
item {
SettingsSwitchEntry(
modifier = Modifier.animateItem(),
title = "点击翻页",
description = "使用点击控制翻页,并将呼出菜单变为上下滑动。",
title = stringResource(R.string.settings_reader_t2tp),
description = stringResource(R.string.settings_reader_t2tp_desc),
checked = settingState.isUsingClickFlipPage,
booleanUserData = settingState.isUsingClickFlipPageUserData,
)
Expand All @@ -407,9 +408,9 @@ fun LazyListScope.ActionPage(settingState: SettingState) {
item {
SettingsMenuEntry(
modifier = Modifier.animateItem(),
title = "翻页动画",
description = "设置翻页时的动画,当为无时允许你快速翻页。",
options = MenuOptions.FlipAnimeOptions,
title = stringResource(R.string.settings_reader_page_turn_anim),
description = stringResource(R.string.settings_reader_page_turn_anim_desc),
options = MenuOptions.FlipAnimationOptions,
selectedOptionKey = settingState.flipAnime,
stringUserData = settingState.flipAnimeUserData
)
Expand All @@ -419,8 +420,8 @@ fun LazyListScope.ActionPage(settingState: SettingState) {
item {
SettingsSwitchEntry(
modifier = Modifier.animateItem(),
title = "快速切换章节",
description = "开启后,当你在每章尾页或首页翻页时,会自动切换到上一章或下一章。",
title = stringResource(R.string.settings_reader_quick_chapter_switch),
description = stringResource(R.string.settings_reader_quick_chapter_switch_desc),
checked = settingState.fastChapterChange,
booleanUserData = settingState.fastChapterChangeUserData,
)
Expand All @@ -431,16 +432,16 @@ fun LazyListScope.ActionPage(settingState: SettingState) {
fun LazyListScope.PaddingPage(settingState: SettingState) {
item {
SettingsSwitchEntry(
title = "自动获取边距",
description = "自动识别手机屏幕的边距,并进行显示适配,如关闭需要手动进行设置。",
title = stringResource(R.string.settings_reader_auto_margin),
description = stringResource(R.string.settings_reader_auto_margin_desc),
checked = settingState.autoPadding,
booleanUserData = settingState.autoPaddingUserData,
)
}
if (!settingState.autoPadding) {
item {
SettingsSliderEntry(
title = "上边距",
title = stringResource(R.string.settings_reader_top_margin),
unit = "dp",
valueRange = 0f..128f,
value = settingState.topPadding,
Expand All @@ -451,7 +452,7 @@ fun LazyListScope.PaddingPage(settingState: SettingState) {
if (!settingState.autoPadding) {
item {
SettingsSliderEntry(
title = "下边距",
title = stringResource(R.string.settings_reader_bottom_margin),
unit = "dp",
valueRange = 0f..128f,
value = settingState.bottomPadding,
Expand All @@ -462,7 +463,7 @@ fun LazyListScope.PaddingPage(settingState: SettingState) {
if (!settingState.autoPadding) {
item {
SettingsSliderEntry(
title = "左边距",
title = stringResource(R.string.settings_reader_left_margin),
unit = "dp",
valueRange = 0f..128f,
value = settingState.leftPadding,
Expand All @@ -473,7 +474,7 @@ fun LazyListScope.PaddingPage(settingState: SettingState) {
if (!settingState.autoPadding) {
item {
SettingsSliderEntry(
title = "右边距",
title = stringResource(R.string.settings_reader_right_margin),
unit = "dp",
valueRange = 0f..128f,
value = settingState.rightPadding,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class SettingState(
val isUsingFlipPage by isUsingFlipPageUserData.safeAsState(false)
val isUsingClickFlipPage by isUsingClickFlipPageUserData.safeAsState(false)
val isUsingVolumeKeyFlip by isUsingVolumeKeyFlipUserData.safeAsState(false)
val flipAnime by flipAnimeUserData.safeAsState(MenuOptions.FlipAnimeOptions.ScrollWithoutShadow)
val flipAnime by flipAnimeUserData.safeAsState(MenuOptions.FlipAnimationOptions.ScrollWithoutShadow)
val fastChapterChange by fastChapterChangeUserData.safeAsState(false)
val enableBatteryIndicator by enableBatteryIndicatorUserData.safeAsState(true)
val enableTimeIndicator by enableTimeIndicatorUserData.safeAsState(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ fun ContentText(
readingProgress = readingProgress,
isUsingClickFlip = isUsingClickFlip,
isUsingVolumeKeyFlip = isUsingVolumeKeyFlip,
flipAnime = flipAnime,
flipAnimation = flipAnime,
fastChapterChange = fastChapterChange,
onChapterReadingProgressChange = onChapterReadingProgressChange,
changeIsImmersive = changeIsImmersive,
Expand Down Expand Up @@ -193,7 +193,7 @@ fun SimpleFlipPageTextComponent(
readingProgress: Float,
isUsingClickFlip: Boolean,
isUsingVolumeKeyFlip: Boolean,
flipAnime: String,
flipAnimation: String,
fastChapterChange: Boolean,
onChapterReadingProgressChange: (Float) -> Unit,
changeIsImmersive: () -> Unit,
Expand All @@ -214,7 +214,7 @@ fun SimpleFlipPageTextComponent(
fun lastPage() {
if (pagerState.currentPage != 0)
scope.launch {
if (flipAnime != MenuOptions.FlipAnimeOptions.None)
if (flipAnimation != MenuOptions.FlipAnimationOptions.None)
pagerState.animateScrollToPage(pagerState.currentPage - 1)
else
pagerState.scrollToPage(pagerState.currentPage - 1)
Expand All @@ -225,7 +225,7 @@ fun SimpleFlipPageTextComponent(
fun nextPage() {
if (pagerState.currentPage + 1 < pagerState.pageCount)
scope.launch {
if (flipAnime != MenuOptions.FlipAnimeOptions.None)
if (flipAnimation != MenuOptions.FlipAnimationOptions.None)
pagerState.animateScrollToPage(pagerState.currentPage + 1)
else
pagerState.scrollToPage(pagerState.currentPage + 1)
Expand Down Expand Up @@ -266,7 +266,7 @@ fun SimpleFlipPageTextComponent(
onChapterReadingProgressChange(pagerState.currentPage.toFloat() / (pagerState.pageCount - 1))
else onChapterReadingProgressChange(1F)
}
DisposableEffect(isUsingVolumeKeyFlip, flipAnime, fastChapterChange) {
DisposableEffect(isUsingVolumeKeyFlip, flipAnimation, fastChapterChange) {
val localBroadcastManager = LocalBroadcastManager.getInstance(current)
val keycodeVolumeUpReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
Expand Down Expand Up @@ -320,7 +320,7 @@ fun SimpleFlipPageTextComponent(
if (it.absoluteValue > 60) changeIsImmersive.invoke()
}
)
.pointerInput(isUsingClickFlip, flipAnime, fastChapterChange) {
.pointerInput(isUsingClickFlip, flipAnimation, fastChapterChange) {
detectTapGestures(
onTap = {
if (isUsingClickFlip)
Expand Down
Loading

0 comments on commit 2f3e167

Please sign in to comment.