commit 9c3cfb06851d2a9743347ee659cce22d49f1589b
parent 621c16d7f4c01bdfae42e9bfcb0238c445452034
Author: RSR/ <52901789+RSR1337@users.noreply.github.com>
Date: Sat, 2 Aug 2025 16:09:08 +0400
feat: translations (#1410)
Signed-off-by: rhunk <101876869+rhunk@users.noreply.github.com>
Co-authored-by: rhunk <101876869+rhunk@users.noreply.github.com>
Diffstat:
3 files changed, 42 insertions(+), 10 deletions(-)
diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/ui/manager/pages/tracker/EditRule.kt b/app/src/main/kotlin/me/rhunk/snapenhance/ui/manager/pages/tracker/EditRule.kt
@@ -334,7 +334,7 @@ class EditRule : Routes.Route() {
onClick = { showDropdown.value = true },
modifier = Modifier.menuAnchor(MenuAnchorType.PrimaryNotEditable)
) {
- Text(currentEventType, overflow = TextOverflow.Ellipsis, maxLines = 1)
+ Text(context.translation["tracker_events.$currentEventType"], overflow = TextOverflow.Ellipsis, maxLines = 1)
}
DropdownMenu(expanded = showDropdown.value, onDismissRequest = { showDropdown.value = false }) {
TrackerEventType.entries.forEach { eventType ->
@@ -342,7 +342,7 @@ class EditRule : Routes.Route() {
currentEventType = eventType.key
showDropdown.value = false
}, text = {
- Text(eventType.key)
+ Text(context.translation["tracker_events.${eventType.key}"])
})
}
}
@@ -357,7 +357,7 @@ class EditRule : Routes.Route() {
.padding(2.dp),
) {
TrackerRuleAction.entries.forEach { action ->
- ActionCheckbox(action.name, checked = remember { mutableStateOf(addEventActions.contains(action)) }) {
+ ActionCheckbox(context.translation["tracker_actions.${action.key}"], checked = remember { mutableStateOf(addEventActions.contains(action)) }) {
if (it) {
addEventActions += action
} else {
@@ -422,8 +422,8 @@ class EditRule : Routes.Route() {
modifier = Modifier.size(24.dp)
)
Column {
- Text(event.eventType, lineHeight = 20.sp, fontSize = 18.sp, fontWeight = FontWeight.Bold)
- Text(text = event.actions.joinToString(", ") { it.name }, fontSize = 10.sp, fontWeight = FontWeight.Light, overflow = TextOverflow.Ellipsis, maxLines = 1, lineHeight = 14.sp)
+ Text(context.translation["tracker_events.${event.eventType}"], lineHeight = 20.sp, fontSize = 18.sp, fontWeight = FontWeight.Bold)
+ Text(text = event.actions.joinToString(", ") { context.translation["tracker_actions.${it.key}"] }, fontSize = 10.sp, fontWeight = FontWeight.Light, overflow = TextOverflow.Ellipsis, maxLines = 1, lineHeight = 14.sp)
}
}
OutlinedIconButton(
@@ -453,5 +453,4 @@ class EditRule : Routes.Route() {
}
}
}
-}
-
+}+
\ No newline at end of file
diff --git a/common/src/main/assets/lang/en_US.json b/common/src/main/assets/lang/en_US.json
@@ -1541,7 +1541,39 @@
"cancel": "Cancel",
"open": "Open",
"download": "Download",
- "send": "Send"
+ "send": "Send",
+ "restore_original": "Restore Original",
+ "convert_external_media": "Convert External Media"
+ },
+
+ "tracker_events": {
+ "conversation_enter": "Conversation Enter",
+ "conversation_exit": "Conversation Exit",
+ "started_typing": "Started Typing",
+ "stopped_typing": "Stopped Typing",
+ "started_speaking": "Started Speaking",
+ "stopped_speaking": "Stopped Speaking",
+ "started_peeking": "Started Peeking",
+ "stopped_peeking": "Stopped Peeking",
+ "message_read": "Message Read",
+ "message_deleted": "Message Deleted",
+ "message_saved": "Message Saved",
+ "message_unsaved": "Message Unsaved",
+ "message_edited": "Message Edited",
+ "message_reaction_add": "Message Reaction Add",
+ "message_reaction_remove": "Message Reaction Remove",
+ "snap_opened": "Snap Opened",
+ "snap_replayed": "Snap Replayed",
+ "snap_replayed_twice": "Snap Replayed Twice",
+ "snap_screenshot": "Snap Screenshot",
+ "snap_screen_record": "Snap Screen Record"
+ },
+
+ "tracker_actions": {
+ "log": "Log",
+ "in_app_notification": "In-App Notification",
+ "push_notification": "Push Notification",
+ "custom": "Custom"
},
"better_notifications": {
diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/experiments/ConvertMessageLocally.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/experiments/ConvertMessageLocally.kt
@@ -27,7 +27,7 @@ class ConvertMessageLocally : Feature("Convert Message Edit") {
fun convertMessageInterface(messageInstance: Message) {
val actions = mutableMapOf<String, (Message) -> Unit>()
- actions["restore_original"] = actions@{ message ->
+ actions[context.translation["button.restore_original"]] = actions@{ message ->
val descriptor = message.messageDescriptor ?: return@actions
messageCache.remove(descriptor.messageId!!)
context.feature(Messaging::class).conversationManager?.fetchMessage(
@@ -41,7 +41,7 @@ class ConvertMessageLocally : Feature("Convert Message Edit") {
val contentType = messageInstance.messageContent?.contentType
if (contentType == ContentType.SNAP) {
- actions["convert_external_media"] = convert@{ message ->
+ actions[context.translation["button.convert_external_media"]] = convert@{ message ->
val snapMessageContent = ProtoReader(message.messageContent!!.content!!).followPath(11)
?.getBuffer() ?: return@convert
message.messageContent!!.content = ProtoWriter().apply {