Skip to content

Commit

Permalink
Russian translation & Fixes of non-localized strings (#794)
Browse files Browse the repository at this point in the history
* Russian translation

* Russian locale fixes

* Unlocalized strings fixes

* Unused import removed to pass lint

* Other ru strings fixes
  • Loading branch information
Snow4DV authored Jun 21, 2023
1 parent 6ad3ab3 commit 30aa860
Show file tree
Hide file tree
Showing 7 changed files with 343 additions and 3 deletions.
4 changes: 4 additions & 0 deletions app/src/debug/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Jerboa (ОТЛАДКА)</string>
</resources>
13 changes: 13 additions & 0 deletions app/src/main/java/com/jerboa/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import com.jerboa.datatypes.types.*
import com.jerboa.db.Account
import com.jerboa.ui.components.home.HomeViewModel
import com.jerboa.ui.components.home.SiteViewModel
import com.jerboa.ui.components.inbox.InboxTab
import com.jerboa.ui.components.person.UserTab
import com.jerboa.ui.theme.SMALL_PADDING
import kotlinx.coroutines.CoroutineScope
Expand Down Expand Up @@ -1040,6 +1041,18 @@ fun getLocalizedUnreadOrAllName(ctx: Context, unreadOrAll: UnreadOrAll): String
return returnString
}

/**
* Returns localized Strings for InboxTab Enum
*/
fun getLocalizedStringForInboxTab(ctx: Context, tab: InboxTab): String {
val returnString = when (tab) {
InboxTab.Replies -> ctx.getString(R.string.inbox_activity_replies)
InboxTab.Mentions -> ctx.getString(R.string.inbox_activity_mentions)
InboxTab.Messages -> ctx.getString(R.string.inbox_activity_messages)
}
return returnString
}

fun findAndUpdatePrivateMessage(
messages: List<PrivateMessageView>,
updated: PrivateMessageView,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ fun InboxTabs(
scope: CoroutineScope,
padding: PaddingValues,
) {
val tabTitles = InboxTab.values().map { it.toString() }
val tabTitles = InboxTab.values().map { getLocalizedStringForInboxTab(ctx, it) }
val pagerState = rememberPagerState()

Column(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ fun PersonProfileActivity(
PersonProfileHeader(
scrollBehavior = scrollBehavior,
personName = if (savedMode) {
"Saved"
ctx.getString(R.string.bookmarks_activity_saved)
} else {
person.name
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ fun LookAndFeelActivity(
)
SettingsList(
state = themeColorState,
items = ThemeColor.values().map { it.name },
items = ThemeColor.values().map { stringResource(it.mode) },
icon = {
Icon(
imageVector = Icons.Outlined.Colorize,
Expand Down
319 changes: 319 additions & 0 deletions app/src/main/res/values-ru/strings.xml

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -310,4 +310,8 @@
<string name="saved_image">Saved image</string>
<string name="saving_image">Saving image…</string>
<string name="permission_denied">Permission denied</string>
<string name="inbox_activity_replies">Replies</string>
<string name="inbox_activity_mentions">Mentions</string>
<string name="inbox_activity_messages">Messages</string>
<string name="bookmarks_activity_saved">Saved</string>
</resources>

0 comments on commit 30aa860

Please sign in to comment.