refactor(l10n): Unhardcode values and use proper name

This commit is contained in:
pylixonly 2025-07-14 16:10:23 +08:00
parent c9a9c01e2f
commit 0708640ad4
11 changed files with 28 additions and 24 deletions

View file

@ -11,6 +11,6 @@ class DownloadDiscordRNABaseStep : DownloadDiscordRNAStep() {
override val targetUrl get() = "$BASE_URL/tracker/download/$version/base" override val targetUrl get() = "$BASE_URL/tracker/download/$version/base"
override val targetFile get() = paths.discordApkVersionCache(version).resolve("base.apk") override val targetFile get() = paths.discordApkVersionCache(version).resolve("base.apk")
override val localizedName = R.string.downloading_base_apk override val localizedName = R.string.patch_step_dl_baseapk
} }

View file

@ -12,5 +12,5 @@ class DownloadDiscordRNALangStep : DownloadDiscordRNAStep() {
override val targetUrl get() = "$BASE_URL/tracker/download/$version/config.en" override val targetUrl get() = "$BASE_URL/tracker/download/$version/config.en"
override val targetFile get() = paths.discordApkVersionCache(version).resolve("config.en.apk") override val targetFile get() = paths.discordApkVersionCache(version).resolve("config.en.apk")
override val localizedName = R.string.download_libs_apk override val localizedName = R.string.patch_step_dl_libapk
} }

View file

@ -13,5 +13,5 @@ class DownloadDiscordRNALibStep : DownloadDiscordRNAStep() {
override val targetUrl get() = "$BASE_URL/tracker/download/$version/config.$arch" override val targetUrl get() = "$BASE_URL/tracker/download/$version/config.$arch"
override val targetFile get() = paths.discordApkVersionCache(version).resolve("config.$arch.apk") override val targetFile get() = paths.discordApkVersionCache(version).resolve("config.$arch.apk")
override val localizedName = R.string.downloading_libs_apk override val localizedName = R.string.patch_step_dl_libapk
} }

View file

@ -11,5 +11,5 @@ class DownloadDiscordRNAResourcesStep : DownloadDiscordRNAStep() {
override val targetUrl get() = "$BASE_URL/tracker/download/$version/config.xxhdpi" override val targetUrl get() = "$BASE_URL/tracker/download/$version/config.xxhdpi"
override val targetFile get() = paths.discordApkVersionCache(version).resolve("config.xxhdpi.apk") override val targetFile get() = paths.discordApkVersionCache(version).resolve("config.xxhdpi.apk")
override val localizedName = R.string.downloading_resources_apk override val localizedName = R.string.patch_step_dl_resapk
} }

View file

@ -13,7 +13,7 @@ class DownloadWintryXposedStep : DownloadStep() {
private val paths: PathManager by inject() private val paths: PathManager by inject()
private val wintryGithubService: WintryGithubService by inject() private val wintryGithubService: WintryGithubService by inject()
override val localizedName = R.string.downloading_wintryxposed override val localizedName = R.string.patch_step_dl_wtxposed
override val targetFile get() = paths.cachedWintryXposed(targetVersion) override val targetFile get() = paths.cachedWintryXposed(targetVersion)
override lateinit var targetUrl: String override lateinit var targetUrl: String

View file

@ -16,7 +16,7 @@ import java.io.File
class InjectWintryXposedStep : Step() { class InjectWintryXposedStep : Step() {
override val group: StepGroup = StepGroup.Install override val group: StepGroup = StepGroup.Install
override val localizedName: Int = R.string.injecting_wintryxposed_with_lspatch override val localizedName: Int = R.string.patch_step_inject_wintry
suspend fun patch( suspend fun patch(
container: StepRunner, container: StepRunner,

View file

@ -16,7 +16,7 @@ class FetchDiscordRNAStep(val options: PatchOptions) : Step(), KoinComponent {
private val rnaTrackerService: RNATrackerService by inject() private val rnaTrackerService: RNATrackerService by inject()
override val group: StepGroup = StepGroup.Prepare override val group: StepGroup = StepGroup.Prepare
override val localizedName: Int = R.string.fetching_latest_discord_info override val localizedName: Int = R.string.patch_step_fetch_rna
var targetVersion by Delegates.notNull<Int>() var targetVersion by Delegates.notNull<Int>()
private set private set

View file

@ -99,7 +99,7 @@ fun InstalledItemCard(
if (data.isUpToDate != false) if (data.isUpToDate != false)
SegmentedButton( SegmentedButton(
icon = painterResource(R.drawable.ic_refresh), icon = painterResource(R.drawable.ic_refresh),
text = stringResource(R.string.reinstall), text = stringResource(R.string.action_reinstall),
onClick = onUpdate, onClick = onUpdate,
) )
else { else {

View file

@ -251,9 +251,9 @@ fun PatchOptionsScreenContent(
} }
SelectPatchOption( SelectPatchOption(
icon = painterResource(R.drawable.ic_app_shortcut), icon = painterResource(R.drawable.ic_code),
name = "Preferred version", name = stringResource(R.string.patchopts_verchannel_title),
description = "Choose which release channel or input a custom version code to use for installation.", description = stringResource(R.string.patchopts_verchannel_desc),
options = VersionPreference.entries.map { it.name }, options = VersionPreference.entries.map { it.name },
selectedOption = versionPreference.name, selectedOption = versionPreference.name,
onOptionSelected = { selected -> onOptionSelected = { selected ->
@ -266,8 +266,8 @@ fun PatchOptionsScreenContent(
label = "Custom version code option visibility" label = "Custom version code option visibility"
) { ) {
TextPatchOption( TextPatchOption(
name = "Custom version code", name = stringResource(R.string.patchopts_vercode_title),
description = "Input a custom version code to use for installation.", description = stringResource(R.string.patchopts_vercode_desc),
value = customVersionCode, value = customVersionCode,
valueIsError = customVersionCodeIsError, valueIsError = customVersionCodeIsError,
valueIsDefault = customVersionCode == PatchOptions.Default.customVersionCode, valueIsDefault = customVersionCode == PatchOptions.Default.customVersionCode,

View file

@ -48,7 +48,7 @@ sealed interface DiscordVersion : Comparable<DiscordVersion>, Parcelable {
@Composable @Composable
fun toDisplayName() = when (this) { fun toDisplayName() = when (this) {
is Error -> stringResource(R.string.version_load_fail) is Error -> stringResource(R.string.version_load_fail)
is Invalid -> stringResource(R.string.invalid_version_code_format) is Invalid -> stringResource(R.string.version_invalid_code)
is None -> stringResource(R.string.version_none) is None -> stringResource(R.string.version_none)
is Existing -> when (type) { is Existing -> when (type) {
Type.STABLE -> stringResource(R.string.version_stable) Type.STABLE -> stringResource(R.string.version_stable)

View file

@ -34,6 +34,7 @@
<string name="action_exit_anyways">Exit Anyways</string> <string name="action_exit_anyways">Exit Anyways</string>
<string name="action_open_info">Open Info</string> <string name="action_open_info">Open Info</string>
<string name="action_reset_default">Reset to default</string> <string name="action_reset_default">Reset to default</string>
<string name="action_reinstall">Reinstall</string>
<string name="permissions_grant_title">Grant Permissions</string> <string name="permissions_grant_title">Grant Permissions</string>
<string name="storage_permissions_grant_body">In order for Aliucord Manager to function, file permissions are required. Since shared data is stored in ~/Aliucord, permissions are required in order to access it.</string> <string name="storage_permissions_grant_body">In order for Aliucord Manager to function, file permissions are required. Since shared data is stored in ~/Aliucord, permissions are required in order to access it.</string>
@ -89,6 +90,8 @@
<string name="version_alpha">Alpha</string> <string name="version_alpha">Alpha</string>
<string name="version_unknown">Unknown</string> <string name="version_unknown">Unknown</string>
<string name="version_load_fail">Failed to retrieve version</string> <string name="version_load_fail">Failed to retrieve version</string>
<string name="version_invalid_code">Invalid version code format</string>
<string name="installer_file_save_success">Saved to %s</string> <string name="installer_file_save_success">Saved to %s</string>
<string name="installer_file_save_failed">Failed to save %s</string> <string name="installer_file_save_failed">Failed to save %s</string>
@ -116,6 +119,7 @@
<string name="install_group_patch">Patch APK</string> <string name="install_group_patch">Patch APK</string>
<string name="install_group_install">Install APK</string> <string name="install_group_install">Install APK</string>
<string name="patch_step_fetch_rna">Fetching latest Discord info</string>
<string name="patch_step_fetch_kt_version">Fetching target Discord version</string> <string name="patch_step_fetch_kt_version">Fetching target Discord version</string>
<string name="patch_step_downgrade_check">Checking for newer installations</string> <string name="patch_step_downgrade_check">Checking for newer installations</string>
<string name="patch_step_restore_cache">Restoring from cache</string> <string name="patch_step_restore_cache">Restoring from cache</string>
@ -137,6 +141,12 @@
<string name="patch_step_install">Installing APK</string> <string name="patch_step_install">Installing APK</string>
<string name="patch_step_cleanup">Cleaning up</string> <string name="patch_step_cleanup">Cleaning up</string>
<string name="patch_step_dl_baseapk">Downloading base APK</string>
<string name="patch_step_dl_libapk">Downloading libs apk</string>
<string name="patch_step_dl_resapk">Downloading resources apk</string>
<string name="patch_step_inject_wintry">Injecting WintryXposed with LSPatch</string>
<string name="patch_step_dl_wtxposed">Downloading WintryXposed</string>
<string name="status_queued">Queued</string> <string name="status_queued">Queued</string>
<string name="status_ongoing">Ongoing</string> <string name="status_ongoing">Ongoing</string>
<string name="status_skipped">Skipped</string> <string name="status_skipped">Skipped</string>
@ -174,6 +184,10 @@
<string name="patchopts_divider_basic">Basic</string> <string name="patchopts_divider_basic">Basic</string>
<string name="patchopts_divider_advanced">Advanced</string> <string name="patchopts_divider_advanced">Advanced</string>
<string name="patchopts_warning_invalid_iconopts">The selected icon options are invalid!</string> <string name="patchopts_warning_invalid_iconopts">The selected icon options are invalid!</string>
<string name="patchopts_verchannel_title">Version channel</string>
<string name="patchopts_verchannel_desc">Select the release channel to install from, or choose \'Custom\' to enter a specific version code.</string>
<string name="patchopts_vercode_title">Custom Version Code</string>
<string name="patchopts_vercode_desc">Manually enter a Discord version code to fetch and install.</string>
<string name="iconopts_screen_title">Icon Replacement</string> <string name="iconopts_screen_title">Icon Replacement</string>
<string name="iconopts_variant_title_old_discord">Old Discord</string> <string name="iconopts_variant_title_old_discord">Old Discord</string>
@ -246,14 +260,4 @@
<string name="fun_fact_11">There was an attempt to make Aliucord run on iOS…</string> <string name="fun_fact_11">There was an attempt to make Aliucord run on iOS…</string>
<string name="fun_fact_12" translatable="false">veeeee 😭</string> <string name="fun_fact_12" translatable="false">veeeee 😭</string>
<string name="download_libs_apk">Download libs apk</string>
<string name="downloading_base_apk">Downloading base APK</string>
<string name="downloading_libs_apk">Downloading libs apk</string>
<string name="downloading_resources_apk">Downloading resources apk</string>
<string name="injecting_wintryxposed_with_lspatch">Injecting WintryXposed with LSPatch</string>
<string name="downloading_wintryxposed">Downloading WintryXposed</string>
<string name="version_code">Version Code</string>
<string name="fetching_latest_discord_info">Fetching latest Discord info</string>
<string name="invalid_version_code_format">Invalid version code format</string>
<string name="reinstall">Reinstall</string>
</resources> </resources>