diff --git a/app/src/main/java/com/jerboa/Utils.kt b/app/src/main/java/com/jerboa/Utils.kt index 43a2af932..69ab65991 100644 --- a/app/src/main/java/com/jerboa/Utils.kt +++ b/app/src/main/java/com/jerboa/Utils.kt @@ -106,7 +106,7 @@ fun toastException(ctx: Context?, error: Exception) { } fun loginFirstToast(ctx: Context) { - Toast.makeText(ctx, "Login first", Toast.LENGTH_SHORT).show() + Toast.makeText(ctx, ctx.getString(R.string.utils_login_first), Toast.LENGTH_SHORT).show() } enum class VoteType { diff --git a/app/src/main/java/com/jerboa/ui/components/comment/CommentNode.kt b/app/src/main/java/com/jerboa/ui/components/comment/CommentNode.kt index e4a4caa67..0fdfc09e2 100644 --- a/app/src/main/java/com/jerboa/ui/components/comment/CommentNode.kt +++ b/app/src/main/java/com/jerboa/ui/components/comment/CommentNode.kt @@ -47,11 +47,13 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalClipboardManager import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.tooling.preview.Preview import com.jerboa.Border import com.jerboa.CommentNodeData import com.jerboa.InstantScores +import com.jerboa.R import com.jerboa.VoteType import com.jerboa.border import com.jerboa.buildCommentsTree @@ -139,9 +141,9 @@ fun CommentBody( onLongClick: () -> Unit, ) { val content = if (comment.removed) { - "*Removed*" + stringResource(R.string.comment_body_removed) } else if (comment.deleted) { - "*Deleted*" + stringResource(R.string.comment_body_deleted) } else { comment.content } @@ -450,7 +452,7 @@ fun PostAndCommunityContextHeader( Row( verticalAlignment = Alignment.CenterVertically, ) { - Text(text = "in ", color = MaterialTheme.colorScheme.onBackground.muted) + Text(text = stringResource(R.string.comment_node_in), color = MaterialTheme.colorScheme.onBackground.muted) CommunityLink( community = community, onClick = onCommunityClick, @@ -639,53 +641,57 @@ fun CommentOptionsDialog( text = { Column { IconAndTextDrawerItem( - text = "Goto Comment", + text = stringResource(R.string.comment_node_goto_comment), icon = Icons.Outlined.Link, onClick = onCommentLinkClick, ) IconAndTextDrawerItem( - text = "View Source", + text = stringResource(R.string.comment_node_view_source), icon = Icons.Outlined.Description, onClick = onViewSourceClick, ) IconAndTextDrawerItem( - text = "Copy Permalink", + text = stringResource(R.string.comment_node_copy_permalink), icon = Icons.Outlined.ContentCopy, onClick = { val permalink = commentView.comment.ap_id localClipboardManager.setText(AnnotatedString(permalink)) - Toast.makeText(ctx, "Permalink Copied", Toast.LENGTH_SHORT).show() + Toast.makeText( + ctx, + ctx.getString(R.string.comment_node_permalink_copied), + Toast.LENGTH_SHORT, + ).show() onDismissRequest() }, ) if (!isCreator) { IconAndTextDrawerItem( - text = "Report Comment", + text = stringResource(R.string.comment_node_report_comment), icon = Icons.Outlined.Flag, onClick = onReportClick, ) IconAndTextDrawerItem( - text = "Block ${commentView.creator.name}", + text = stringResource(R.string.comment_node_block, commentView.creator.name), icon = Icons.Outlined.Block, onClick = onBlockCreatorClick, ) } if (isCreator) { IconAndTextDrawerItem( - text = "Edit", + text = stringResource(R.string.comment_node_edit), icon = Icons.Outlined.Edit, onClick = onEditCommentClick, ) val deleted = commentView.comment.deleted if (deleted) { IconAndTextDrawerItem( - text = "Restore", + text = stringResource(R.string.comment_node_restore), icon = Icons.Outlined.Restore, onClick = onDeleteCommentClick, ) } else { IconAndTextDrawerItem( - text = "Delete", + text = stringResource(R.string.comment_node_delete), icon = Icons.Outlined.Delete, onClick = onDeleteCommentClick, ) @@ -720,7 +726,7 @@ fun ShowMoreChildren( ) { TextButton( content = { - Text("${commentView.counts.child_count} more replies") + Text(stringResource(R.string.comment_node_more_replies, commentView.counts.child_count)) }, onClick = { onFetchChildrenClick(commentView) }, ) @@ -757,14 +763,14 @@ fun ShowCommentContextButtons( ) { OutlinedButton( content = { - Text("View Post") + Text(stringResource(R.string.comment_node_view_post)) }, onClick = { onPostClick(postId) }, ) if (showContextButton && commentParentId != null) { OutlinedButton( content = { - Text("View Context") + Text(stringResource(R.string.comment_node_view_context)) }, onClick = { onCommentClick(commentParentId) }, ) diff --git a/app/src/main/java/com/jerboa/ui/components/comment/edit/CommentEdit.kt b/app/src/main/java/com/jerboa/ui/components/comment/edit/CommentEdit.kt index cfcbafec7..9f039ff42 100644 --- a/app/src/main/java/com/jerboa/ui/components/comment/edit/CommentEdit.kt +++ b/app/src/main/java/com/jerboa/ui/components/comment/edit/CommentEdit.kt @@ -14,9 +14,11 @@ import androidx.compose.material.icons.outlined.* import androidx.compose.material3.* import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.TextFieldValue import androidx.navigation.NavController import androidx.navigation.compose.rememberNavController +import com.jerboa.R import com.jerboa.db.Account import com.jerboa.ui.components.common.MarkdownTextField @@ -29,7 +31,7 @@ fun CommentEditHeader( TopAppBar( title = { Text( - text = "Edit", + text = stringResource(R.string.comment_edit_edit), ) }, actions = { @@ -57,7 +59,7 @@ fun CommentEditHeader( ) { Icon( Icons.Outlined.Close, - contentDescription = "Back", + contentDescription = stringResource(R.string.comment_edit_back), ) } }, @@ -84,7 +86,7 @@ fun CommentEdit( onTextChange = onContentChange, account = account, modifier = Modifier.fillMaxWidth(), - placeholder = "Type your comment", + placeholder = stringResource(R.string.comment_edit_type_your_comment), ) } } diff --git a/app/src/main/java/com/jerboa/ui/components/comment/mentionnode/CommentMentionNode.kt b/app/src/main/java/com/jerboa/ui/components/comment/mentionnode/CommentMentionNode.kt index e7d27d1c1..a49a800f9 100644 --- a/app/src/main/java/com/jerboa/ui/components/comment/mentionnode/CommentMentionNode.kt +++ b/app/src/main/java/com/jerboa/ui/components/comment/mentionnode/CommentMentionNode.kt @@ -31,8 +31,10 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalClipboardManager import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.tooling.preview.Preview +import com.jerboa.R import com.jerboa.VoteType import com.jerboa.datatypes.CommunitySafe import com.jerboa.datatypes.PersonMentionView @@ -219,28 +221,35 @@ fun CommentReplyNodeOptionsDialog( text = { Column { IconAndTextDrawerItem( - text = "View Source", + text = stringResource(R.string.comment_mention_node_view_source), icon = Icons.Outlined.Description, onClick = onViewSourceClick, ) IconAndTextDrawerItem( - text = "Copy Permalink", + text = stringResource(R.string.comment_mention_node_copy_permalink), icon = Icons.Outlined.Link, onClick = { val permalink = personMentionView.comment.ap_id localClipboardManager.setText(AnnotatedString(permalink)) - Toast.makeText(ctx, "Permalink Copied", Toast.LENGTH_SHORT).show() + Toast.makeText( + ctx, + ctx.getString(R.string.comment_mention_node_permalink_copied), + Toast.LENGTH_SHORT, + ).show() onDismissRequest() }, ) if (!isCreator) { IconAndTextDrawerItem( - text = "Report Comment", + text = stringResource(R.string.comment_mention_node_report_comment), icon = Icons.Outlined.Flag, onClick = onReportClick, ) IconAndTextDrawerItem( - text = "Block ${personMentionView.creator.name}", + text = stringResource( + R.string.comment_mention_node_block, + personMentionView.creator.name, + ), icon = Icons.Outlined.Block, onClick = onBlockCreatorClick, ) diff --git a/app/src/main/java/com/jerboa/ui/components/comment/reply/CommentReply.kt b/app/src/main/java/com/jerboa/ui/components/comment/reply/CommentReply.kt index 36ffe83be..3888ee73c 100644 --- a/app/src/main/java/com/jerboa/ui/components/comment/reply/CommentReply.kt +++ b/app/src/main/java/com/jerboa/ui/components/comment/reply/CommentReply.kt @@ -13,10 +13,12 @@ import androidx.compose.material.icons.outlined.* import androidx.compose.material3.* import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.tooling.preview.Preview import androidx.navigation.NavController import androidx.navigation.compose.rememberNavController +import com.jerboa.R import com.jerboa.datatypes.CommentReplyView import com.jerboa.datatypes.CommentView import com.jerboa.datatypes.PersonMentionView @@ -40,7 +42,7 @@ fun CommentReplyHeader( TopAppBar( title = { Text( - text = "Reply", + text = stringResource(R.string.comment_reply_reply), ) }, actions = { @@ -68,7 +70,7 @@ fun CommentReplyHeader( ) { Icon( Icons.Outlined.Close, - contentDescription = "Back", + contentDescription = stringResource(R.string.comment_reply_back), ) } }, @@ -282,7 +284,7 @@ fun PostReply( onTextChange = onReplyChange, account = account, modifier = Modifier.fillMaxWidth(), - placeholder = "Type your comment", + placeholder = stringResource(R.string.comment_reply_type_your_comment), ) } } diff --git a/app/src/main/java/com/jerboa/ui/components/comment/replynode/CommentReplyNode.kt b/app/src/main/java/com/jerboa/ui/components/comment/replynode/CommentReplyNode.kt index 134bdee0e..2b98bf55e 100644 --- a/app/src/main/java/com/jerboa/ui/components/comment/replynode/CommentReplyNode.kt +++ b/app/src/main/java/com/jerboa/ui/components/comment/replynode/CommentReplyNode.kt @@ -31,8 +31,10 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalClipboardManager import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.tooling.preview.Preview +import com.jerboa.R import com.jerboa.VoteType import com.jerboa.datatypes.CommentReplyView import com.jerboa.datatypes.CommunitySafe @@ -219,28 +221,35 @@ fun CommentReplyNodeOptionsDialog( text = { Column { IconAndTextDrawerItem( - text = "View Source", + text = stringResource(R.string.comment_reply_node_view_source), icon = Icons.Outlined.Description, onClick = onViewSourceClick, ) IconAndTextDrawerItem( - text = "Copy Permalink", + text = stringResource(R.string.comment_reply_node_copy_permalink), icon = Icons.Outlined.Link, onClick = { val permalink = "${commentReplyView.comment.ap_id}" localClipboardManager.setText(AnnotatedString(permalink)) - Toast.makeText(ctx, "Permalink Copied", Toast.LENGTH_SHORT).show() + Toast.makeText( + ctx, + ctx.getString(R.string.comment_reply_node_permalink_copied), + Toast.LENGTH_SHORT, + ).show() onDismissRequest() }, ) if (!isCreator) { IconAndTextDrawerItem( - text = "Report Comment", + text = stringResource(R.string.comment_reply_node_report_comment), icon = Icons.Outlined.Flag, onClick = onReportClick, ) IconAndTextDrawerItem( - text = "Block ${commentReplyView.creator.name}", + text = stringResource( + R.string.comment_reply_node_block, + commentReplyView.creator.name, + ), icon = Icons.Outlined.Block, onClick = onBlockCreatorClick, ) diff --git a/app/src/main/java/com/jerboa/ui/components/common/AppBars.kt b/app/src/main/java/com/jerboa/ui/components/common/AppBars.kt index ca2279f09..bb8376b35 100644 --- a/app/src/main/java/com/jerboa/ui/components/common/AppBars.kt +++ b/app/src/main/java/com/jerboa/ui/components/common/AppBars.kt @@ -32,6 +32,7 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.TextStyle import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.Dp @@ -41,6 +42,7 @@ import androidx.navigation.compose.rememberNavController import com.google.accompanist.flowlayout.FlowCrossAxisAlignment import com.google.accompanist.flowlayout.FlowMainAxisAlignment import com.google.accompanist.flowlayout.FlowRow +import com.jerboa.R import com.jerboa.datatypes.PersonSafe import com.jerboa.datatypes.api.GetUnreadCountResponse import com.jerboa.datatypes.samplePersonSafe @@ -356,7 +358,7 @@ fun DotSpacer( style: TextStyle = MaterialTheme.typography.bodyMedium, ) { Text( - text = "·", + text = stringResource(R.string.app_bars_dot_spacer), style = style, color = MaterialTheme.colorScheme.onBackground.muted, modifier = Modifier.padding(horizontal = padding), @@ -464,7 +466,7 @@ fun Sidebar( ) } TimeAgo( - precedingString = "Created", + precedingString = stringResource(R.string.AppBars_created), includeAgo = true, published = published, ) @@ -508,32 +510,32 @@ fun CommentsAndPosts( ) { FlowRow { Text( - text = "${siFormat(usersActiveDay)} users / day", + text = stringResource(R.string.AppBars_users_day, siFormat(usersActiveDay)), color = MaterialTheme.colorScheme.onBackground.muted, ) DotSpacer(style = MaterialTheme.typography.bodyMedium) Text( - text = "${siFormat(usersActiveWeek)} users / week", + text = stringResource(R.string.AppBars_users_week, siFormat(usersActiveWeek)), color = MaterialTheme.colorScheme.onBackground.muted, ) DotSpacer(style = MaterialTheme.typography.bodyMedium) Text( - text = "${siFormat(usersActiveMonth)} users / month", + text = stringResource(R.string.AppBars_users_month, siFormat(usersActiveMonth)), color = MaterialTheme.colorScheme.onBackground.muted, ) DotSpacer(style = MaterialTheme.typography.bodyMedium) Text( - text = "${siFormat(usersActiveHalfYear)} users / 6 months", + text = stringResource(R.string.AppBars_users_6_months, siFormat(usersActiveHalfYear)), color = MaterialTheme.colorScheme.onBackground.muted, ) DotSpacer(style = MaterialTheme.typography.bodyMedium) Text( - text = "${siFormat(postCount)} posts", + text = stringResource(R.string.AppBars_posts, siFormat(postCount)), color = MaterialTheme.colorScheme.onBackground.muted, ) DotSpacer(style = MaterialTheme.typography.bodyMedium) Text( - text = "${siFormat(commentCount)} comments", + text = stringResource(R.string.AppBars_comments, siFormat(commentCount)), color = MaterialTheme.colorScheme.onBackground.muted, ) } diff --git a/app/src/main/java/com/jerboa/ui/components/common/Dialogs.kt b/app/src/main/java/com/jerboa/ui/components/common/Dialogs.kt index 6c6edbcbd..579ad1e77 100644 --- a/app/src/main/java/com/jerboa/ui/components/common/Dialogs.kt +++ b/app/src/main/java/com/jerboa/ui/components/common/Dialogs.kt @@ -27,8 +27,10 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import com.jerboa.PostViewMode +import com.jerboa.R import com.jerboa.UnreadOrAll import com.jerboa.datatypes.ListingType import com.jerboa.datatypes.SortType @@ -70,27 +72,27 @@ fun SortTopOptionsDialog( text = { Column { IconAndTextDrawerItem( - text = "Top Day", + text = stringResource(R.string.dialogs_top_day), onClick = { onClickSortType(SortType.TopDay) }, highlight = (selectedSortType == SortType.TopDay), ) IconAndTextDrawerItem( - text = "Top Week", + text = stringResource(R.string.dialogs_top_week), onClick = { onClickSortType(SortType.TopWeek) }, highlight = (selectedSortType == SortType.TopWeek), ) IconAndTextDrawerItem( - text = "Top Month", + text = stringResource(R.string.dialogs_top_month), onClick = { onClickSortType(SortType.TopMonth) }, highlight = (selectedSortType == SortType.TopMonth), ) IconAndTextDrawerItem( - text = "Top Year", + text = stringResource(R.string.dialogs_top_year), onClick = { onClickSortType(SortType.TopYear) }, highlight = (selectedSortType == SortType.TopYear), ) IconAndTextDrawerItem( - text = "Top All Time", + text = stringResource(R.string.dialogs_top_all_time), onClick = { onClickSortType(SortType.TopAll) }, highlight = (selectedSortType == SortType.TopAll), ) @@ -122,20 +124,20 @@ fun ListingTypeOptionsDialog( text = { Column { IconAndTextDrawerItem( - text = "Subscribed", + text = stringResource(R.string.dialogs_subscribed), icon = Icons.Outlined.Bookmarks, onClick = { onClickListingType(ListingType.Subscribed) }, highlight = (selectedListingType == ListingType.Subscribed), ) // TODO hide local for non-federated instances IconAndTextDrawerItem( - text = "Local", + text = stringResource(R.string.dialogs_local), icon = Icons.Outlined.LocationCity, onClick = { onClickListingType(ListingType.Local) }, highlight = (selectedListingType == ListingType.Local), ) IconAndTextDrawerItem( - text = "All", + text = stringResource(R.string.dialogs_all), icon = Icons.Outlined.Public, onClick = { onClickListingType(ListingType.All) }, highlight = (selectedListingType == ListingType.All), @@ -158,37 +160,37 @@ fun SortOptionsDialog( text = { Column { IconAndTextDrawerItem( - text = "Active", + text = stringResource(R.string.dialogs_active), icon = Icons.Outlined.Moving, onClick = { onClickSortType(SortType.Active) }, highlight = (selectedSortType == SortType.Active), ) IconAndTextDrawerItem( - text = "Hot", + text = stringResource(R.string.dialogs_hot), icon = Icons.Outlined.LocalFireDepartment, onClick = { onClickSortType(SortType.Hot) }, highlight = (selectedSortType == SortType.Hot), ) IconAndTextDrawerItem( - text = "New", + text = stringResource(R.string.dialogs_new), icon = Icons.Outlined.BrightnessLow, onClick = { onClickSortType(SortType.New) }, highlight = (selectedSortType == SortType.New), ) IconAndTextDrawerItem( - text = "Most Comments", + text = stringResource(R.string.dialogs_most_comments), icon = Icons.Outlined.FormatListNumbered, onClick = { onClickSortType(SortType.MostComments) }, highlight = (selectedSortType == SortType.MostComments), ) IconAndTextDrawerItem( - text = "New Comments", + text = stringResource(R.string.dialogs_new_comments), icon = Icons.Outlined.NewReleases, onClick = { onClickSortType(SortType.NewComments) }, highlight = (selectedSortType == SortType.NewComments), ) IconAndTextDrawerItem( - text = "Top", + text = stringResource(R.string.dialogs_top), icon = Icons.Outlined.BarChart, onClick = onClickSortTopOptions, more = true, @@ -211,14 +213,14 @@ fun UnreadOrAllOptionsDialog( text = { Column { IconAndTextDrawerItem( - text = "All", + text = stringResource(R.string.dialogs_all), icon = Icons.Outlined.List, onClick = { onClickUnreadOrAll(UnreadOrAll.All) }, highlight = (selectedUnreadOrAll == UnreadOrAll.All), ) // TODO hide local for non-federated instances IconAndTextDrawerItem( - text = "Unread", + text = stringResource(R.string.dialogs_unread), icon = Icons.Outlined.MarkunreadMailbox, onClick = { onClickUnreadOrAll(UnreadOrAll.Unread) }, highlight = (selectedUnreadOrAll == UnreadOrAll.Unread), @@ -279,7 +281,11 @@ fun ShowChangelog(appSettingsViewModel: AppSettingsViewModel) { AlertDialog( text = { - Column(modifier = Modifier.fillMaxSize().verticalScroll(scrollState)) { + Column( + modifier = Modifier + .fillMaxSize() + .verticalScroll(scrollState), + ) { MyMarkdownText( markdown = DONATION_MARKDOWN + markdown.value, onClick = {}, @@ -294,7 +300,7 @@ fun ShowChangelog(appSettingsViewModel: AppSettingsViewModel) { }, modifier = Modifier.fillMaxWidth(), ) { - Text("Done") + Text(stringResource(R.string.dialogs_done)) } }, onDismissRequest = { diff --git a/app/src/main/java/com/jerboa/ui/components/common/InputFields.kt b/app/src/main/java/com/jerboa/ui/components/common/InputFields.kt index 741dee503..d0a0063a7 100644 --- a/app/src/main/java/com/jerboa/ui/components/common/InputFields.kt +++ b/app/src/main/java/com/jerboa/ui/components/common/InputFields.kt @@ -59,6 +59,7 @@ import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.TextRange import androidx.compose.ui.text.input.KeyboardCapitalization import androidx.compose.ui.text.input.KeyboardType @@ -66,6 +67,7 @@ import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.text.input.getSelectedText import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview +import com.jerboa.R import com.jerboa.api.uploadPictrsImage import com.jerboa.appendMarkdownImage import com.jerboa.db.Account @@ -254,7 +256,7 @@ fun CreateLinkDialog( verticalArrangement = Arrangement.spacedBy(MEDIUM_PADDING), ) { Text( - text = "Insert link", + text = stringResource(R.string.input_fields_insert_link), style = MaterialTheme.typography.titleLarge, color = MaterialTheme.colorScheme.onSurface, ) @@ -262,7 +264,7 @@ fun CreateLinkDialog( value = text, onValueChange = { text = it }, label = { - Text(text = "Text") + Text(text = stringResource(R.string.input_fields_text)) }, modifier = Modifier.fillMaxWidth(), ) @@ -270,7 +272,7 @@ fun CreateLinkDialog( value = link, onValueChange = { link = it }, label = { - Text(text = "Link") + Text(text = stringResource(R.string.input_fields_link)) }, modifier = Modifier.fillMaxWidth(), ) @@ -281,7 +283,7 @@ fun CreateLinkDialog( onClick = onDismissRequest, ) { Text( - text = "Cancel", + text = stringResource(R.string.input_fields_cancel), color = MaterialTheme.colorScheme.onBackground.muted, ) } @@ -301,7 +303,7 @@ fun CreateLinkDialog( }, ) { Text( - text = "OK", + text = stringResource(R.string.input_fields_ok), ) } }, @@ -330,7 +332,7 @@ fun ShowPreviewDialog( onClick = onDismissRequest, ) { Text( - text = "OK", + text = stringResource(R.string.input_fields_ok), color = MaterialTheme.colorScheme.onBackground.muted, ) } diff --git a/app/src/main/java/com/jerboa/ui/components/common/PictrsImage.kt b/app/src/main/java/com/jerboa/ui/components/common/PictrsImage.kt index 88ac3adcf..51bd00d25 100644 --- a/app/src/main/java/com/jerboa/ui/components/common/PictrsImage.kt +++ b/app/src/main/java/com/jerboa/ui/components/common/PictrsImage.kt @@ -28,6 +28,7 @@ import androidx.compose.ui.graphics.asImageBitmap import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp @@ -195,7 +196,7 @@ fun PickImage( launcher.launch("image/*") }) { Text( - text = "Upload Image", + text = stringResource(R.string.pictrs_image_upload_image), color = MaterialTheme.colorScheme.onBackground.muted, ) } diff --git a/app/src/main/java/com/jerboa/ui/components/common/TimeAgo.kt b/app/src/main/java/com/jerboa/ui/components/common/TimeAgo.kt index ecd7676c9..238ba5d1a 100644 --- a/app/src/main/java/com/jerboa/ui/components/common/TimeAgo.kt +++ b/app/src/main/java/com/jerboa/ui/components/common/TimeAgo.kt @@ -18,9 +18,11 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import com.jerboa.R import com.jerboa.datatypes.samplePersonSafe import com.jerboa.datatypes.samplePost import com.jerboa.prettyTime @@ -40,7 +42,7 @@ fun TimeAgo( val publishedPretty = dateStringToPretty(published, includeAgo) val afterPreceding = precedingString?.let { - "$it $publishedPretty ago" + stringResource(R.string.time_ago_ago, it, publishedPretty) } ?: run { publishedPretty } Row { diff --git a/app/src/main/java/com/jerboa/ui/components/community/Community.kt b/app/src/main/java/com/jerboa/ui/components/community/Community.kt index b23f4ea36..63147a67a 100644 --- a/app/src/main/java/com/jerboa/ui/components/community/Community.kt +++ b/app/src/main/java/com/jerboa/ui/components/community/Community.kt @@ -9,9 +9,11 @@ import androidx.compose.material3.* import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.navigation.NavController import androidx.navigation.compose.rememberNavController +import com.jerboa.R import com.jerboa.datatypes.CommunityView import com.jerboa.datatypes.SortType import com.jerboa.datatypes.SubscribedType @@ -63,7 +65,10 @@ fun CommunityTopSection( } Row { Text( - text = "${communityView.counts.users_active_month} users / month", + text = stringResource( + R.string.community_users_month, + communityView.counts.users_active_month, + ), style = MaterialTheme.typography.bodyLarge, color = MaterialTheme.colorScheme.onBackground.muted, ) @@ -74,7 +79,7 @@ fun CommunityTopSection( OutlinedButton( onClick = { onClickFollowCommunity(communityView) }, ) { - Text("Joined") + Text(stringResource(R.string.community_joined)) Spacer(Modifier.size(ButtonDefaults.IconSpacing)) Icon( imageVector = Icons.Outlined.CheckCircle, @@ -88,7 +93,7 @@ fun CommunityTopSection( Button( onClick = { onClickFollowCommunity(communityView) }, ) { - Text("Subscribe") + Text(stringResource(R.string.community_subscribe)) } } @@ -96,7 +101,7 @@ fun CommunityTopSection( Button( onClick = { onClickFollowCommunity(communityView) }, ) { - Text("Pending") + Text(stringResource(R.string.community_pending)) } } } @@ -178,7 +183,7 @@ fun CommunityHeader( IconButton(onClick = { navController.popBackStack() }) { Icon( Icons.Outlined.ArrowBack, - contentDescription = "Back", + contentDescription = stringResource(R.string.community_back), ) } }, @@ -232,7 +237,7 @@ fun CommunityMoreDialog( text = { Column { IconAndTextDrawerItem( - text = "Refresh", + text = stringResource(R.string.community_refresh), icon = Icons.Outlined.Refresh, onClick = { onDismissRequest() @@ -240,7 +245,7 @@ fun CommunityMoreDialog( }, ) IconAndTextDrawerItem( - text = "Community Info", + text = stringResource(R.string.community_community_info), icon = Icons.Outlined.Info, onClick = { navController.navigate("communitySidebar") @@ -248,7 +253,7 @@ fun CommunityMoreDialog( }, ) IconAndTextDrawerItem( - text = "Block Community", + text = stringResource(R.string.community_block_community), icon = Icons.Outlined.Block, onClick = onBlockCommunityClick, ) diff --git a/app/src/main/java/com/jerboa/ui/components/community/CommunityLink.kt b/app/src/main/java/com/jerboa/ui/components/community/CommunityLink.kt index 20968faca..56bf9c872 100644 --- a/app/src/main/java/com/jerboa/ui/components/community/CommunityLink.kt +++ b/app/src/main/java/com/jerboa/ui/components/community/CommunityLink.kt @@ -12,10 +12,12 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.Dp +import com.jerboa.R import com.jerboa.communityNameShown import com.jerboa.datatypes.CommunitySafe import com.jerboa.datatypes.CommunityView @@ -81,7 +83,7 @@ fun CommunityLink( CommunityName(community = community, color = color, style = style) usersPerMonth?.also { Text( - text = "$usersPerMonth users / month", + text = stringResource(R.string.community_link_users_month, usersPerMonth), color = MaterialTheme.colorScheme.onSurface, ) } diff --git a/app/src/main/java/com/jerboa/ui/components/community/CommunityRoutines.kt b/app/src/main/java/com/jerboa/ui/components/community/CommunityRoutines.kt index a97e29eba..cf89db9dc 100644 --- a/app/src/main/java/com/jerboa/ui/components/community/CommunityRoutines.kt +++ b/app/src/main/java/com/jerboa/ui/components/community/CommunityRoutines.kt @@ -2,6 +2,7 @@ package com.jerboa.ui.components.community import android.content.Context import android.widget.Toast +import com.jerboa.R import com.jerboa.api.blockCommunityWrapper import com.jerboa.datatypes.CommunitySafe import com.jerboa.datatypes.api.BlockCommunity @@ -19,6 +20,10 @@ fun blockCommunityRoutine( scope.launch { val form = BlockCommunity(community.id, block, account.jwt) blockCommunityWrapper(form, ctx) - Toast.makeText(ctx, "${community.name} Blocked", Toast.LENGTH_SHORT).show() + Toast.makeText( + ctx, + ctx.getString(R.string.community_blocked, community.name), + Toast.LENGTH_SHORT, + ).show() } } diff --git a/app/src/main/java/com/jerboa/ui/components/community/list/CommunityList.kt b/app/src/main/java/com/jerboa/ui/components/community/list/CommunityList.kt index 5dbe41325..9e1993eb9 100644 --- a/app/src/main/java/com/jerboa/ui/components/community/list/CommunityList.kt +++ b/app/src/main/java/com/jerboa/ui/components/community/list/CommunityList.kt @@ -20,10 +20,12 @@ import androidx.compose.material3.TopAppBar import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.tooling.preview.Preview import androidx.navigation.NavController import androidx.navigation.compose.rememberNavController +import com.jerboa.R import com.jerboa.datatypes.CommunityFollowerView import com.jerboa.datatypes.CommunitySafe import com.jerboa.datatypes.CommunityView @@ -152,7 +154,7 @@ fun CommunityTopBarSearchView( onValueChange = onSearchChange, textStyle = MaterialTheme.typography.bodyLarge, placeholder = { - Text("Search...") + Text(stringResource(R.string.community_list_search)) }, modifier = Modifier .fillMaxWidth(), diff --git a/app/src/main/java/com/jerboa/ui/components/home/Home.kt b/app/src/main/java/com/jerboa/ui/components/home/Home.kt index 8d01232dd..aea248601 100644 --- a/app/src/main/java/com/jerboa/ui/components/home/Home.kt +++ b/app/src/main/java/com/jerboa/ui/components/home/Home.kt @@ -58,10 +58,12 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.navigation.NavController import androidx.navigation.compose.rememberNavController import com.jerboa.PostViewMode +import com.jerboa.R import com.jerboa.datatypes.CommunitySafe import com.jerboa.datatypes.ListingType import com.jerboa.datatypes.PersonSafe @@ -199,7 +201,7 @@ fun DrawerItemsMain( if (!follows.isNullOrEmpty()) { item { IconAndTextDrawerItem( - text = "Subscribed", + text = stringResource(R.string.home_subscribed), icon = Icons.Outlined.Bookmarks, onClick = { onClickListingType(ListingType.Subscribed) }, ) @@ -207,14 +209,14 @@ fun DrawerItemsMain( } item { IconAndTextDrawerItem( - text = "Local", + text = stringResource(R.string.home_local), icon = Icons.Outlined.LocationCity, onClick = { onClickListingType(ListingType.Local) }, ) } item { IconAndTextDrawerItem( - text = "All", + text = stringResource(R.string.home_all), icon = Icons.Outlined.Public, onClick = { onClickListingType(ListingType.All) }, ) @@ -222,7 +224,7 @@ fun DrawerItemsMain( item { myUserInfo?.also { IconAndTextDrawerItem( - text = "Saved", + text = stringResource(R.string.home_saved), icon = Icons.Outlined.Bookmarks, onClick = onClickSaved, ) @@ -234,7 +236,7 @@ fun DrawerItemsMain( item { myUserInfo?.also { IconAndTextDrawerItem( - text = "Profile", + text = stringResource(R.string.home_profile), icon = Icons.Outlined.Person, onClick = onClickProfile, ) @@ -243,7 +245,7 @@ fun DrawerItemsMain( item { myUserInfo?.also { IconAndTextDrawerItem( - text = "Inbox", + text = stringResource(R.string.home_inbox), icon = Icons.Outlined.Email, onClick = onClickInbox, iconBadgeCount = totalUnreads, @@ -252,7 +254,7 @@ fun DrawerItemsMain( } item { IconAndTextDrawerItem( - text = "Settings", + text = stringResource(R.string.home_settings), icon = Icons.Outlined.Settings, onClick = onClickSettings, ) @@ -266,7 +268,7 @@ fun DrawerItemsMain( follows?.also { follows -> item { Text( - text = "Subscriptions", + text = stringResource(R.string.home_subscriptions), modifier = Modifier.padding(LARGE_PADDING), color = MaterialTheme.colorScheme.onBackground.muted, ) @@ -311,20 +313,20 @@ fun DrawerAddAccountMode( Column { IconAndTextDrawerItem( - text = "Add Account", + text = stringResource(R.string.home_add_account), icon = Icons.Outlined.Add, onClick = { navController.navigate(route = "login") }, ) accountsWithoutCurrent?.forEach { IconAndTextDrawerItem( - text = "Switch to ${it.instance}/${it.name}", + text = stringResource(R.string.home_switch_to, it.instance, it.name), icon = Icons.Outlined.Login, onClick = { onSwitchAccountClick(it) }, ) } currentAccount?.also { IconAndTextDrawerItem( - text = "Sign Out", + text = stringResource(R.string.home_sign_out), icon = Icons.Outlined.Close, onClick = onSignOutClick, ) @@ -518,7 +520,7 @@ fun HomeHeader( }) { Icon( Icons.Outlined.Menu, - contentDescription = "Menu", + contentDescription = stringResource(R.string.home_menu), ) } }, @@ -584,7 +586,7 @@ fun HomeMoreDialog( text = { Column { IconAndTextDrawerItem( - text = "Refresh", + text = stringResource(R.string.home_refresh), icon = Icons.Outlined.Refresh, onClick = { onDismissRequest() @@ -592,7 +594,7 @@ fun HomeMoreDialog( }, ) IconAndTextDrawerItem( - text = "Post View Mode", + text = stringResource(R.string.home_post_view_mode), icon = Icons.Outlined.ViewAgenda, onClick = { onDismissRequest() @@ -600,7 +602,7 @@ fun HomeMoreDialog( }, ) IconAndTextDrawerItem( - text = "Site Info", + text = stringResource(R.string.home_site_info), icon = Icons.Outlined.Info, onClick = { navController.navigate("siteSidebar") diff --git a/app/src/main/java/com/jerboa/ui/components/inbox/Inbox.kt b/app/src/main/java/com/jerboa/ui/components/inbox/Inbox.kt index b960dfdb8..0d5226fc7 100644 --- a/app/src/main/java/com/jerboa/ui/components/inbox/Inbox.kt +++ b/app/src/main/java/com/jerboa/ui/components/inbox/Inbox.kt @@ -19,8 +19,10 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue +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.ui.components.common.UnreadOrAllOptionsDialog @@ -58,7 +60,7 @@ fun InboxHeader( IconButton(onClick = { navController.popBackStack() }) { Icon( Icons.Outlined.ArrowBack, - contentDescription = "Back", + contentDescription = stringResource(R.string.inbox_back), ) } }, @@ -83,7 +85,7 @@ fun InboxHeader( @Composable fun InboxHeaderTitle(selectedUnreadOrAll: UnreadOrAll, unreadCount: Int? = null) { - var title = "Inbox" + var title = stringResource(R.string.inbox_inbox) if (unreadCount != null && unreadCount > 0) { title = "$title ($unreadCount)" } diff --git a/app/src/main/java/com/jerboa/ui/components/login/Login.kt b/app/src/main/java/com/jerboa/ui/components/login/Login.kt index 95d31134c..671eeaf68 100644 --- a/app/src/main/java/com/jerboa/ui/components/login/Login.kt +++ b/app/src/main/java/com/jerboa/ui/components/login/Login.kt @@ -22,6 +22,7 @@ import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.autofill.AutofillType import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.KeyboardCapitalization import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.PasswordVisualTransformation @@ -31,6 +32,7 @@ import androidx.compose.ui.unit.dp import androidx.navigation.NavController import androidx.navigation.compose.rememberNavController import com.jerboa.DEFAULT_LEMMY_INSTANCES +import com.jerboa.R import com.jerboa.datatypes.api.Login import com.jerboa.db.Account import com.jerboa.onAutofill @@ -73,7 +75,7 @@ fun PasswordField( value = password, onValueChange = onValueChange, singleLine = true, - label = { Text(text = "Password") }, + label = { Text(text = stringResource(R.string.login_password)) }, visualTransformation = if (passwordVisibility) VisualTransformation.None else PasswordVisualTransformation(), keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password), trailingIcon = { @@ -130,8 +132,8 @@ fun LoginForm( ) { OutlinedTextField( modifier = Modifier.menuAnchor(), - label = { Text("Instance") }, - placeholder = { Text("ex: lemmy.ml") }, + label = { Text(stringResource(R.string.login_instance)) }, + placeholder = { Text(stringResource(R.string.login_instance_placeholder)) }, value = instance, onValueChange = { instance = it }, trailingIcon = { @@ -168,7 +170,7 @@ fun LoginForm( username = it wasAutofilled = true }, - label = "Email or Username", + label = stringResource(R.string.login_email_or_username), text = username, onValueChange = { username = it }, ) @@ -190,7 +192,7 @@ fun LoginForm( if (loading) { CircularProgressIndicator() } else { - Text("Login") + Text(stringResource(R.string.login_login)) } } } @@ -210,7 +212,7 @@ fun LoginHeader( TopAppBar( title = { Text( - text = "Login", + text = stringResource(R.string.login_login), ) }, navigationIcon = { @@ -222,7 +224,7 @@ fun LoginHeader( ) { Icon( Icons.Outlined.ArrowBack, - contentDescription = "Back", + contentDescription = stringResource(R.string.login_back), ) } }, diff --git a/app/src/main/java/com/jerboa/ui/components/login/LoginViewModel.kt b/app/src/main/java/com/jerboa/ui/components/login/LoginViewModel.kt index f2a2b1a58..945c3511d 100644 --- a/app/src/main/java/com/jerboa/ui/components/login/LoginViewModel.kt +++ b/app/src/main/java/com/jerboa/ui/components/login/LoginViewModel.kt @@ -9,6 +9,7 @@ import androidx.compose.runtime.setValue import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import androidx.navigation.NavController +import com.jerboa.R import com.jerboa.api.API import com.jerboa.api.fetchPostsWrapper import com.jerboa.api.getSiteWrapper @@ -49,7 +50,10 @@ class LoginViewModel : ViewModel() { // to be checked, } catch (e: java.net.UnknownHostException) { loading = false - val msg = "$instance is not a Lemmy Instance" + val msg = ctx.getString( + R.string.login_view_model_is_not_a_lemmy_instance, + instance, + ) Log.e("login", e.toString()) Toast.makeText( ctx, @@ -61,7 +65,7 @@ class LoginViewModel : ViewModel() { } } catch (e: Exception) { loading = false - val msg = "Incorrect Login" + val msg = ctx.getString(R.string.login_view_model_incorrect_login) Log.e("login", e.toString()) Toast.makeText( ctx, diff --git a/app/src/main/java/com/jerboa/ui/components/person/PersonProfile.kt b/app/src/main/java/com/jerboa/ui/components/person/PersonProfile.kt index f3a4174e0..01e145e92 100644 --- a/app/src/main/java/com/jerboa/ui/components/person/PersonProfile.kt +++ b/app/src/main/java/com/jerboa/ui/components/person/PersonProfile.kt @@ -27,9 +27,11 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.navigation.NavController import androidx.navigation.compose.rememberNavController +import com.jerboa.R import com.jerboa.datatypes.PersonViewSafe import com.jerboa.datatypes.SortType import com.jerboa.datatypes.samplePersonView @@ -97,7 +99,7 @@ fun PersonProfileTopSection( ) TimeAgo( - precedingString = "Joined", + precedingString = stringResource(R.string.person_profile_joined), includeAgo = true, published = personView.person.published, ) @@ -117,12 +119,12 @@ fun PersonProfileTopSection( fun CommentsAndPosts(personView: PersonViewSafe) { Row { Text( - text = "${personView.counts.post_count} posts", + text = stringResource(R.string.person_profile_posts, personView.counts.post_count), color = MaterialTheme.colorScheme.onBackground.muted, ) DotSpacer(style = MaterialTheme.typography.bodyMedium) Text( - text = "${personView.counts.comment_count} comments", + text = stringResource(R.string.person_profile_comments, personView.counts.comment_count), color = MaterialTheme.colorScheme.onBackground.muted, ) } @@ -207,7 +209,7 @@ fun PersonProfileHeader( IconButton(onClick = { navController.popBackStack() }) { Icon( Icons.Outlined.ArrowBack, - contentDescription = "Back", + contentDescription = stringResource(R.string.person_profile_back), ) } }, @@ -262,12 +264,12 @@ fun PersonProfileMoreDialog( text = { Column { IconAndTextDrawerItem( - text = "Block Person", + text = stringResource(R.string.person_profile_block_person), icon = Icons.Outlined.Block, onClick = onBlockPersonClick, ) IconAndTextDrawerItem( - text = "Report Person", + text = stringResource(R.string.person_profile_report_person), icon = Icons.Outlined.Flag, onClick = onReportPersonClick, ) diff --git a/app/src/main/java/com/jerboa/ui/components/person/PersonProfileActivity.kt b/app/src/main/java/com/jerboa/ui/components/person/PersonProfileActivity.kt index 30c23d50d..1559e06e6 100644 --- a/app/src/main/java/com/jerboa/ui/components/person/PersonProfileActivity.kt +++ b/app/src/main/java/com/jerboa/ui/components/person/PersonProfileActivity.kt @@ -15,6 +15,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource import androidx.navigation.NavController import arrow.core.Either import com.google.accompanist.pager.ExperimentalPagerApi @@ -22,6 +23,7 @@ import com.google.accompanist.pager.HorizontalPager import com.google.accompanist.pager.rememberPagerState import com.google.accompanist.swiperefresh.SwipeRefresh import com.google.accompanist.swiperefresh.rememberSwipeRefreshState +import com.jerboa.R import com.jerboa.VoteType import com.jerboa.commentsToFlatNodes import com.jerboa.db.Account @@ -247,7 +249,8 @@ fun UserTabs( LazyColumn( state = listState, - modifier = Modifier.fillMaxSize() + modifier = Modifier + .fillMaxSize() .simpleVerticalScrollbar(listState), ) { item { @@ -261,7 +264,7 @@ fun UserTabs( if (moderates.isNotEmpty()) { item { Text( - text = "Moderates", + text = stringResource(R.string.person_profile_activity_moderates), style = MaterialTheme.typography.bodyLarge, modifier = Modifier.padding(MEDIUM_PADDING), ) diff --git a/app/src/main/java/com/jerboa/ui/components/person/PersonRoutines.kt b/app/src/main/java/com/jerboa/ui/components/person/PersonRoutines.kt index b9b2273e0..dd2503add 100644 --- a/app/src/main/java/com/jerboa/ui/components/person/PersonRoutines.kt +++ b/app/src/main/java/com/jerboa/ui/components/person/PersonRoutines.kt @@ -4,6 +4,7 @@ import android.content.Context import android.util.Log import android.widget.Toast import androidx.compose.runtime.MutableState +import com.jerboa.R import com.jerboa.api.API import com.jerboa.api.blockPersonWrapper import com.jerboa.api.markPrivateMessageAsReadWrapper @@ -121,6 +122,10 @@ fun blockPersonRoutine( scope.launch { val form = BlockPerson(person.id, block, account.jwt) blockPersonWrapper(form, ctx) - Toast.makeText(ctx, "${person.name} Blocked", Toast.LENGTH_SHORT).show() + Toast.makeText( + ctx, + ctx.getString(R.string.person_routines_blocked, person.name), + Toast.LENGTH_SHORT, + ).show() } } diff --git a/app/src/main/java/com/jerboa/ui/components/post/PostActivity.kt b/app/src/main/java/com/jerboa/ui/components/post/PostActivity.kt index 1780f7009..f0ccdbc7c 100644 --- a/app/src/main/java/com/jerboa/ui/components/post/PostActivity.kt +++ b/app/src/main/java/com/jerboa/ui/components/post/PostActivity.kt @@ -21,11 +21,13 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource import androidx.navigation.NavController import arrow.core.Either import com.google.accompanist.swiperefresh.SwipeRefresh import com.google.accompanist.swiperefresh.rememberSwipeRefreshState import com.jerboa.PostViewMode +import com.jerboa.R import com.jerboa.VoteType import com.jerboa.db.AccountViewModel import com.jerboa.getCommentParentId @@ -80,7 +82,7 @@ fun PostActivity( topBar = { Column { SimpleTopAppBar( - "Comments", + stringResource(R.string.post_activity_comments), navController = navController, scrollBehavior = scrollBehavior, @@ -116,7 +118,8 @@ fun PostActivity( postViewModel.postView.value?.also { postView -> LazyColumn( state = listState, - modifier = Modifier.padding(padding) + modifier = Modifier + .padding(padding) .simpleVerticalScrollbar(listState), ) { item(key = "${postView.post.id}_listing") { diff --git a/app/src/main/java/com/jerboa/ui/components/post/PostListing.kt b/app/src/main/java/com/jerboa/ui/components/post/PostListing.kt index 30575e73c..17cd037b5 100644 --- a/app/src/main/java/com/jerboa/ui/components/post/PostListing.kt +++ b/app/src/main/java/com/jerboa/ui/components/post/PostListing.kt @@ -43,6 +43,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalClipboardManager import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.FontStyle @@ -55,6 +56,7 @@ import com.google.accompanist.flowlayout.FlowMainAxisAlignment import com.google.accompanist.flowlayout.FlowRow import com.jerboa.InstantScores import com.jerboa.PostViewMode +import com.jerboa.R import com.jerboa.VoteType import com.jerboa.calculateNewInstantScores import com.jerboa.communityNameShown @@ -553,7 +555,7 @@ fun CommentCount( ) { ActionBarButton( icon = Icons.Outlined.ChatBubbleOutline, - text = "$comments comments", + text = stringResource(R.string.post_listing_comments, comments), noClick = true, account = account, onClick = {}, // This is handled by the whole button click @@ -582,7 +584,7 @@ fun CommentNewCount( Spacer(Modifier.padding(horizontal = spacing)) Text( - text = "( $unread new )", + text = stringResource(R.string.post_listing_new, unread), style = style, color = MaterialTheme.colorScheme.onSurface.muted, ) @@ -945,7 +947,10 @@ fun PostListingList( ) DotSpacer(0.dp) Text( - text = "${postView.counts.comments} comments", + text = stringResource( + R.string.post_listing_comments_count, + postView.counts.comments, + ), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onBackground.muted, ) @@ -1172,7 +1177,10 @@ fun PostOptionsDialog( text = { Column { IconAndTextDrawerItem( - text = "Go to ${communityNameShown(postView.community)}", + text = stringResource( + R.string.post_listing_go_to, + communityNameShown(postView.community), + ), icon = Icons.Outlined.Forum, onClick = { onCommunityClick() @@ -1180,58 +1188,66 @@ fun PostOptionsDialog( ) postView.post.url?.also { IconAndTextDrawerItem( - text = "Copy link", + text = stringResource(R.string.post_listing_copy_link), icon = Icons.Outlined.Link, onClick = { localClipboardManager.setText(AnnotatedString(it)) - Toast.makeText(ctx, "Link Copied", Toast.LENGTH_SHORT).show() + Toast.makeText( + ctx, + ctx.getString(R.string.post_listing_link_copied), + Toast.LENGTH_SHORT, + ).show() onDismissRequest() }, ) } IconAndTextDrawerItem( - text = "Copy Permalink", + text = stringResource(R.string.post_listing_copy_permalink), icon = Icons.Outlined.Link, onClick = { val permalink = postView.post.ap_id localClipboardManager.setText(AnnotatedString(permalink)) - Toast.makeText(ctx, "Permalink Copied", Toast.LENGTH_SHORT).show() + Toast.makeText( + ctx, + ctx.getString(R.string.post_listing_permalink_copied), + Toast.LENGTH_SHORT, + ).show() onDismissRequest() }, ) if (!isCreator) { IconAndTextDrawerItem( - text = "Report Post", + text = stringResource(R.string.post_listing_report_post), icon = Icons.Outlined.Flag, onClick = onReportClick, ) IconAndTextDrawerItem( - text = "Block ${postView.creator.name}", + text = stringResource(R.string.post_listing_block, postView.creator.name), icon = Icons.Outlined.Block, onClick = onBlockCreatorClick, ) IconAndTextDrawerItem( - text = "Block ${postView.community.name}", + text = stringResource(R.string.post_listing_block, postView.community.name), icon = Icons.Outlined.Block, onClick = onBlockCommunityClick, ) } if (isCreator) { IconAndTextDrawerItem( - text = "Edit", + text = stringResource(R.string.post_listing_edit), icon = Icons.Outlined.Edit, onClick = onEditPostClick, ) val deleted = postView.post.deleted if (deleted) { IconAndTextDrawerItem( - text = "Restore", + text = stringResource(R.string.post_listing_restore), icon = Icons.Outlined.Restore, onClick = onDeletePostClick, ) } else { IconAndTextDrawerItem( - text = "Delete", + text = stringResource(R.string.post_listing_delete), icon = Icons.Outlined.Delete, onClick = onDeletePostClick, ) diff --git a/app/src/main/java/com/jerboa/ui/components/post/create/CreatePost.kt b/app/src/main/java/com/jerboa/ui/components/post/create/CreatePost.kt index 053e05fdc..bf4826ca1 100644 --- a/app/src/main/java/com/jerboa/ui/components/post/create/CreatePost.kt +++ b/app/src/main/java/com/jerboa/ui/components/post/create/CreatePost.kt @@ -30,12 +30,14 @@ import androidx.compose.material3.TopAppBar import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.navigation.NavController import androidx.navigation.compose.rememberNavController +import com.jerboa.R import com.jerboa.datatypes.CommunitySafe import com.jerboa.datatypes.sampleCommunitySafe import com.jerboa.db.Account @@ -59,7 +61,7 @@ fun CreatePostHeader( TopAppBar( title = { Text( - text = "Create post", + text = stringResource(R.string.create_post_create_post), ) }, actions = { @@ -89,7 +91,7 @@ fun CreatePostHeader( // Todo add are you sure cancel dialog Icon( Icons.Outlined.Close, - contentDescription = "Close", + contentDescription = stringResource(R.string.create_post_close), ) } }, @@ -155,7 +157,7 @@ fun CreatePostBody( ) suggestedTitle?.also { Text( - text = "copy suggested title: $it", + text = stringResource(R.string.create_post_copy_suggested_title, it), style = MaterialTheme.typography.bodyLarge, color = MaterialTheme.colorScheme.onBackground.muted, modifier = Modifier.clickable { onNameChange(it) }, @@ -183,7 +185,7 @@ fun CreatePostBody( readOnly = true, onValueChange = {}, // TODO what? label = { - Text("Community") + Text(stringResource(R.string.create_post_community)) }, leadingIcon = { community.icon?.let { @@ -208,7 +210,7 @@ fun CreatePostBody( value = "", onValueChange = {}, // TODO what? label = { - Text("Community") + Text(stringResource(R.string.create_post_community)) }, modifier = Modifier .fillMaxWidth(), @@ -257,7 +259,7 @@ fun CreatePostBodyPreviewNoCommunity() { onUrlChange = {}, onPickedImage = {}, formValid = {}, - suggestedTitle = "a title here....", + suggestedTitle = stringResource(R.string.create_post_a_title_here), account = null, padding = PaddingValues(), ) diff --git a/app/src/main/java/com/jerboa/ui/components/post/edit/PostEdit.kt b/app/src/main/java/com/jerboa/ui/components/post/edit/PostEdit.kt index b2a4ef08e..30019a334 100644 --- a/app/src/main/java/com/jerboa/ui/components/post/edit/PostEdit.kt +++ b/app/src/main/java/com/jerboa/ui/components/post/edit/PostEdit.kt @@ -17,11 +17,13 @@ import androidx.compose.material.icons.outlined.Save import androidx.compose.material3.* import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.tooling.preview.Preview import androidx.navigation.NavController import androidx.navigation.compose.rememberNavController +import com.jerboa.R import com.jerboa.db.Account import com.jerboa.ui.components.common.MarkdownTextField import com.jerboa.ui.components.common.PickImage @@ -39,7 +41,7 @@ fun EditPostHeader( TopAppBar( title = { Text( - text = "Edit Post", + text = stringResource(R.string.post_edit_edit_post), ) }, actions = { @@ -69,7 +71,7 @@ fun EditPostHeader( // Todo add are you sure cancel dialog Icon( Icons.Outlined.Close, - contentDescription = "Close", + contentDescription = stringResource(R.string.post_edit_close), ) } }, @@ -139,7 +141,7 @@ fun EditPostBody( outlined = true, account = account, focusImmediate = false, - placeholder = "Body", + placeholder = stringResource(R.string.post_edit_body_placeholder), ) } } diff --git a/app/src/main/java/com/jerboa/ui/components/privatemessage/PrivateMessage.kt b/app/src/main/java/com/jerboa/ui/components/privatemessage/PrivateMessage.kt index 17455cdb9..a4a36747b 100644 --- a/app/src/main/java/com/jerboa/ui/components/privatemessage/PrivateMessage.kt +++ b/app/src/main/java/com/jerboa/ui/components/privatemessage/PrivateMessage.kt @@ -14,7 +14,9 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview +import com.jerboa.R import com.jerboa.datatypes.PersonSafe import com.jerboa.datatypes.PrivateMessageView import com.jerboa.datatypes.samplePrivateMessageView @@ -39,10 +41,10 @@ fun PrivateMessageHeader( if (isCreator(myPersonId, privateMessageView)) { otherPerson = privateMessageView.recipient - fromOrTo = "to " + fromOrTo = stringResource(R.string.private_message_to) } else { otherPerson = privateMessageView.creator - fromOrTo = "from " + fromOrTo = stringResource(R.string.private_message_from) } Row( diff --git a/app/src/main/java/com/jerboa/ui/components/privatemessage/PrivateMessageReply.kt b/app/src/main/java/com/jerboa/ui/components/privatemessage/PrivateMessageReply.kt index a651d95d7..ddaff0fc9 100644 --- a/app/src/main/java/com/jerboa/ui/components/privatemessage/PrivateMessageReply.kt +++ b/app/src/main/java/com/jerboa/ui/components/privatemessage/PrivateMessageReply.kt @@ -13,10 +13,12 @@ import androidx.compose.material.icons.outlined.* import androidx.compose.material3.* import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.tooling.preview.Preview import androidx.navigation.NavController import androidx.navigation.compose.rememberNavController +import com.jerboa.R import com.jerboa.datatypes.PrivateMessageView import com.jerboa.datatypes.samplePrivateMessageView import com.jerboa.db.Account @@ -33,7 +35,7 @@ fun PrivateMessageReplyHeader( TopAppBar( title = { Text( - text = "Reply", + text = stringResource(R.string.private_message_reply_reply), ) }, actions = { @@ -61,7 +63,7 @@ fun PrivateMessageReplyHeader( ) { Icon( Icons.Outlined.Close, - contentDescription = "Back", + contentDescription = stringResource(R.string.private_message_reply_back), ) } }, @@ -118,7 +120,7 @@ fun PrivateMessageReply( onTextChange = onReplyChange, account = account, modifier = Modifier.fillMaxWidth(), - placeholder = "Type your message", + placeholder = stringResource(R.string.private_message_reply_type_your_message_placeholder), ) } } diff --git a/app/src/main/java/com/jerboa/ui/components/report/CreateReport.kt b/app/src/main/java/com/jerboa/ui/components/report/CreateReport.kt index 816dbe477..a48b7c1d1 100644 --- a/app/src/main/java/com/jerboa/ui/components/report/CreateReport.kt +++ b/app/src/main/java/com/jerboa/ui/components/report/CreateReport.kt @@ -14,9 +14,11 @@ import androidx.compose.material.icons.outlined.* import androidx.compose.material3.* import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.TextFieldValue import androidx.navigation.NavController import androidx.navigation.compose.rememberNavController +import com.jerboa.R import com.jerboa.db.Account import com.jerboa.ui.components.common.MarkdownTextField @@ -29,7 +31,7 @@ fun CreateReportHeader( TopAppBar( title = { Text( - text = "Report", + text = stringResource(R.string.create_report_report), ) }, actions = { @@ -57,7 +59,7 @@ fun CreateReportHeader( ) { Icon( Icons.Outlined.Close, - contentDescription = "Back", + contentDescription = stringResource(R.string.create_report_back), ) } }, @@ -74,7 +76,8 @@ fun CreateReportBody( val scrollState = rememberScrollState() Column( - modifier = Modifier.verticalScroll(scrollState) + modifier = Modifier + .verticalScroll(scrollState) .padding(padding) .imePadding(), ) { @@ -83,7 +86,7 @@ fun CreateReportBody( onTextChange = onReasonChange, account = account, modifier = Modifier.fillMaxWidth(), - placeholder = "Type your reason", + placeholder = stringResource(R.string.create_report_type_your_reason), ) } } diff --git a/app/src/main/java/com/jerboa/ui/components/report/CreateReportViewModel.kt b/app/src/main/java/com/jerboa/ui/components/report/CreateReportViewModel.kt index 9bbc77cd6..c42a9a95b 100644 --- a/app/src/main/java/com/jerboa/ui/components/report/CreateReportViewModel.kt +++ b/app/src/main/java/com/jerboa/ui/components/report/CreateReportViewModel.kt @@ -9,6 +9,7 @@ import androidx.compose.ui.focus.FocusManager import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import androidx.navigation.NavController +import com.jerboa.R import com.jerboa.api.createCommentReportWrapper import com.jerboa.api.createPostReportWrapper import com.jerboa.datatypes.api.CreateCommentReport @@ -57,7 +58,11 @@ class CreateReportViewModel : ViewModel() { loading.value = false if (report !== null) { - Toast.makeText(ctx, "Report Created", Toast.LENGTH_SHORT).show() + Toast.makeText( + ctx, + ctx.getString(R.string.create_report_view_model_report_created), + Toast.LENGTH_SHORT, + ).show() focusManager.clearFocus() navController.navigateUp() } @@ -84,7 +89,7 @@ class CreateReportViewModel : ViewModel() { loading.value = false if (report !== null) { - Toast.makeText(ctx, "Report Created", Toast.LENGTH_SHORT).show() + Toast.makeText(ctx, ctx.getString(R.string.create_report_view_model_report_created), Toast.LENGTH_SHORT).show() focusManager.clearFocus() navController.navigateUp() diff --git a/app/src/main/java/com/jerboa/ui/components/settings/SettingsActivity.kt b/app/src/main/java/com/jerboa/ui/components/settings/SettingsActivity.kt index ba3118d50..2a2570353 100644 --- a/app/src/main/java/com/jerboa/ui/components/settings/SettingsActivity.kt +++ b/app/src/main/java/com/jerboa/ui/components/settings/SettingsActivity.kt @@ -16,8 +16,10 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.navigation.NavController import com.alorma.compose.settings.ui.SettingsMenuLink +import com.jerboa.R import com.jerboa.db.AccountViewModel import com.jerboa.ui.components.common.SimpleTopAppBar import com.jerboa.ui.components.common.getCurrentAccount @@ -35,12 +37,12 @@ fun SettingsActivity( Scaffold( snackbarHost = { SnackbarHost(snackbarHostState) }, topBar = { - SimpleTopAppBar(text = "Settings", navController = navController) + SimpleTopAppBar(text = stringResource(R.string.settings_activity_settings), navController = navController) }, content = { padding -> Column(modifier = Modifier.padding(padding)) { SettingsMenuLink( - title = { Text("Look and feel") }, + title = { Text(stringResource(R.string.settings_activity_look_and_feel)) }, icon = { Icon( imageVector = Icons.Outlined.Palette, @@ -51,7 +53,14 @@ fun SettingsActivity( ) account?.also { acct -> SettingsMenuLink( - title = { Text("${acct.name} settings") }, + title = { + Text( + stringResource( + R.string.settings_activity_account_settings, + acct.name, + ), + ) + }, icon = { Icon( imageVector = Icons.Outlined.ManageAccounts, @@ -62,7 +71,7 @@ fun SettingsActivity( ) } SettingsMenuLink( - title = { Text("About") }, + title = { Text(stringResource(R.string.settings_activity_about)) }, icon = { Icon( imageVector = Icons.Outlined.Info, diff --git a/app/src/main/java/com/jerboa/ui/components/settings/about/AboutActivity.kt b/app/src/main/java/com/jerboa/ui/components/settings/about/AboutActivity.kt index 2e8afaba1..a9ae101f5 100644 --- a/app/src/main/java/com/jerboa/ui/components/settings/about/AboutActivity.kt +++ b/app/src/main/java/com/jerboa/ui/components/settings/about/AboutActivity.kt @@ -22,6 +22,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.navigation.NavController @@ -53,13 +54,13 @@ fun AboutActivity( Scaffold( snackbarHost = { SnackbarHost(snackbarHostState) }, topBar = { - SimpleTopAppBar(text = "About", navController = navController) + SimpleTopAppBar(text = stringResource(R.string.settings_about_about), navController = navController) }, content = { padding -> Column(modifier = Modifier.padding(padding)) { SettingsMenuLink( - title = { Text("What's New") }, - subtitle = { Text("Version $version") }, + title = { Text(stringResource(R.string.settings_about_what_s_new)) }, + subtitle = { Text(stringResource(R.string.settings_about_version, version)) }, icon = { Icon( imageVector = Icons.Outlined.NewReleases, @@ -71,9 +72,9 @@ fun AboutActivity( }, ) SettingsDivider() - SettingsHeader(text = "Support") + SettingsHeader(text = stringResource(R.string.settings_about_support)) SettingsMenuLink( - title = { Text("Issue tracker") }, + title = { Text(stringResource(R.string.settings_about_issue_tracker)) }, icon = { Icon( imageVector = Icons.Outlined.BugReport, @@ -85,7 +86,7 @@ fun AboutActivity( }, ) SettingsMenuLink( - title = { Text("Developer Matrix chatroom") }, + title = { Text(stringResource(R.string.settings_about_developer_matrix_chatroom)) }, icon = { Icon( imageVector = Icons.Outlined.Chat, @@ -97,7 +98,7 @@ fun AboutActivity( }, ) SettingsMenuLink( - title = { Text("Donate to Jerboa development") }, + title = { Text(stringResource(R.string.settings_about_donate_to_jerboa_development)) }, icon = { Icon( imageVector = Icons.Outlined.AttachMoney, @@ -109,9 +110,9 @@ fun AboutActivity( }, ) SettingsDivider() - SettingsHeader(text = "Social") + SettingsHeader(text = stringResource(R.string.about_social)) SettingsMenuLink( - title = { Text("Join c/jerboa") }, + title = { Text(stringResource(R.string.settings_about_join_c_jerboa)) }, icon = { Icon( painter = painterResource(id = R.drawable.ic_jerboa), @@ -124,7 +125,7 @@ fun AboutActivity( }, ) SettingsMenuLink( - title = { Text("Follow on Mastodon") }, + title = { Text(stringResource(R.string.settings_about_follow_on_mastodon)) }, icon = { Icon( imageVector = Icons.Outlined.TravelExplore, @@ -136,14 +137,14 @@ fun AboutActivity( }, ) SettingsDivider() - SettingsHeader(text = "Open source") + SettingsHeader(text = stringResource(R.string.settings_about_open_source)) SettingsMenuLink( modifier = Modifier.padding(top = 20.dp), - title = { Text("Source code") }, + title = { Text(stringResource(R.string.settings_about_source_code)) }, subtitle = { Text( - "Jerboa is libre open-source software, licensed under " + - "the GNU Affero General Public License v3.0", + stringResource(R.string.settings_about_source_code_subtitle_part1) + + stringResource(R.string.settings_about_source_code_subtitle_part2), ) }, icon = { diff --git a/app/src/main/java/com/jerboa/ui/components/settings/account/AccountSettings.kt b/app/src/main/java/com/jerboa/ui/components/settings/account/AccountSettings.kt index ca654cbfe..a6f2071d9 100644 --- a/app/src/main/java/com/jerboa/ui/components/settings/account/AccountSettings.kt +++ b/app/src/main/java/com/jerboa/ui/components/settings/account/AccountSettings.kt @@ -14,10 +14,12 @@ import androidx.compose.runtime.saveable.rememberSaveable 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.text.input.KeyboardCapitalization import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.tooling.preview.Preview +import com.jerboa.R import com.jerboa.api.uploadPictrsImage import com.jerboa.datatypes.api.SaveUserSettings import com.jerboa.db.Account @@ -60,7 +62,7 @@ fun ImageWithClose( Box(contentAlignment = Alignment.TopEnd) { composable() IconButton(onClick = onClick) { - Icon(imageVector = Icons.Outlined.Close, contentDescription = "Remove Current Avatar") + Icon(imageVector = Icons.Outlined.Close, contentDescription = stringResource(R.string.account_settings_remove_current_avatar)) } } } @@ -134,33 +136,35 @@ fun SettingsForm( verticalArrangement = Arrangement.spacedBy(SMALL_PADDING), ) { SettingsTextField( - label = "Display Name", + label = stringResource(R.string.account_settings_display_name), text = displayName, onValueChange = { displayName = it }, ) Column { - Text("Bio") + Text(stringResource(R.string.account_settings_bio)) MarkdownTextField( text = bio, onTextChange = { bio = it }, account = account, outlined = true, focusImmediate = false, - modifier = Modifier.fillMaxWidth().padding(SMALL_PADDING), + modifier = Modifier + .fillMaxWidth() + .padding(SMALL_PADDING), ) } SettingsTextField( - label = "Email", + label = stringResource(R.string.account_settings_email), text = email, onValueChange = { email = it }, ) SettingsTextField( - label = "Matrix User", + label = stringResource(R.string.account_settings_matrix_user), text = matrixUserId, onValueChange = { matrixUserId = it }, ) - Text(text = "Avatar") + Text(text = stringResource(R.string.account_settings_avatar)) if (avatar.isNotEmpty()) { ImageWithClose(onClick = { avatar = "" }) { LargerCircularIcon(icon = avatar) @@ -175,7 +179,7 @@ fun SettingsForm( } }, showImage = false) } - Text(text = "Banner") + Text(text = stringResource(R.string.account_settings_banner)) if (banner.isNotEmpty()) { ImageWithClose(onClick = { banner = "" }) { PictrsBannerImage(url = banner) @@ -191,68 +195,72 @@ fun SettingsForm( }, showImage = false) } MyDropDown( - suggestions = listOf("All", "Local", "Subscribed"), + suggestions = listOf( + stringResource(R.string.account_settings_all), + stringResource(R.string.account_settings_local), + stringResource(R.string.account_settings_subscribed), + ), onValueChange = { defaultListingType = it }, defaultListingType ?: 0, - label = "Default Listing Type", + label = stringResource(R.string.account_settings_default_listing_type), ) MyDropDown( suggestions = listOf( - "Active", - "Hot", - "New", - "TopDay", - "TopWeek", - "TopMonth", - "TopYear", - "TopAll", - "MostComments", - "NewComments", + stringResource(R.string.account_settings_active), + stringResource(R.string.account_settings_hot), + stringResource(R.string.account_settings_new), + stringResource(R.string.account_settings_topday), + stringResource(R.string.account_settings_topweek), + stringResource(R.string.account_settings_topmonth), + stringResource(R.string.account_settings_topyear), + stringResource(R.string.account_settings_topall), + stringResource(R.string.account_settings_mostcomments), + stringResource(R.string.account_settings_newcomments), ), onValueChange = { defaultSortType = it }, - defaultSortType ?: 0, - label = "Default Sort Type", + initialValue = defaultSortType ?: 0, + label = stringResource(R.string.account_settings_default_sort_type), ) MyCheckBox( checked = showNsfw, - label = "Show NSFW", + label = stringResource(R.string.account_settings_show_nsfw), onCheckedChange = { showNsfw = it }, ) MyCheckBox( checked = showAvatars == true, - label = "Show Avatars", + label = stringResource(R.string.account_settings_show_avatars), onCheckedChange = { showAvatars = it }, ) MyCheckBox( checked = showReadPosts == true, - label = "Show Read Posts", + label = stringResource(R.string.account_settings_show_read_posts), onCheckedChange = { showReadPosts = it }, ) MyCheckBox( checked = botAccount == true, - label = "Bot Account", + label = stringResource(R.string.account_settings_bot_account), onCheckedChange = { botAccount = it }, ) MyCheckBox( checked = showBotAccount == true, - label = "Show Bot Accounts", + label = stringResource(R.string.account_settings_show_bot_accounts), onCheckedChange = { showBotAccount = it }, ) MyCheckBox( checked = showScores == true, - label = "Show Scores", + label = stringResource(R.string.account_settings_show_scores), onCheckedChange = { showScores = it }, ) MyCheckBox( checked = showNewPostNotifs == true, - label = "Show Notifications for New Posts", + label = stringResource(R.string.account_settings_show_notifications_for_new_posts), onCheckedChange = { showNewPostNotifs = it }, ) MyCheckBox( enabled = email.isNotEmpty(), checked = sendNotificationsToEmail == true, - label = "Send Notifications to Email", + label = stringResource(R.string.account_settings_send_notifications_to_email), onCheckedChange = { sendNotificationsToEmail = it }, ) // Todo: Remove this @@ -261,7 +269,7 @@ fun SettingsForm( onClick = { onClickSave(form) }, modifier = Modifier.fillMaxWidth(), ) { - Text(text = "Save Settings") + Text(text = stringResource(R.string.account_settings_save_settings)) } } } diff --git a/app/src/main/java/com/jerboa/ui/components/settings/account/AccountSettingsActivity.kt b/app/src/main/java/com/jerboa/ui/components/settings/account/AccountSettingsActivity.kt index 627fbc19b..0ef47db25 100644 --- a/app/src/main/java/com/jerboa/ui/components/settings/account/AccountSettingsActivity.kt +++ b/app/src/main/java/com/jerboa/ui/components/settings/account/AccountSettingsActivity.kt @@ -10,7 +10,9 @@ import androidx.compose.material3.SnackbarHostState import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource import androidx.navigation.NavController +import com.jerboa.R import com.jerboa.db.AccountViewModel import com.jerboa.ui.components.common.SimpleTopAppBar import com.jerboa.ui.components.common.getCurrentAccount @@ -32,7 +34,7 @@ fun AccountSettingsActivity( Scaffold( snackbarHost = { SnackbarHost(snackbarHostState) }, topBar = { - SimpleTopAppBar(text = "Account Settings", navController = navController) + SimpleTopAppBar(text = stringResource(R.string.account_settings_activity_account_settings), navController = navController) }, content = { padding -> account.also { diff --git a/app/src/main/java/com/jerboa/ui/components/settings/lookandfeel/LookAndFeelActivity.kt b/app/src/main/java/com/jerboa/ui/components/settings/lookandfeel/LookAndFeelActivity.kt index e3b2e79a7..a741149e5 100644 --- a/app/src/main/java/com/jerboa/ui/components/settings/lookandfeel/LookAndFeelActivity.kt +++ b/app/src/main/java/com/jerboa/ui/components/settings/lookandfeel/LookAndFeelActivity.kt @@ -14,6 +14,7 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.navigation.NavController import com.alorma.compose.settings.storage.base.rememberBooleanSettingState @@ -23,6 +24,7 @@ import com.alorma.compose.settings.ui.SettingsCheckbox import com.alorma.compose.settings.ui.SettingsList import com.alorma.compose.settings.ui.SettingsSlider import com.jerboa.PostViewMode +import com.jerboa.R import com.jerboa.ThemeColor import com.jerboa.ThemeMode import com.jerboa.db.AppSettings @@ -74,7 +76,7 @@ fun LookAndFeelActivity( Scaffold( snackbarHost = { SnackbarHost(snackbarHostState) }, topBar = { - SimpleTopAppBar(text = "Look and feel", navController = navController) + SimpleTopAppBar(text = stringResource(R.string.look_and_feel_look_and_feel), navController = navController) }, content = { padding -> Column(modifier = Modifier.padding(padding)) { @@ -89,7 +91,12 @@ fun LookAndFeelActivity( ) }, title = { - Text(text = "Font size: ${fontSizeState.value.toInt()}") + Text( + text = stringResource( + R.string.look_and_feel_font_size, + fontSizeState.value.toInt(), + ), + ) }, onValueChangeFinished = { updateAppSettings() }, ) @@ -103,7 +110,7 @@ fun LookAndFeelActivity( ) }, title = { - Text(text = "Theme") + Text(text = stringResource(R.string.look_and_feel_theme)) }, onItemSelected = { i, _ -> themeState.value = i @@ -120,7 +127,7 @@ fun LookAndFeelActivity( ) }, title = { - Text(text = "Theme color") + Text(text = stringResource(R.string.look_and_feel_theme_color)) }, onItemSelected = { i, _ -> themeColorState.value = i @@ -137,7 +144,7 @@ fun LookAndFeelActivity( ) }, title = { - Text(text = "Post View") + Text(text = stringResource(R.string.look_and_feel_post_view)) }, onItemSelected = { i, _ -> postViewModeState.value = i @@ -147,14 +154,14 @@ fun LookAndFeelActivity( SettingsCheckbox( state = showBottomNavState, title = { - Text(text = "Show navigation bar") + Text(text = stringResource(R.string.look_and_feel_show_navigation_bar)) }, onCheckedChange = { updateAppSettings() }, ) SettingsCheckbox( state = showCollapsedCommentContentState, title = { - Text(text = "Show content for collapsed comments") + Text(text = stringResource(R.string.look_and_feel_activity_show_content_for_collapsed_comments)) }, onCheckedChange = { updateAppSettings() }, ) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml new file mode 100644 index 000000000..54f1a3b05 --- /dev/null +++ b/app/src/main/res/values-de/strings.xml @@ -0,0 +1,198 @@ + + Jerboa für Lemmy + Zum Kommentar + Quelle anzeigen + Permalink kopieren + Kommentar melden + Bearbeiten + Wiederherstellen + Löschen + %1$s antworten + Post anzeigen + Kontext anzeigen + *Entfernt* + *Gelöscht* + Bearbeiten + Schreibe deinen Kommentar + Zurück + Quelle anzeigen + Permalink kopieren + Kommentar melden + "Blockiere %1$s " + Antworten + Zurück + Schreibe deinen Kommentar + Quelle anzeigen + Kommentar melden + "Blockiere %1$s " + Erstellt + %1$s Nutzer / Tag + %1$s Nutzer / Woche + %1$s Nutzer / Monat + %1$s Nutzer / 6 Monate + %1$s Beiträge + %1$s Kommentare + Top des Tages + Top der Woche + Top des Monats + Top des Jahrs + Top aller Zeiten + Abboniert + Lokal + Alle + Aktiv + Heiß + Neu + Meisten Kommentare + Neue Kommentare + Top + Ungelesen + Fertig + Link einfügen + Text + Link + Abbrechen + OK + Bild hochladen + vor %1$s %2$s + Suche... + %1$s Benutzer / Monat + Beigetreten + Abbonieren + Wartend + Zurück + Refresh + Community Info + Community blockieren + %1$s Nutzer / Monat + Abboniert + Lokal + Alle + Gespeichert + Profil + Posteingang + Einstellungen + Abbonements + Account hinzufügen + Wechsele zu %1$s/%2$s + Ausloggen + Menü + Aktualisieren + Post Ansicht + Seiten Info + Zurück + Posteingang + Passwort + Instanz + z.B.: lemmy.ml + Email oder Benutzername + Login + Zurück + Beigetreten + %1$s Beiträge + %1$s Kommentare + Zurück + Person blockieren + Person melden + Moderiert + Beitrag erstellen + Schliessen + vorgeschlagenen Titel kopieren: %1$s + Community + ein Titel hier... + Beitrag bearbeiten + Schliessen + Inhalt + Kommentare + %1$s Kommentare + ( %1$s neu ) + %1$s Kommentare + Gehe zu %1$s + Link kopieren + Permalink kopieren + Beitrag melden + Blockiere %1$s + Bearbeiten + Wiederherstellen + Löschen + "zu " + "von " + Antworten + Zurück + Schreibe deine Nachricht + Melden + Zurück + Schreibe deine Begründung + Über + Was ist neu + Version %1$s + Support + Issue tracker + Developer Matrix chatroom + Spende für die Jerboa Entwicklung + trete c/jerboa bei + Folge auf Mastodon + Open source + Source code + "Jerboa is libre open-source software, licensed under " + the GNU Affero General Public License v3.0 + Momentanen Avatar entfernen + Anzeigename + Bio + Email + Matrix User + Avatar + Banner + Alle + Lokal + Abonnements + Standardauflistungstyp + Aktiv + Heiß + Neu + Top des Tages + Top der Woche + Top des Monats + Top des Jahres + Top über alles + Meiste Kommentare + Neue Kommentare + Standardsortiertyp + Zeige NSFW + Zeige Avatare + Zeige gelesene Beiträge + Bot Konto + Zeige Bot Konten + Zeige Wertungen + Zeige Benachrichtigungen für neue Beiträge + Schicke eine Benachrichtigung an Email + Einstellungen speichern + Konteneinstellungen + Look and feel + Schriftgröße: %1$s + Theme + Theme color + Beitragssansicht + Zeige Navigationsleiste + Einstellungen + Look and feel + %1$s Einstellungen + Über + %1$s Blockiert + Permalink kopiert + %1$s Blockiert + Zuerst einloggen + Falscher Login + %1$s ist keine Lemmy Instanz + Meldung erstellt + Sozial + · + "in " + Zeige Inhalt für eingeklappte Kommentare + Permalink kopiert + Permalink kopiert + Link kopiert + Permalink kopiert + Blockiere %1$s + Kopiere Permalink + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 483c351e0..af64d8f19 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,3 +1,198 @@ Jerboa for Lemmy + Goto Comment + View Source + Copy Permalink + Report Comment + Edit + Restore + Delete + %1$s more replies + View Post + View Context + *Removed* + *Deleted* + Edit + Type your comment + Back + View Source + Copy Permalink + Report Comment + Block %1$s + Reply + Back + Type your comment + View Source + Report Comment + Block %1$s + Created + %1$s users / day + %1$s users / week + %1$s users / month + %1$s users / 6 months + %1$s posts + %1$s comments + Top Day + Top Week + Top Month + Top Year + Top All Time + Subscribed + Local + All + Active + Hot + New + Most Comments + New Comments + Top + Unread + Done + Insert link + Text + Link + Cancel + OK + Upload Image + %1$s %2$s ago + Search... + %1$s users / month + Joined + Subscribe + Pending + Back + Refresh + Community Info + Block Community + %1$s users / month + Subscribed + Local + All + Saved + Profile + Inbox + Settings + Subscriptions + Add Account + Switch to %1$s/%2$s + Sign Out + Menu + Refresh + Post View Mode + Site Info + Back + Inbox + Password + Instance + ex: lemmy.ml + Email or Username + Login + Back + Joined + %1$s posts + %1$s comments + Back + Block Person + Report Person + Moderates + Create post + Close + copy suggested title: %1$s + Community + a title here.... + Edit Post + Close + Body + Comments + %1$s comments + ( %1$s new ) + %1$s comments + Go to %1$s + Copy link + Copy Permalink + Report Post + Block %1$s + Edit + Restore + Delete + "to " + "from " + Reply + Back + Type your message + Report + Back + Type your reason + About + What\'s New + Version %1$s + Support + Issue tracker + Developer Matrix chatroom + Donate to Jerboa development + Join c/jerboa + Follow on Mastodon + Open source + Source code + "Jerboa is libre open-source software, licensed under " + the GNU Affero General Public License v3.0 + Remove Current Avatar + Display Name + Bio + Email + Matrix User + Avatar + Banner + All + Local + Subscribed + Default Listing Type + Active + Hot + New + TopDay + TopWeek + TopMonth + TopYear + TopAll + MostComments + NewComments + Default Sort Type + Show NSFW + Show Avatars + Show Read Posts + Bot Account + Show Bot Accounts + Show Scores + Show Notifications for New Posts + Send Notifications to Email + Save Settings + Account Settings + Look and feel + Font size: %1$s + Theme + Theme color + Post View + Show navigation bar + Settings + Look and feel + %1$s settings + About + %1$s Blocked + Permalink Copied + %1$s Blocked + Login first + Incorrect Login + %1$s is not a Lemmy Instance + Report Created + Social + · + "in " + Show content for collapsed comments + Permalink Copied + Permalink Copied + Link Copied + Permalink Copied + Block %1$s + Copy Permalink