Skip to content

Commit 943abc0

Browse files
committed
feat: manually sync un/incorrectly translated strings
- Sync/remove translated strings that have been updated since in English - Remove unnecessary strings or mark untranslatable - Get rid of custom annotated string resources, it's too difficult to use.
1 parent 3b23f0c commit 943abc0

File tree

36 files changed

+374
-998
lines changed

36 files changed

+374
-998
lines changed

app/src/main/kotlin/com/aliucord/manager/ui/screens/patching/PatchingScreen.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ class PatchingScreen(private val data: PatchOptions) : Screen, Parcelable {
239239

240240
PatchingScreenState.Success -> {
241241
MainActionButton(
242-
text = stringResource(R.string.action_launch_aliucord),
242+
text = stringResource(R.string.action_launch),
243243
icon = painterResource(R.drawable.ic_launch),
244244
onClick = model::launchApp,
245245
)

app/src/main/kotlin/com/aliucord/manager/ui/screens/plugins/components/PluginCard.kt

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ import androidx.compose.ui.text.style.TextDecoration
2121
import androidx.compose.ui.unit.dp
2222
import com.aliucord.manager.R
2323
import com.aliucord.manager.ui.screens.plugins.model.PluginItem
24-
import com.aliucord.manager.ui.util.annotatingStringResource
25-
import kotlinx.collections.immutable.persistentListOf
2624

2725
@Composable
2826
fun PluginCard(
@@ -44,17 +42,12 @@ fun PluginCard(
4442
Column {
4543
// Name
4644
Text(
47-
annotatingStringResource(
48-
R.string.plugins_plugin_title,
49-
persistentListOf(
50-
plugin.manifest.name,
51-
plugin.manifest.version,
52-
)
53-
) {
54-
when (it) {
55-
"plugin" -> SpanStyle(fontWeight = FontWeight.Bold)
56-
else -> null
45+
text = buildAnnotatedString {
46+
withStyle(SpanStyle(fontWeight = FontWeight.Bold)) {
47+
append(plugin.manifest.name)
5748
}
49+
append(" v")
50+
append(plugin.manifest.version)
5851
}
5952
)
6053

app/src/main/kotlin/com/aliucord/manager/ui/util/Utils.kt

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,66 +2,11 @@
22

33
package com.aliucord.manager.ui.util
44

5-
import androidx.annotation.StringRes
6-
import androidx.compose.runtime.Composable
75
import androidx.compose.runtime.Stable
86
import androidx.compose.runtime.saveable.Saver
97
import androidx.compose.ui.Modifier
108
import androidx.compose.ui.draw.scale
119
import androidx.compose.ui.graphics.Color
12-
import androidx.compose.ui.res.stringResource
13-
import androidx.compose.ui.text.*
14-
import kotlinx.collections.immutable.ImmutableList
15-
16-
/**
17-
* This formats and styles string resources into an [AnnotatedString].
18-
* By putting `§annotation_name§target string blah blah blah§` into the resource string it can be translated
19-
* (assuming `annotation_name` is not changed between translations),
20-
* when rendering [annotationHandler] will be called on each `annotation_name` and expected to return a target style on it.
21-
*/
22-
@Composable
23-
inline fun annotatingStringResource(
24-
@StringRes id: Int,
25-
args: ImmutableList<Any>,
26-
crossinline annotationHandler: @Composable (annotationName: String) -> SpanStyle?,
27-
): AnnotatedString {
28-
val string = stringResource(id, *args.toTypedArray())
29-
30-
val markerIndexes = string
31-
.mapIndexedNotNull { index, elem -> index.takeIf { elem == '§' } }
32-
.takeIf { it.isNotEmpty() && it.size % 3 == 0 }
33-
?: return AnnotatedString(string)
34-
35-
return buildAnnotatedString {
36-
var lastIndex = 0
37-
var offset = 0
38-
39-
for ((nameStart, nameEnd, valueEnd) in markerIndexes.chunked(3)) {
40-
append(string.substring(lastIndex, nameStart))
41-
append(string.substring(nameEnd + 1, valueEnd))
42-
43-
val annotationName = string.substring(nameStart + 1, nameEnd)
44-
val newValueStart = nameEnd - annotationName.length - offset - 1
45-
val newValueEnd = valueEnd - annotationName.length - offset - 2
46-
47-
addStringAnnotation(
48-
tag = annotationName,
49-
annotation = annotationName,
50-
start = newValueStart,
51-
end = newValueEnd,
52-
)
53-
54-
annotationHandler(annotationName)?.let {
55-
addStyle(it, newValueStart, newValueEnd)
56-
}
57-
58-
lastIndex = valueEnd + 1
59-
offset += 3 + annotationName.length
60-
}
61-
62-
append(string.substring(lastIndex))
63-
}
64-
}
6510

6611
@Stable
6712
inline fun Modifier.mirrorVertically(): Modifier =

app/src/main/res/values-af-rZA/strings.xml

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
33
<string name="app_name">Aliucord Manager</string>
4-
<string name="app_description">A modification for the Discord Android App</string>
5-
<string name="aliucord">Aliucord</string>
6-
<string name="discord">Discord</string>
7-
<string name="github">GitHub</string>
4+
<string name="app_description">A mod for the Discord Android App</string>
85
<string name="support_server">Support Server</string>
96
<string name="installer">Installer</string>
107
<string name="action_cancel">Cancel</string>
@@ -17,12 +14,10 @@
1714
<string name="action_dismiss">Dismiss</string>
1815
<string name="action_install">Install</string>
1916
<string name="action_uninstall">Uninstall</string>
20-
<string name="action_add_install">Add Installation</string>
21-
<string name="action_update_install">Update Aliucord Installation</string>
17+
<string name="action_add_install">New Install</string>
2218
<string name="action_update">Update</string>
2319
<string name="action_clear">Clear</string>
2420
<string name="action_launch">Launch</string>
25-
<string name="action_launch_aliucord">Launch</string>
2621
<string name="action_close">Close</string>
2722
<string name="action_open_settings">Open settings</string>
2823
<string name="action_search">Search</string>
@@ -31,11 +26,11 @@
3126
<string name="action_expand">Expand</string>
3227
<string name="action_copied">Copied!</string>
3328
<string name="action_cleared_cache">Cleared cache!</string>
34-
<string name="action_exit_anyways">Exit anyways</string>
35-
<string name="action_open_info">Open info</string>
29+
<string name="action_exit_anyways">Exit Anyways</string>
30+
<string name="action_open_info">Open Info</string>
3631
<string name="action_reset_default">Reset to default</string>
3732
<string name="permissions_grant_title">Grant Permissions</string>
38-
<string name="storage_permissions_grant_body">In order for Aliucord Manager to work properly, you need to grant file permissions. Since shared data in stored in ~/Aliucord, permissions are required in order for manager to function.</string>
33+
<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>
3934
<string name="install_permissions_grant_body">Installing Aliucord requires granting permissions to install apps from unknown sources.</string>
4035
<string name="installs_no_installs">No installations founds!</string>
4136
<string name="launch_aliucord_fail">Failed to launch Aliucord</string>
@@ -47,31 +42,28 @@
4742
<string name="setting_dynamic_color">Dynamic color</string>
4843
<string name="setting_dynamic_color_desc">Enables Material You theming on Android 12+</string>
4944
<string name="setting_developer_options">Developer options</string>
50-
<string name="setting_developer_options_desc">Don\'t enable this unless you know what you are doing!</string>
45+
<string name="setting_developer_options_desc">Don\'t enable this unless you know what it does! (yes, really)</string>
5146
<string name="setting_keep_patched_apks">Keep patched APKs</string>
52-
<string name="setting_keep_patched_apks_desc">Don\'t delete patched APKs after installing (for installing manually)</string>
5347
<string name="settings_clear_cache">Clear cache</string>
5448
<string name="theme_system">System</string>
5549
<string name="theme_dark">Dark</string>
5650
<string name="theme_light">Light</string>
5751
<string name="plugins_title">Plugins</string>
5852
<string name="plugins_view_changelog">View changelog for %1$s</string>
5953
<string name="plugins_delete_plugin">Uninstall %s</string>
60-
<string name="plugins_delete_plugin_body">Are you sure you want to uninstall this plugin?</string>
6154
<string name="plugins_none_installed">No plugins installed!</string>
6255
<string name="plugins_changelog_media">Changelog Media</string>
63-
<string name="plugins_plugin_title">§plugin§%1$s§ v%2$s</string>
6456
<string name="plugins_error">An error occurred while processing plugins!</string>
6557
<string name="navigation_back">Back</string>
6658
<string name="navigation_about">About</string>
6759
<string name="navigation_logs">Open logs</string>
6860
<string name="navigation_settings">Settings</string>
6961
<string name="contributors_lead">Lead</string>
7062
<string name="contributors">Contributors</string>
71-
<string name="contributors_contributions">%o contributions</string>
63+
<string name="contributors_contributions">%s contributions</string>
7264
<string name="network_load_fail">Failed to load</string>
7365
<string name="network_warning_title">Metered network</string>
74-
<string name="network_warning_body">It appears you are connected to mobile data or a potentially metered network. In order to continue with the installation, several hundred megabytes could be downloaded. Are you sure you want to continue?</string>
66+
<string name="network_warning_body">It appears you are connected to mobile data or a potentially metered network. Continuing with the installation may result in several hundred megabytes being downloaded. Are you sure you want to continue?</string>
7567
<string name="network_warning_disable">Don\'t show this again</string>
7668
<string name="version_supported">Supported version:</string>
7769
<string name="version_none">None</string>
@@ -83,7 +75,7 @@
8375
<string name="installer_file_save_success">Saved to %s</string>
8476
<string name="installer_file_save_failed">Failed to save %s</string>
8577
<string name="installer_install_success">Successfully installed Aliucord</string>
86-
<string name="installer_install_aborted">Aborted Aliucord installation</string>
78+
<string name="installer_install_aborted">Cancelled Aliucord installation</string>
8779
<string name="installer_uninstall_new">Please uninstall your current version of Aliucord in order to continue!</string>
8880
<string name="installer_uninstall_success">Successfully uninstalled Aliucord</string>
8981
<string name="installer_uninstall_aborted">Cancelled uninstallation</string>
@@ -95,22 +87,22 @@
9587
<string name="install_error_blocked">Installation was blocked</string>
9688
<string name="install_error_invalid">One or more APKs were invalid or corrupt</string>
9789
<string name="install_error_conflict">Conflicts with an existing app, usually due to mismatched signatures</string>
98-
<string name="install_error_storage">Not enough available storage to install</string>
90+
<string name="install_error_storage">Not enough storage available to install</string>
9991
<string name="install_error_incompatible">Application is incompatible with this device</string>
10092
<string name="install_error_timeout">Installation timed out</string>
10193
<string name="install_group_prepare">Prepare</string>
10294
<string name="install_group_download">Download dependencies</string>
10395
<string name="install_group_patch">Patch APKs</string>
10496
<string name="install_group_install">Install</string>
10597
<string name="patch_step_fetch_kt_version">Fetching target Discord version</string>
106-
<string name="patch_step_downgrade_check">Checking for older installations</string>
98+
<string name="patch_step_downgrade_check">Checking for newer installations</string>
10799
<string name="patch_step_dl_kt_apk">Downloading Discord APK</string>
108100
<string name="patch_step_dl_kotlin">Downloading Kotlin library</string>
109-
<string name="patch_step_dl_injector">Downloading injector</string>
101+
<string name="patch_step_dl_injector">Downloading Aliucord Injector</string>
110102
<string name="patch_step_dl_aliuhook">Downloading Aliuhook library</string>
111103
<string name="patch_step_dl_smali">Downloading smali patches</string>
112104
<string name="patch_step_copy_deps">Copying dependencies</string>
113-
<string name="patch_step_patch_manifests">Patching apk manifests</string>
105+
<string name="patch_step_patch_manifests">Patching APK manifest</string>
114106
<string name="patch_step_patch_icon">Patching app icon</string>
115107
<string name="patch_step_add_injector">Adding Aliucord injector</string>
116108
<string name="patch_step_add_aliuhook">Adding Aliuhook library</string>
@@ -127,7 +119,7 @@
127119
<string name="status_success">Success</string>
128120
<string name="status_failed">Failed</string>
129121
<string name="installer_abort_title">Really exit?</string>
130-
<string name="installer_abort_body">Are you sure you really want to abort an in-progress installation? Cached files will be cleared to avoid corruption.</string>
122+
<string name="installer_abort_body">Are you sure you really want to abort an in-progress installation?</string>
131123
<string name="updater_body">A new update has been released for Aliucord Manager! It may be required in order to function properly. Would you like to update?</string>
132124
<string name="updater_title">Update to %1$s</string>
133125
<string name="updater_fail">Failed to check for updates!</string>
@@ -148,7 +140,7 @@
148140
<string name="patchopts_debuggable_title">Debuggable</string>
149141
<string name="patchopts_debuggable_desc">Enable the debuggable manifest flag. Only use this if you know what you are doing!</string>
150142
<string name="patchopts_icon_title">Replace app icon</string>
151-
<string name="patchopts_icon_desc">Changes the app\'s icon to use Aliucord branding instead of Discord\'s own.</string>
143+
<string name="patchopts_icon_desc">Change the app\'s icon to Aliucord\'s icon (or a custom one) instead of Discord\'s.</string>
152144
<string name="patchopts_divider_basic">Basic</string>
153145
<string name="patchopts_divider_advanced">Advanced</string>
154146
<string name="patchopts_warning_invalid_iconopts">The selected icon options are invalid!</string>
@@ -160,7 +152,7 @@
160152
<string name="iconopts_variant_desc_discord">Does not alter the original icon, instead only adding the missing monochrome icon to the APK.</string>
161153
<string name="iconopts_variant_desc_aliucord">Changes the original icon color to Aliucord\'s branding.</string>
162154
<string name="iconopts_variant_desc_color">Select a custom icon background color.</string>
163-
<string name="iconopts_variant_desc_image">Select a custom replacement image. Note that the image must have sufficient padding as per the Adaptive Icon foreground guidelines. Android 8+ only.</string>
155+
<string name="iconopts_variant_desc_image">Select a custom replacement image. Note that the image must have sufficient padding as per the Adaptive Icon foreground guidelines. Maximum image size is 256KiB.</string>
164156
<string name="iconopts_colorpicker_title">Hue &amp; Saturation</string>
165157
<string name="iconopts_colorpicker_desc">The main HSV color components.</string>
166158
<string name="iconopts_lightness_title">Lightness</string>
@@ -210,9 +202,7 @@
210202
<string name="fun_fact_5">Did you know AliucordRN spawned Enmity and Vendetta?</string>
211203
<string name="fun_fact_6">Having issues? Visit the #support channel in our Discord!</string>
212204
<string name="fun_fact_7">The IWillCrashYourDiscord plugin crashes your discord.</string>
213-
<string name="fun_fact_8">\"@Vendicated my bad.\"</string>
214205
<string name="fun_fact_9">Aliucord can run on WearOS</string>
215206
<string name="fun_fact_10">Aliucord uses the *real* old UI, from mid-2022!</string>
216207
<string name="fun_fact_11">There was an attempt to make Aliucord run on iOS…</string>
217-
<string name="fun_fact_12">veeeee 😭</string>
218208
</resources>

0 commit comments

Comments
 (0)