make more things translatable

This commit is contained in:
Minecon724 2024-08-01 18:58:22 +02:00
parent 3829e9ce3f
commit f33bc55f68
Signed by: Minecon724
GPG key ID: 3CCC4D267742C8E8
3 changed files with 17 additions and 19 deletions

View file

@ -12,7 +12,9 @@ import androidx.compose.runtime.Composable
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.unit.sp
import eu.m724.vastapp.R
import eu.m724.vastapp.activity.Opener
import eu.m724.vastapp.activity.dashboard.DashboardViewModel
@ -30,6 +32,6 @@ fun HelpScreen(dashboardViewModel: DashboardViewModel) { // TODO make this a web
}) {
Text(text = "https://vast.ai/docs")
}
Text(text = "(this will be a webview)", fontSize = 12.sp)
Text(text = stringResource(id = R.string.webview_todo), fontSize = 12.sp)
}
}

View file

@ -32,6 +32,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
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 eu.m724.vastapp.R
@ -46,24 +47,13 @@ class TermuxSshActivity : ComponentActivity() {
val exitCode = termuxResult!!.getInt("exitCode")
val internalErrorCode = termuxResult.getInt("err")
val stdout = termuxResult.getString("stdout", "")
println(exitCode)
println("C" + termuxResult.getString("stdout"))
println(termuxResult.getInt("err"))
var msg = stdout
if (internalErrorCode == -1) {
if (exitCode == 0) {
if (stdout.isEmpty()) {
Toast.makeText(
applicationContext,
getString(R.string.termux_no_ssh),
Toast.LENGTH_SHORT
).show()
}
finish()
}
} // TODO handle other errors like 255 is connection refused
} else {
msg = termuxResult.getString("errmsg")
}
@ -105,7 +95,7 @@ class TermuxSshActivity : ComponentActivity() {
@Composable
fun UnexpectedError(msg: String) {
Text("An error occured:")
Text(stringResource(id = R.string.termux_error))
Card(
modifier = Modifier.padding(16.dp)
) {
@ -118,8 +108,8 @@ fun UnexpectedError(msg: String) {
@Composable
fun SshNotInstalled(onCopyButtonClick: (String) -> Unit, onOpenTermuxButton: () -> Unit) {
Text("No SSH client installed.")
Text("Install Dropbear with:")
Text(stringResource(id = R.string.termux_no_ssh))
Text(stringResource(id = R.string.termux_install_dropbear))
Spacer(modifier = Modifier.height(16.dp))
Card {
@ -146,15 +136,15 @@ fun SshNotInstalled(onCopyButtonClick: (String) -> Unit, onOpenTermuxButton: ()
Spacer(modifier = Modifier.height(16.dp))
FilledTonalButton(onClick = onOpenTermuxButton) {
Text("Open Termux")
Text(stringResource(id = R.string.open_termux))
}
}
@Composable
fun TermuxSetupGuide(onUrlButtonClick: (String) -> Unit) {
Text("Termux is not configured for usage with other apps.")
Text(stringResource(id = R.string.termux_not_configured))
Spacer(modifier = Modifier.height(16.dp))
FilledTonalButton(onClick = { onUrlButtonClick("https://github.com/termux/termux-app/wiki/RUN_COMMAND-Intent#Setup-Instructions") }) {
Text("Open instructions on github.com")
Text(stringResource(id = R.string.termux_open_instructions))
}
}

View file

@ -25,4 +25,10 @@
<string name="title_activity_termux_ssh">TermuxSshActivity</string>
<string name="termux_no_ssh">No ssh client on termux, install dropbear or openssh package</string>
<string name="copied_to_clipboard">Copied command to clipboard</string>
<string name="termux_install_dropbear">Install Dropbear with:</string>
<string name="open_termux">Open Termux</string>
<string name="termux_not_configured">Termux is not configured for usage with other apps.</string>
<string name="termux_open_instructions">Open instructions on github.com</string>
<string name="termux_error">An error occured:</string>
<string name="webview_todo">(this will be a webview)</string>
</resources>