Skip to content

Commit

Permalink
Localize strings for download dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
wingio committed Jun 30, 2023
1 parent 704d5c0 commit 65a0c4a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.materiiapps.gloom.R
import com.materiiapps.gloom.domain.manager.DialogManager
import com.materiiapps.gloom.domain.manager.DialogState
import com.materiiapps.gloom.ui.widgets.release.dialog.ReleaseAssetDownloadDialog
Expand Down Expand Up @@ -133,7 +135,7 @@ fun ReleaseAsset(
) {
Icon(
imageVector = Icons.Filled.Download,
contentDescription = null
contentDescription = stringResource(R.string.action_download)
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ fun ReleaseAssetDownloadDialog(
onDismissRequest = onClose,
confirmButton = {
FilledTonalButton(onClick = { onConfirm(checked) }) {
Text("Download")
Text(stringResource(R.string.action_download))
}
},
dismissButton = {
TextButton(onClick = onClose) {
Text("Cancel")
Text(stringResource(R.string.dismiss_cancel))
}
},
icon = {
Expand All @@ -62,7 +62,7 @@ fun ReleaseAssetDownloadDialog(
},
title = {
Text(
text = "Confirm download",
text = stringResource(R.string.title_download_confirm),
textAlign = TextAlign.Center,
modifier = Modifier.fillMaxWidth()
)
Expand All @@ -72,7 +72,7 @@ fun ReleaseAssetDownloadDialog(
verticalArrangement = Arrangement.spacedBy(16.dp),
) {
Text(
text = "You are about to download $fileName (${getFileSizeString(fileSize)}), are you sure you want to do that?",
text = stringResource(R.string.msg_download_dialog_body, fileName, getFileSizeString(fileSize)),
textAlign = TextAlign.Center,
modifier = Modifier.fillMaxWidth()
)
Expand All @@ -84,7 +84,7 @@ fun ReleaseAssetDownloadDialog(
.fillMaxWidth()
) {
Checkbox(checked = checked, onCheckedChange = { checked = it })
Text("Don't show this again")
Text(stringResource(R.string.label_dont_show_again))
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@
<string name="action_share">Share</string>
<string name="action_expand">View More</string>
<string name="action_collapse">View Less</string>
<string name="action_download">Download</string>

<string name="dismiss_nevermind">Nevermind</string>
<string name="dismiss_cancel">Cancel</string>

<string name="title_pinned">Pinned</string>
<string name="title_download_confirm">Confirm download</string>

<string name="adj_latest">Latest</string>

Expand Down Expand Up @@ -122,6 +125,7 @@
<string name="msg_pr_untitled">Untitled pull request</string>
<string name="msg_issue_or_pr_author">#%1$d by %2$s</string>
<string name="msg_release_author">§author§%1$s§ released this %2$s</string>
<string name="msg_download_dialog_body">You are about to download %1$s (%2$s), are you sure you want to do that?</string>

<string name="label_checks_failed">Checks failed</string>
<string name="label_checks">Checks</string>
Expand All @@ -130,6 +134,7 @@
<string name="label_latest">Latest</string>
<string name="label_prerelease">Pre-release</string>
<string name="label_all_releases">All releases</string>
<string name="label_dont_show_again">Don\'t show this again</string>

<string name="time_now">Now</string>
<string name="time_since_second">%1$ds</string>
Expand Down

0 comments on commit 65a0c4a

Please sign in to comment.