Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Russian translation & Fixes of non-localized strings #794

Merged
merged 6 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks.

} 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>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already two Saved string resources, maybe use an existing? Or is it not applicable in this context?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably. It is applicable in this context but there already were duplicating string resources previously for different contexts so i thought it would be better to separate them to leave some flexibility.

</resources>