New languages (#256)

* Remove custom-onnxruntime-arm64.aar

* Refactor remaining, hardcoded UI strings into localizable resources and added French and Russian to language list

* Fix background auto-advance for Text-to-Speech (TTS)
This commit is contained in:
Aryan 2026-04-29 18:35:23 +05:30 committed by GitHub
parent 224d12d1fb
commit 4582b506f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 940 additions and 488 deletions

View file

@ -463,7 +463,7 @@ fun ChapterWebView(
TextButton(onClick = {
val clipboard =
context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
val clip = ClipData.newPlainText("Copied Link", urlToShow)
val clip = ClipData.newPlainText(context.getString(R.string.clip_label_copied_link), urlToShow)
clipboard.setPrimaryClip(clip)
showExternalLinkDialog = null
}) { Text(stringResource(R.string.action_copy)) }
@ -1066,7 +1066,7 @@ fun ChapterWebView(
onCopy = {
val clipboard =
context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
val clip = ClipData.newPlainText("Copied Text", state.selectedText)
val clip = ClipData.newPlainText(context.getString(R.string.clip_label_copied_text), state.selectedText)
clipboard.setPrimaryClip(clip)
state.finishActionModeCallback()
localWebViewRef?.clearFocus()

View file

@ -577,7 +577,7 @@ fun AnnotationBottomSheet(
) {
Icon(Icons.Default.Delete, contentDescription = null, modifier = Modifier.size(18.dp))
Spacer(Modifier.width(8.dp))
Text("Delete")
Text(stringResource(R.string.action_delete))
}
Button(
onClick = { onSave(noteText) },
@ -586,7 +586,7 @@ fun AnnotationBottomSheet(
contentColor = MaterialTheme.colorScheme.onPrimary
)
) {
Text("Save Note")
Text(stringResource(R.string.action_save_note))
}
}
}
@ -993,4 +993,4 @@ fun FootnoteBottomSheet(
}
}
}
}
}

View file

@ -225,7 +225,7 @@ fun EpubReaderTopBar(
description = stringResource(R.string.tooltip_back_desc),
onClick = onNavigateBack
) {
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back")
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.action_back))
}
Spacer(Modifier.width(8.dp))
Text(
@ -583,7 +583,7 @@ fun EpubReaderBottomBar(
) {
Icon(
painter = painterResource(id = R.drawable.ai),
contentDescription = "AI Features"
contentDescription = stringResource(R.string.ai_features_title)
)
}
}
@ -1091,7 +1091,7 @@ fun AutoScrollControls(
) {
Icon(
imageVector = Icons.Default.ArrowUpward,
contentDescription = "Scroll to Top",
contentDescription = stringResource(R.string.action_scroll_to_top),
modifier = Modifier.size(18.dp),
tint = MaterialTheme.colorScheme.onSurfaceVariant
)
@ -1440,7 +1440,7 @@ fun TtsOverlayControls(
) {
Icon(
painterResource(if (ttsState.isPlaying) R.drawable.pause else R.drawable.play),
"Play/Pause",
stringResource(R.string.content_desc_play_pause),
modifier = Modifier.size(20.dp)
)
}
@ -1514,10 +1514,10 @@ fun TtsOverlayControls(
)
}
IconButton(onClick = { onCollapseChange(true) }, modifier = Modifier.size(32.dp)) {
Icon(Icons.Default.ChevronRight, "Collapse", modifier = Modifier.size(18.dp), tint = MaterialTheme.colorScheme.onSurfaceVariant)
Icon(Icons.Default.ChevronRight, stringResource(R.string.content_desc_collapse), modifier = Modifier.size(18.dp), tint = MaterialTheme.colorScheme.onSurfaceVariant)
}
IconButton(onClick = onClose, modifier = Modifier.size(32.dp)) {
Icon(Icons.Default.Close, "Stop TTS", tint = MaterialTheme.colorScheme.error, modifier = Modifier.size(18.dp))
Icon(Icons.Default.Close, stringResource(R.string.content_desc_stop_tts), tint = MaterialTheme.colorScheme.error, modifier = Modifier.size(18.dp))
}
}
}
@ -1541,7 +1541,7 @@ fun TtsOverlayControls(
) {
Icon(
painterResource(if (ttsState.isPlaying) R.drawable.pause else R.drawable.play),
"Play/Pause",
stringResource(R.string.content_desc_play_pause),
modifier = Modifier.size(28.dp)
)
}
@ -1557,7 +1557,7 @@ fun TtsOverlayControls(
// Unified Sliders Block
Column(modifier = Modifier.weight(1f)) {
Row(verticalAlignment = Alignment.CenterVertically) {
Text("Spd: %.1fx".format(rate), style = MaterialTheme.typography.labelSmall, modifier = Modifier.width(62.dp))
Text(stringResource(R.string.tts_speed_short, "%.1f".format(rate)), style = MaterialTheme.typography.labelSmall, modifier = Modifier.width(62.dp))
Slider(
value = rate,
onValueChange = {
@ -1571,11 +1571,11 @@ fun TtsOverlayControls(
modifier = Modifier.weight(1f).height(24.dp)
)
IconButton(onClick = { rate = 1.0f; saveAndApply() }, modifier = Modifier.size(32.dp)) {
Icon(Icons.Default.Refresh, "Reset Speed", modifier = Modifier.size(16.dp))
Icon(Icons.Default.Refresh, stringResource(R.string.content_desc_reset_speed), modifier = Modifier.size(16.dp))
}
}
Row(verticalAlignment = Alignment.CenterVertically) {
Text("Ptch: %.1fx".format(pitch), style = MaterialTheme.typography.labelSmall, modifier = Modifier.width(62.dp))
Text(stringResource(R.string.tts_pitch_short, "%.1f".format(pitch)), style = MaterialTheme.typography.labelSmall, modifier = Modifier.width(62.dp))
Slider(
value = pitch,
onValueChange = {
@ -1589,7 +1589,7 @@ fun TtsOverlayControls(
modifier = Modifier.weight(1f).height(24.dp)
)
IconButton(onClick = { pitch = 1.0f; saveAndApply() }, modifier = Modifier.size(32.dp)) {
Icon(Icons.Default.Refresh, "Reset Pitch", modifier = Modifier.size(16.dp))
Icon(Icons.Default.Refresh, stringResource(R.string.content_desc_reset_pitch), modifier = Modifier.size(16.dp))
}
}
}

View file

@ -243,7 +243,7 @@ fun EpubReaderDrawerSheet(
Tab(
selected = drawerPagerState.currentPage == 2,
onClick = { drawerScope.launch { drawerPagerState.animateScrollToPage(2) } },
text = { Text("Annotations") }
text = { Text(stringResource(R.string.tab_annotations)) }
)
}
@ -408,13 +408,13 @@ private fun ChaptersList(
horizontalArrangement = Arrangement.SpaceEvenly
) {
TextButton(onClick = { expandedEntryIndices = effectiveToc.indices.toSet() }) {
Text("Expand All")
Text(stringResource(R.string.action_expand_all))
}
TextButton(onClick = { expandedEntryIndices = emptySet() }) {
Text("Collapse All")
Text(stringResource(R.string.action_collapse_all))
}
TextButton(onClick = onScrollToCurrent) {
Text("Locate")
Text(stringResource(R.string.action_locate))
}
}
@ -884,4 +884,4 @@ private fun HighlightsList(
)
}
}
}
}

View file

@ -905,7 +905,7 @@ fun EpubReaderHost(
})
var isPagerInitialized by remember(initialLocator) { mutableStateOf(initialLocator == null) }
val ttsController = rememberTtsController()
val ttsController = viewModel.ttsController
val ttsState by ttsController.ttsState.collectAsState()
val totalBookLengthChars = remember(chapters) {
@ -4979,7 +4979,7 @@ fun EpubReaderHost(
},
onCopy = {
val clipboardManager = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
val clip = ClipData.newPlainText("Copied Text", targetHighlight.text)
val clip = ClipData.newPlainText(context.getString(R.string.clip_label_copied_text), targetHighlight.text)
clipboardManager.setPrimaryClip(clip)
highlightToNoteCfi = null
},
@ -5188,13 +5188,13 @@ fun EpubReaderHost(
AlertDialog(
onDismissRequest = { showInsufficientCreditsDialog = false },
icon = { Icon(painterResource(id = R.drawable.crown), contentDescription = null) },
title = { Text("Out of Credits") },
text = { Text("You don't have enough credits. Get Episteme Pro for 10 free Summaries per day, or add more credits to use Summaries, Cloud TTS and Story Recap.") },
title = { Text(stringResource(R.string.dialog_out_of_credits_title)) },
text = { Text(stringResource(R.string.dialog_out_of_credits_desc)) },
confirmButton = {
TextButton(onClick = {
showInsufficientCreditsDialog = false
onNavigateToPro()
}) { Text("Get Pro / Add Credits") }
}) { Text(stringResource(R.string.action_get_pro_or_add_credits)) }
},
dismissButton = {
TextButton(onClick = { showInsufficientCreditsDialog = false }) {

View file

@ -912,9 +912,9 @@ fun VisualOptionsSheet(
AnimatedVisibility(visible = pullToTurnEnabled) {
Column(modifier = Modifier.padding(start = 16.dp, end = 16.dp, bottom = 16.dp)) {
HorizontalDivider(modifier = Modifier.padding(bottom = 12.dp), color = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.2f))
Text("Pull Distance to Change Chapter", style = MaterialTheme.typography.titleSmall)
Text(stringResource(R.string.setting_pull_distance_change_chapter), style = MaterialTheme.typography.titleSmall)
Row(verticalAlignment = Alignment.CenterVertically) {
Text("Short", style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant)
Text(stringResource(R.string.label_short), style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant)
Slider(
value = pullToTurnMultiplier,
onValueChange = onPullToTurnMultiplierChange,
@ -922,7 +922,7 @@ fun VisualOptionsSheet(
steps = 14,
modifier = Modifier.weight(1f).padding(horizontal = 12.dp)
)
Text("Long", style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant)
Text(stringResource(R.string.label_long), style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant)
}
}
}
@ -1079,7 +1079,7 @@ fun FormatSlider(
},
modifier = Modifier.size(32.dp) // Slimmer buttons
) {
Icon(Icons.Default.Remove, contentDescription = "Decrease", tint = MaterialTheme.colorScheme.primary)
Icon(Icons.Default.Remove, contentDescription = stringResource(R.string.content_desc_decrease), tint = MaterialTheme.colorScheme.primary)
}
// Using our new CustomCanvasSlider here!
@ -1097,7 +1097,7 @@ fun FormatSlider(
},
modifier = Modifier.size(32.dp) // Slimmer buttons
) {
Icon(Icons.Default.Add, contentDescription = "Increase", tint = MaterialTheme.colorScheme.primary)
Icon(Icons.Default.Add, contentDescription = stringResource(R.string.content_desc_increase), tint = MaterialTheme.colorScheme.primary)
}
}
}