Skip to content

Commit

Permalink
Add more translatable Texts (#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
648480505 committed May 6, 2024
1 parent 0a76266 commit d8ca987
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ private fun button_settings()
}
})
{
Text("test Notification")
Text(i18n("ui.setting.test_notification"))
}
}

Expand Down
11 changes: 6 additions & 5 deletions src/main/kotlin/org/briarproject/briar/desktop/ui/AddFriend.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import com.zoffcc.applications.trifa.TRIFAGlobals.UINT32_MAX_JAVA
import com.zoffcc.applications.trifa.ToxVars.TOX_ADDRESS_SIZE
import contactstore
import org.briarproject.briar.desktop.contact.ContactItem
import org.briarproject.briar.desktop.utils.InternationalizationUtils.i18n

@Composable
fun AddFriend() = Box {
Expand All @@ -47,7 +48,7 @@ fun AddFriend() = Box {
capitalization = KeyboardCapitalization.None,
autoCorrect = false,
), value = add_friend_toxid, placeholder = {
Text("enter Friend's ToxID ...", fontSize = 13.sp)
Text(i18n("ui.addfriend.add_friend_toxid"), fontSize = 13.sp)
}, onValueChange = {
add_friend_toxid = it
if (it.length == (TOX_ADDRESS_SIZE * 2))
Expand All @@ -63,7 +64,7 @@ fun AddFriend() = Box {
Button(
onClick = {
// HINT: invite Friend
val friendnum: Long = tox_friend_add(add_friend_toxid, "please add me")
val friendnum: Long = tox_friend_add(add_friend_toxid, i18n("ui.addfriend.add_me"))
if (friendnum > -1)
{
if (friendnum != UINT32_MAX_JAVA)
Expand All @@ -82,15 +83,15 @@ fun AddFriend() = Box {
catch(_: java.lang.Exception)
{
}
contactstore.add(item = ContactItem(name = "new Friend #" + friendnum,
contactstore.add(item = ContactItem(name = i18n("ui.addfriend.new_friend") + " #" + friendnum,
isConnected = 0,
pubkey = friend_pubkey!!,
push_url = "",
is_relay = false))
} catch (_: Exception)
{
}
SnackBarToast("You have invited a new Friend")
SnackBarToast(i18n("ui.addfriend.invited_Friend"))
} else
{
// some error on adding friend
Expand All @@ -100,7 +101,7 @@ fun AddFriend() = Box {
// some error on adding friend
}
}, colors = ButtonDefaults.buttonColors(), enabled = add_button_enabled) {
Text("invite Friend")
Text(i18n("ui.addfriend.invite_friend"))
}
}
}
27 changes: 14 additions & 13 deletions src/main/kotlin/org/briarproject/briar/desktop/ui/AddGroup.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import com.zoffcc.applications.trifa.ToxVars
import com.zoffcc.applications.trifa.ToxVars.TOX_GROUP_CHAT_ID_SIZE
import groupstore
import org.briarproject.briar.desktop.contact.GroupItem
import org.briarproject.briar.desktop.utils.InternationalizationUtils.i18n
import java.nio.ByteBuffer
import java.util.*

Expand All @@ -63,7 +64,7 @@ fun AddGroup() = Box {
capitalization = KeyboardCapitalization.None,
autoCorrect = false,
), value = join_group_id, placeholder = {
Text("enter GroupID to join ...", fontSize = 13.sp)
Text(i18n("ui.group.enter_groupid"), fontSize = 13.sp)
}, onValueChange = {
join_group_id = it
if (it.length == (ToxVars.TOX_GROUP_CHAT_ID_SIZE * 2))
Expand Down Expand Up @@ -96,7 +97,7 @@ fun AddGroup() = Box {
try
{
val new_privacy_state = MainActivity.tox_group_get_privacy_state(new_group_num)
val group_name = "Group #" + new_group_num
val group_name = i18n("ui.group.new_group") + " #" + new_group_num
val group_num_peers = MainActivity.tox_group_peer_count(new_group_num)
groupstore.add(item = GroupItem(numPeers = group_num_peers.toInt(),
name = group_name!!, isConnected = 0,
Expand All @@ -105,14 +106,14 @@ fun AddGroup() = Box {
} catch (_: Exception)
{
}
SnackBarToast("You joined new Group")
SnackBarToast(i18n("ui.group.joined_new_group"))
} else
{
// some error on joining group
SnackBarToast("Error joining the Group")
SnackBarToast(i18n("ui.group.error_joining"))
}
}, colors = ButtonDefaults.buttonColors(), enabled = join_group_button_enabled) {
Text("join Group")
Text(i18n("ui.group.join_group"))
}
}
Spacer(modifier = Modifier.height(30.dp))
Expand Down Expand Up @@ -150,25 +151,25 @@ fun AddGroup() = Box {
} catch (_: Exception)
{
}
SnackBarToast("You joined the Public Information Group")
SnackBarToast(i18n("ui.group.joined_the"))
} else
{
// some error on joining group
SnackBarToast("Error joining the Public Information Group")
SnackBarToast(i18n("ui.group.error_joining_public"))
}
}, colors = ButtonDefaults.buttonColors()) {
Text("join the Public Information Group")
Text(i18n("ui.group.join_public"))
}
}
Spacer(modifier = Modifier.height(30.dp))
Row {
Spacer(modifier = Modifier.width(35.dp))
Text(fontWeight = FontWeight.ExtraBold,
fontSize = 16.sp,
text ="Important Notice: ")
text =i18n("ui.group.important_notice") + " ")
Text(fontWeight = FontWeight.Normal,
fontSize = 16.sp,
text ="Joining a Tox Public group for the first time can take a long time, even up to 30 minutes")
text =i18n("ui.group.joining_minutes"))
}
Spacer(modifier = Modifier.height(30.dp))
Row {
Expand All @@ -185,7 +186,7 @@ fun AddGroup() = Box {
capitalization = KeyboardCapitalization.None,
autoCorrect = false,
), value = new_public_group_name, placeholder = {
Text("enter Group Name", fontSize = 13.sp)
Text(i18n("ui.group.enter_group_name"), fontSize = 13.sp)
}, onValueChange = {
new_public_group_name = it
})
Expand Down Expand Up @@ -235,14 +236,14 @@ fun AddGroup() = Box {
{
}
new_public_group_name = ""
SnackBarToast("You created new public Group")
SnackBarToast(i18n("ui.group.created_new_public"))
} else
{
// some error on joining group
SnackBarToast("Error creating new public Group")
}
}, colors = ButtonDefaults.buttonColors(), enabled = new_public_group_name.isNotEmpty()) {
Text("Create new public Group")
Text(i18n("ui.group.created_public"))
}
}
Spacer(modifier = Modifier.height(30.dp))
Expand Down
24 changes: 23 additions & 1 deletion src/main/resources/strings/trifa_material.properties
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,26 @@ ui.explain_what_toxproxy_is=This is a Relay (ToxProxy) for a Contact in your Con
access.list.selected.yes=selected
access.list.selected.no=not selected
access.logo=logo
about.trifa_material_version=TRIfA Material Version
about.trifa_material_version=TRIfA Material Version
ui.addfriend.invite_friend=invite Friend
ui.addfriend.add_friend_toxid=enter Friend's ToxID ...
ui.addfriend.add_me=please add me
ui.addfriend.new_friend=new Friend
ui.addfriend.invited_Friend=You have invited a new Friend
ui.group.enter_groupid=enter GroupID to join ...
ui.group.new_group=Group
ui.group.joined_new_group=You joined new Group
ui.group.error_joining=Error joining the Group
ui.group.join_group=join Group
ui.group.joined_the=You joined the Public Information Group
ui.group.error_joining_public=Error joining the Public Information Group
ui.group.join_public=join the Public Information Group
ui.group.important_notice=Important Notice:
ui.group.joining_minutes=Joining a Tox Public group for the first time can take a long time, even up to 30 minutes
ui.group.enter_group_name=enter Group Name
ui.group.created_new_public=You created new public Group
ui.group.created_public=Create new public Group
ui.setting.test_notification=test Notification



0 comments on commit d8ca987

Please sign in to comment.