diff --git a/ai/ui/api/current.api b/ai/ui/api/current.api index 61731bd1bc..e21de1e828 100644 --- a/ai/ui/api/current.api +++ b/ai/ui/api/current.api @@ -29,8 +29,7 @@ package com.google.android.horologist.ai.ui.model { } public static final class FailedResponseUiModel.Companion { - method public com.google.android.horologist.ai.ui.model.FailedResponseUiModel getNoCompanion(); - property public final com.google.android.horologist.ai.ui.model.FailedResponseUiModel NoCompanion; + method public com.google.android.horologist.ai.ui.model.FailedResponseUiModel NoCompanion(android.content.Context context); } public final class InProgressResponseUiModel implements com.google.android.horologist.ai.ui.model.ResponseUiModel { diff --git a/ai/ui/src/main/java/com/google/android/horologist/ai/ui/model/FailedResponseUiModel.kt b/ai/ui/src/main/java/com/google/android/horologist/ai/ui/model/FailedResponseUiModel.kt index 746cda79ef..4a3461e25a 100644 --- a/ai/ui/src/main/java/com/google/android/horologist/ai/ui/model/FailedResponseUiModel.kt +++ b/ai/ui/src/main/java/com/google/android/horologist/ai/ui/model/FailedResponseUiModel.kt @@ -16,9 +16,12 @@ package com.google.android.horologist.ai.ui.model +import android.content.Context +import com.google.android.horologist.ai.ui.R + public data class FailedResponseUiModel(public val message: String) : PromptOrResponseUiModel { public companion object { - public val NoCompanion: FailedResponseUiModel = - FailedResponseUiModel("No companion app found") + public fun NoCompanion(context: Context): FailedResponseUiModel = + FailedResponseUiModel(context.getString(R.string.horologist_no_companion_app_found)) } } diff --git a/ai/ui/src/main/java/com/google/android/horologist/ai/ui/screens/PromptScreen.kt b/ai/ui/src/main/java/com/google/android/horologist/ai/ui/screens/PromptScreen.kt index d108a0e960..b735366ddf 100644 --- a/ai/ui/src/main/java/com/google/android/horologist/ai/ui/screens/PromptScreen.kt +++ b/ai/ui/src/main/java/com/google/android/horologist/ai/ui/screens/PromptScreen.kt @@ -24,9 +24,11 @@ import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Settings import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.wear.compose.material.ListHeader import androidx.wear.compose.material.Text +import com.google.android.horologist.ai.ui.R import com.google.android.horologist.ai.ui.components.PromptOrResponseDisplay import com.google.android.horologist.ai.ui.components.ResponseInProgressCard import com.google.android.horologist.ai.ui.components.TextPromptDisplay @@ -66,7 +68,7 @@ public fun PromptScreen( ScalingLazyColumn(columnState = columnState, modifier = modifier) { item { ListHeader(modifier = Modifier.fillMaxWidth(0.8f)) { - Text(text = uiState.modelInfo?.name ?: "...") + Text(text = uiState.modelInfo?.name ?: stringResource(R.string.horologist_unknown_model)) } } uiState.messages.forEach { @@ -107,7 +109,7 @@ public fun PromptScreen( item { Button( Icons.Default.Settings, - contentDescription = "Settings", + contentDescription = stringResource(R.string.horologist_settings_content_description), onClick = onSettingsClick, ) } diff --git a/ai/ui/src/main/res/values/strings.xml b/ai/ui/src/main/res/values/strings.xml new file mode 100644 index 0000000000..e6bc130654 --- /dev/null +++ b/ai/ui/src/main/res/values/strings.xml @@ -0,0 +1,21 @@ + + + + No companion app found + ... + Settings + \ No newline at end of file