-
Notifications
You must be signed in to change notification settings - Fork 169
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
Added Japanese Translation Strings #686
Changes from 4 commits
726b3d7
b725d3a
c61eaa7
2a6e31f
d25c8fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -983,6 +983,9 @@ fun getLocalizedSortingTypeName(context: Context, sortingType: SortType): String | |
return returnString | ||
} | ||
|
||
/** | ||
* Returns localized Strings for UserTab Enum | ||
*/ | ||
fun getLocalizedStringForUserTab(ctx: Context, tab: UserTab): String { | ||
val returnString = when (tab) { | ||
UserTab.About -> ctx.getString(R.string.person_profile_activity_about) | ||
|
@@ -991,3 +994,39 @@ fun getLocalizedStringForUserTab(ctx: Context, tab: UserTab): String { | |
} | ||
return returnString | ||
} | ||
|
||
/** | ||
* Returns localized Strings for ListingType Enum | ||
*/ | ||
fun getLocalizedListingTypeName(context: Context, listingType: ListingType): String { | ||
val returnString = when (listingType) { | ||
ListingType.All -> context.getString(R.string.home_all) | ||
ListingType.Local -> context.getString(R.string.home_local) | ||
ListingType.Subscribed -> context.getString(R.string.home_subscribed) | ||
} | ||
return returnString | ||
} | ||
|
||
/** | ||
* Returns localized Strings for CommentSortType Enum | ||
*/ | ||
fun getLocalizedCommentSortTypeName(context: Context, commentSortType: CommentSortType): String { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same. |
||
val returnString = when (commentSortType) { | ||
CommentSortType.Hot -> context.getString(R.string.sorttype_hot) | ||
CommentSortType.New -> context.getString(R.string.sorttype_new) | ||
CommentSortType.Old -> context.getString(R.string.sorttype_old) | ||
CommentSortType.Top -> context.getString(R.string.dialogs_top) | ||
} | ||
return returnString | ||
} | ||
|
||
/** | ||
* Returns localized Strings for UnreadOrAll Enum | ||
*/ | ||
fun getLocalizedUnreadOrAllName(context: Context, unreadOrAll: UnreadOrAll): String { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same. |
||
val returnString = when (unreadOrAll) { | ||
UnreadOrAll.Unread -> context.getString(R.string.dialogs_unread) | ||
UnreadOrAll.All -> context.getString(R.string.dialogs_all) | ||
} | ||
return returnString | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ import androidx.compose.material3.* | |
import androidx.compose.runtime.* | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.navigation.NavController | ||
|
@@ -18,6 +19,7 @@ import com.jerboa.datatypes.CommunityView | |
import com.jerboa.datatypes.SortType | ||
import com.jerboa.datatypes.SubscribedType | ||
import com.jerboa.datatypes.sampleCommunityView | ||
import com.jerboa.getLocalizedSortingTypeName | ||
import com.jerboa.ui.components.common.DefaultBackButton | ||
import com.jerboa.ui.components.common.IconAndTextDrawerItem | ||
import com.jerboa.ui.components.common.LargerCircularIcon | ||
|
@@ -207,13 +209,14 @@ fun CommunityHeaderTitle( | |
communityName: String, | ||
selectedSortType: SortType, | ||
) { | ||
val context = LocalContext.current | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ctx |
||
Column { | ||
Text( | ||
text = communityName, | ||
style = MaterialTheme.typography.titleLarge, | ||
) | ||
Text( | ||
text = selectedSortType.toString(), | ||
text = getLocalizedSortingTypeName(context, selectedSortType), | ||
style = MaterialTheme.typography.titleMedium, | ||
) | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,7 @@ import androidx.compose.runtime.saveable.rememberSaveable | |
import androidx.compose.runtime.setValue | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.navigation.NavController | ||
|
@@ -74,6 +75,8 @@ import com.jerboa.datatypes.api.MyUserInfo | |
import com.jerboa.datatypes.samplePersonSafe | ||
import com.jerboa.db.Account | ||
import com.jerboa.db.AccountViewModel | ||
import com.jerboa.getLocalizedListingTypeName | ||
import com.jerboa.getLocalizedSortingTypeName | ||
import com.jerboa.ui.components.common.IconAndTextDrawerItem | ||
import com.jerboa.ui.components.common.LargerCircularIcon | ||
import com.jerboa.ui.components.common.ListingTypeOptionsDialog | ||
|
@@ -439,13 +442,14 @@ fun HomeHeaderTitle( | |
selectedSortType: SortType, | ||
selectedListingType: ListingType, | ||
) { | ||
val context = LocalContext.current | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ctx |
||
Column { | ||
Text( | ||
text = selectedListingType.toString(), | ||
text = getLocalizedListingTypeName(context, selectedListingType), | ||
style = MaterialTheme.typography.titleLarge, | ||
) | ||
Text( | ||
text = selectedSortType.toString(), | ||
text = getLocalizedSortingTypeName(context, selectedSortType), | ||
style = MaterialTheme.typography.titleSmall, | ||
) | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,11 +18,13 @@ import androidx.compose.runtime.getValue | |
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.setValue | ||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.navigation.NavController | ||
import androidx.navigation.compose.rememberNavController | ||
import com.jerboa.R | ||
import com.jerboa.UnreadOrAll | ||
import com.jerboa.getLocalizedUnreadOrAllName | ||
import com.jerboa.ui.components.common.DefaultBackButton | ||
import com.jerboa.ui.components.common.UnreadOrAllOptionsDialog | ||
|
||
|
@@ -79,6 +81,7 @@ fun InboxHeader( | |
@Composable | ||
fun InboxHeaderTitle(selectedUnreadOrAll: UnreadOrAll, unreadCount: Int? = null) { | ||
var title = stringResource(R.string.inbox_inbox) | ||
val context = LocalContext.current | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same |
||
if (unreadCount != null && unreadCount > 0) { | ||
title = "$title ($unreadCount)" | ||
} | ||
|
@@ -88,7 +91,7 @@ fun InboxHeaderTitle(selectedUnreadOrAll: UnreadOrAll, unreadCount: Int? = null) | |
style = MaterialTheme.typography.titleLarge, | ||
) | ||
Text( | ||
text = selectedUnreadOrAll.toString(), | ||
text = getLocalizedUnreadOrAllName(context, selectedUnreadOrAll), | ||
style = MaterialTheme.typography.titleMedium, | ||
) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow the convention above:
ctx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK thanks for the heads up. I was looking for a convention to follow for naming, I found in Utils.kt context: Context instead of ctx was being used in convertSpToPx and getLocalizedSortinTypeName methods so I was following that. I'll make the fixes now and try to push them to this branch.