translate hardcoded strings

This commit is contained in:
davotoula
2025-12-15 20:11:00 +01:00
parent 3dd4249220
commit de927b62bd
7 changed files with 59 additions and 7 deletions
@@ -49,6 +49,8 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.vitorpamplona.amethyst.R
import com.vitorpamplona.amethyst.ui.stringRes
/**
* Animated expanding circles that pulse outward from the recording button
@@ -176,6 +178,9 @@ fun FloatingRecordingIndicator(
) {
if (!isRecording) return
val recordingLabel = stringRes(id = R.string.recording_indicator_description)
val recordingWithTime = stringRes(id = R.string.recording_indicator_with_time, formatSecondsToTime(elapsedSeconds))
Box(
modifier =
modifier
@@ -207,7 +212,7 @@ fun FloatingRecordingIndicator(
Icon(
imageVector = Icons.Default.FiberManualRecord,
contentDescription = "Recording",
contentDescription = recordingLabel,
tint = Color.White,
modifier =
Modifier
@@ -216,7 +221,7 @@ fun FloatingRecordingIndicator(
)
Text(
text = "Recording ${formatSecondsToTime(elapsedSeconds)}",
text = recordingWithTime,
color = Color.White,
fontSize = 14.sp,
fontWeight = FontWeight.Medium,
@@ -965,6 +965,14 @@ open class ShortNotePostViewModel :
onError: (title: String, message: String) -> Unit,
) {
val recording = voiceRecording ?: return
val appContext = Amethyst.instance.appContext
val uploadErrorTitle = stringRes(appContext, R.string.upload_error_title)
val uploadVoiceNip95NotSupported = stringRes(appContext, R.string.upload_error_voice_message_nip95_not_supported)
val uploadVoiceFailed = stringRes(appContext, R.string.upload_error_voice_message_failed)
val uploadVoiceUnexpected = stringRes(appContext, R.string.upload_error_voice_message_unexpected_state)
val uploadVoiceExceptionMessage: (String) -> String = { detail ->
stringRes(appContext, R.string.upload_error_voice_message_exception, detail)
}
isUploadingVoice = true
@@ -982,7 +990,7 @@ open class ShortNotePostViewModel :
compressionQuality = CompressorQuality.UNCOMPRESSED,
server = server,
account = account,
context = Amethyst.instance.appContext,
context = appContext,
useH265 = false,
)
@@ -1006,20 +1014,20 @@ open class ShortNotePostViewModel :
is UploadOrchestrator.OrchestratorResult.NIP95Result -> {
// For NIP95, we need to create the event and get the nevent URL
// This is handled differently - skip for now
onError("Upload Error", "NIP95 not yet supported for voice messages")
onError(uploadErrorTitle, uploadVoiceNip95NotSupported)
}
}
}
is UploadingState.Error -> {
onError("Upload Error", "Failed to upload voice message")
onError(uploadErrorTitle, uploadVoiceFailed)
voiceRecording = null
}
else -> {
onError("Upload Error", "Unexpected upload state")
onError(uploadErrorTitle, uploadVoiceUnexpected)
}
}
} catch (e: Exception) {
onError("Upload Error", e.message ?: e.javaClass.simpleName)
onError(uploadErrorTitle, uploadVoiceExceptionMessage(e.message ?: e.javaClass.simpleName))
voiceRecording = null
} finally {
isUploadingVoice = false
@@ -1176,4 +1176,12 @@
<string name="follow_pack_broadcast">Broadcast sady doporučení</string>
<string name="follow_set_delete">Smazat seznam</string>
<string name="follow_pack_delete">Smazat sadu doporučení</string>
<string name="recording_indicator_description">Nahrávání</string>
<string name="recording_indicator_with_time">Nahrávání %1$s</string>
<string name="upload_error_title">Chyba nahrávání</string>
<string name="upload_error_voice_message_failed">Nepodařilo se nahrát hlasovou zprávu</string>
<string name="upload_error_voice_message_unexpected_state">Neočekávaný stav nahrávání</string>
<string name="upload_error_voice_message_nip95_not_supported">NIP-95 zatím není pro hlasové zprávy podporován</string>
<string name="upload_error_voice_message_exception">Nahrávání hlasu selhalo: %1$s</string>
</resources>
@@ -1181,4 +1181,12 @@ anz der Bedingungen ist erforderlich</string>
<string name="follow_pack_broadcast">Empfehlungspaket veröffentlichen</string>
<string name="follow_set_delete">Liste löschen</string>
<string name="follow_pack_delete">Empfehlungspaket löschen</string>
<string name="recording_indicator_description">Aufnahme</string>
<string name="recording_indicator_with_time">Aufnahme %1$s</string>
<string name="upload_error_title">Upload-Fehler</string>
<string name="upload_error_voice_message_failed">Sprachnachricht konnte nicht hochgeladen werden</string>
<string name="upload_error_voice_message_unexpected_state">Unerwarteter Upload-Status</string>
<string name="upload_error_voice_message_nip95_not_supported">NIP-95 wird für Sprachnachrichten noch nicht unterstützt</string>
<string name="upload_error_voice_message_exception">Sprach-Upload fehlgeschlagen: %1$s</string>
</resources>
@@ -1176,4 +1176,12 @@
<string name="follow_pack_broadcast">Transmitir pacote de recomendações</string>
<string name="follow_set_delete">Excluir lista</string>
<string name="follow_pack_delete">Excluir pacote de recomendações</string>
<string name="recording_indicator_description">Gravando</string>
<string name="recording_indicator_with_time">Gravando %1$s</string>
<string name="upload_error_title">Erro de upload</string>
<string name="upload_error_voice_message_failed">Falha ao enviar mensagem de voz</string>
<string name="upload_error_voice_message_unexpected_state">Estado de upload inesperado</string>
<string name="upload_error_voice_message_nip95_not_supported">O NIP-95 ainda não é suportado para mensagens de voz</string>
<string name="upload_error_voice_message_exception">Falha no upload de voz: %1$s</string>
</resources>
@@ -1175,4 +1175,12 @@
<string name="follow_pack_broadcast">Sänd rekommendationspaket</string>
<string name="follow_set_delete">Ta bort lista</string>
<string name="follow_pack_delete">Ta bort rekommendationspaket</string>
<string name="recording_indicator_description">Spelar in</string>
<string name="recording_indicator_with_time">Spelar in %1$s</string>
<string name="upload_error_title">Uppladdningsfel</string>
<string name="upload_error_voice_message_failed">Misslyckades med att ladda upp röstmeddelandet</string>
<string name="upload_error_voice_message_unexpected_state">Oväntat uppladdningstillstånd</string>
<string name="upload_error_voice_message_nip95_not_supported">NIP-95 stöds ännu inte för röstmeddelanden</string>
<string name="upload_error_voice_message_exception">Uppladdning av röst misslyckades: %1$s</string>
</resources>
+7
View File
@@ -170,7 +170,14 @@
<string name="record_a_message">Record a message</string>
<string name="record_a_message_title">Record a message</string>
<string name="record_a_message_description">Click and hold to record a message</string>
<string name="recording_indicator_description">Recording</string>
<string name="recording_indicator_with_time">Recording %1$s</string>
<string name="uploading">Uploading…</string>
<string name="upload_error_title">Upload Error</string>
<string name="upload_error_voice_message_failed">Failed to upload voice message</string>
<string name="upload_error_voice_message_unexpected_state">Unexpected upload state</string>
<string name="upload_error_voice_message_nip95_not_supported">NIP-95 is not supported for voice messages yet</string>
<string name="upload_error_voice_message_exception">Voice upload failed: %1$s</string>
<string name="user_does_not_have_a_lightning_address_setup_to_receive_sats">User does not have a lightning address set up to receive sats</string>
<string name="reply_here">"reply here.. "</string>
<string name="copies_the_note_id_to_the_clipboard_for_sharing">Copies the Note ID to the clipboard for sharing in Nostr</string>