mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 23:51:21 +02:00
Fix strings missing from translations (#959)
## Description Weblate's Android string parser (aka https://translate.codeberg.org/projects/wholphin/) doesn't support direct translations of string arrays. Many of Wholphin's preference options are defined in string arrays and therefore could not be translated. So this PR implements the [suggested workaround](https://docs.weblate.org/en/latest/formats/android.html) to move the string into individual entries and reference them in arrays. Also moves some hardcoded strings into `strings.xml` so they can be translated. Note: virtually all error messages are still hardcoded, but they are only for exceptional cases, so it's probably not a huge problem. A minor bug where the backdrop would show briefly after switching users is fixed. ### Related issues Fixes #957 ### Testing Emulator ## Screenshots N/A ## AI or LLM usage None
This commit is contained in:
parent
a44fad890f
commit
2a371e7d6b
9 changed files with 156 additions and 93 deletions
|
|
@ -123,6 +123,9 @@ class MainActivity : AppCompatActivity() {
|
|||
@Inject
|
||||
lateinit var suggestionsSchedulerService: SuggestionsSchedulerService
|
||||
|
||||
@Inject
|
||||
lateinit var backdropService: BackdropService
|
||||
|
||||
// Note: unused but injected to ensure it is created
|
||||
@Inject
|
||||
lateinit var serverEventListener: ServerEventListener
|
||||
|
|
@ -247,6 +250,9 @@ class MainActivity : AppCompatActivity() {
|
|||
}
|
||||
|
||||
is SetupDestination.AppContent -> {
|
||||
LaunchedEffect(Unit) {
|
||||
backdropService.clearBackdrop()
|
||||
}
|
||||
val current = key.current
|
||||
ProvideLocalClock {
|
||||
if (UpdateChecker.ACTIVE && appPreferences.autoCheckForUpdates) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import androidx.compose.foundation.text.appendInlineContent
|
|||
import androidx.compose.ui.text.AnnotatedString
|
||||
import androidx.compose.ui.text.buildAnnotatedString
|
||||
import com.github.damontecres.wholphin.R
|
||||
import com.github.damontecres.wholphin.WholphinApplication
|
||||
import org.jellyfin.sdk.model.api.BaseItemDto
|
||||
import org.jellyfin.sdk.model.api.MediaSegmentType
|
||||
import timber.log.Timber
|
||||
|
|
@ -76,7 +77,7 @@ val BaseItemDto.seriesProductionYears: String?
|
|||
append(productionYear.toString())
|
||||
if (status == "Continuing") {
|
||||
append(" - ")
|
||||
append("Present")
|
||||
append(WholphinApplication.instance.getString(R.string.series_continueing))
|
||||
} else if (status == "Ended") {
|
||||
endDate?.let {
|
||||
if (it.year != productionYear) {
|
||||
|
|
|
|||
|
|
@ -857,7 +857,7 @@ fun CollectionFolderGridContent(
|
|||
DataLoadingState.Loading,
|
||||
-> {
|
||||
// This shouldn't happen, so just show placeholder
|
||||
Text("Loading")
|
||||
Text(stringResource(R.string.loading))
|
||||
}
|
||||
|
||||
is DataLoadingState.Error -> {
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ fun DownloadSubtitlesContent(
|
|||
.padding(PaddingValues(24.dp)),
|
||||
) {
|
||||
Text(
|
||||
text = "Search & download subtitles",
|
||||
text = stringResource(R.string.search_and_download_subtitles),
|
||||
style = MaterialTheme.typography.titleLarge,
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
)
|
||||
|
|
@ -113,7 +113,7 @@ fun DownloadSubtitlesContent(
|
|||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
Text(
|
||||
text = "Language",
|
||||
text = stringResource(R.string.language),
|
||||
style = MaterialTheme.typography.titleSmall,
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
)
|
||||
|
|
@ -137,7 +137,7 @@ fun DownloadSubtitlesContent(
|
|||
}
|
||||
if (dialogItems.isEmpty()) {
|
||||
Text(
|
||||
text = "No remote subtitles were found",
|
||||
text = stringResource(R.string.no_subtitles_found),
|
||||
style = MaterialTheme.typography.titleLarge,
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.github.damontecres.wholphin.ui.playback
|
||||
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import com.github.damontecres.wholphin.R
|
||||
import com.github.damontecres.wholphin.preferences.PrefContentScale
|
||||
import org.jellyfin.sdk.model.api.BaseItemKind
|
||||
import org.jellyfin.sdk.model.api.CollectionType
|
||||
|
|
@ -9,13 +10,13 @@ val playbackSpeedOptions = listOf(".25", ".5", ".75", "1.0", "1.25", "1.5", "1.7
|
|||
|
||||
val playbackScaleOptions =
|
||||
mapOf(
|
||||
ContentScale.Fit to "Fit",
|
||||
ContentScale.None to "None",
|
||||
ContentScale.Crop to "Crop",
|
||||
ContentScale.Fit to R.string.content_scale_fit,
|
||||
ContentScale.None to R.string.none,
|
||||
ContentScale.Crop to R.string.content_scale_crop,
|
||||
// ContentScale.Inside to "Inside",
|
||||
ContentScale.FillBounds to "Fill",
|
||||
ContentScale.FillWidth to "Fill Width",
|
||||
ContentScale.FillHeight to "Fill Height",
|
||||
ContentScale.FillBounds to R.string.content_scale_fill,
|
||||
ContentScale.FillWidth to R.string.content_scale_fill_width,
|
||||
ContentScale.FillHeight to R.string.content_scale_fill_height,
|
||||
)
|
||||
|
||||
val PrefContentScale.scale: ContentScale
|
||||
|
|
|
|||
|
|
@ -144,7 +144,9 @@ fun PlaybackDialog(
|
|||
BottomDialogItem(
|
||||
data = PlaybackDialogType.VIDEO_SCALE,
|
||||
headline = stringResource(R.string.video_scale),
|
||||
supporting = playbackScaleOptions[settings.contentScale],
|
||||
supporting =
|
||||
playbackScaleOptions[settings.contentScale]
|
||||
?.let { stringResource(it) },
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
@ -220,7 +222,7 @@ fun PlaybackDialog(
|
|||
playbackScaleOptions.map { (scale, name) ->
|
||||
BottomDialogItem(
|
||||
data = scale,
|
||||
headline = name,
|
||||
headline = stringResource(name),
|
||||
supporting = null,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ fun AddSeerrServerApiKey(
|
|||
val passwordFocusRequester = remember { FocusRequester() }
|
||||
LaunchedEffect(Unit) { focusRequester.tryRequestFocus() }
|
||||
Text(
|
||||
text = "Enter URL & API Key",
|
||||
text = stringResource(R.string.enter_url_api_key),
|
||||
style = MaterialTheme.typography.titleMedium,
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
textAlign = TextAlign.Center,
|
||||
|
|
@ -73,7 +73,7 @@ fun AddSeerrServerApiKey(
|
|||
modifier = Modifier.align(Alignment.CenterHorizontally),
|
||||
) {
|
||||
Text(
|
||||
text = "URL",
|
||||
text = stringResource(R.string.url),
|
||||
modifier = Modifier.padding(end = 8.dp),
|
||||
)
|
||||
EditTextBox(
|
||||
|
|
@ -104,7 +104,7 @@ fun AddSeerrServerApiKey(
|
|||
modifier = Modifier.align(Alignment.CenterHorizontally),
|
||||
) {
|
||||
Text(
|
||||
text = "API Key",
|
||||
text = stringResource(R.string.api_key),
|
||||
modifier = Modifier.padding(end = 8.dp),
|
||||
)
|
||||
EditTextBox(
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ import androidx.compose.runtime.getValue
|
|||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import com.github.damontecres.wholphin.R
|
||||
import com.github.damontecres.wholphin.data.model.SeerrAuthMethod
|
||||
import com.github.damontecres.wholphin.ui.components.BasicDialog
|
||||
import com.github.damontecres.wholphin.ui.components.DialogItem
|
||||
|
|
@ -71,27 +73,26 @@ fun ChooseSeerrLoginType(
|
|||
onChoose: (SeerrAuthMethod) -> Unit,
|
||||
) {
|
||||
val params =
|
||||
remember {
|
||||
DialogParams(
|
||||
fromLongClick = false,
|
||||
title = "Login to Seerr server",
|
||||
items =
|
||||
listOf(
|
||||
DialogItem(
|
||||
text = "API Key",
|
||||
onClick = { onChoose.invoke(SeerrAuthMethod.API_KEY) },
|
||||
),
|
||||
DialogItem(
|
||||
text = "Jellyfin user",
|
||||
onClick = { onChoose.invoke(SeerrAuthMethod.JELLYFIN) },
|
||||
),
|
||||
DialogItem(
|
||||
text = "Local user",
|
||||
onClick = { onChoose.invoke(SeerrAuthMethod.LOCAL) },
|
||||
),
|
||||
DialogParams(
|
||||
fromLongClick = false,
|
||||
title = stringResource(R.string.seerr_login),
|
||||
items =
|
||||
listOf(
|
||||
DialogItem(
|
||||
text = stringResource(R.string.api_key),
|
||||
onClick = { onChoose.invoke(SeerrAuthMethod.API_KEY) },
|
||||
),
|
||||
)
|
||||
}
|
||||
DialogItem(
|
||||
text = stringResource(R.string.seerr_jellyfin_user),
|
||||
onClick = { onChoose.invoke(SeerrAuthMethod.JELLYFIN) },
|
||||
),
|
||||
DialogItem(
|
||||
text = stringResource(R.string.seerr_local_user),
|
||||
onClick = { onChoose.invoke(SeerrAuthMethod.LOCAL) },
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
DialogPopup(
|
||||
params = params,
|
||||
onDismissRequest = onDismissRequest,
|
||||
|
|
|
|||
|
|
@ -522,109 +522,161 @@
|
|||
<string name="display_presets">Display presets</string>
|
||||
<string name="display_presets_description">Built-in presets to quickly style all rows</string>
|
||||
<string name="customize_home_summary">Choose rows and images on the home page</string>
|
||||
<string name="content_scale_fit">Fit</string>
|
||||
<string name="content_scale_crop">Crop</string>
|
||||
<string name="content_scale_fill">Fill</string>
|
||||
<string name="content_scale_fill_width">Fill width</string>
|
||||
<string name="content_scale_fill_height">Fill height</string>
|
||||
<string name="display_preset_default">Wholphin Default</string>
|
||||
<string name="display_preset_compact">Wholphin Compact</string>
|
||||
<string name="display_preset_series_thumb">Series Thumb images</string>
|
||||
<string name="display_preset_episode_thumbnails">Episode Thumbnail images</string>
|
||||
|
||||
<string name="volume_lowest">Lowest</string>
|
||||
<string name="volume_low">Low</string>
|
||||
<string name="volume_medium">Medium</string>
|
||||
<string name="volume_high">High</string>
|
||||
<string name="volume_full">Full</string>
|
||||
<string-array name="theme_song_volume">
|
||||
<item>Disabled</item>
|
||||
<item>Lowest</item>
|
||||
<item>Low</item>
|
||||
<item>Medium</item>
|
||||
<item>High</item>
|
||||
<item>Full</item>
|
||||
<item>@string/disabled</item>
|
||||
<item>@string/volume_lowest</item>
|
||||
<item>@string/volume_low</item>
|
||||
<item>@string/volume_medium</item>
|
||||
<item>@string/volume_high</item>
|
||||
<item>@string/volume_full</item>
|
||||
</string-array>
|
||||
|
||||
<string name="purple">Purple</string>
|
||||
<string name="orange">Orange</string>
|
||||
<string name="bold_blue">Bold Blue</string>
|
||||
<string name="black">Black</string>
|
||||
<string-array name="app_theme_colors">
|
||||
<item>Purple</item>
|
||||
<item>Blue</item>
|
||||
<item>Green</item>
|
||||
<item>Orange</item>
|
||||
<item>Bold Blue</item>
|
||||
<item>Black</item>
|
||||
<item>@string/purple</item>
|
||||
<item>@string/blue</item>
|
||||
<item>@string/green</item>
|
||||
<item>@string/orange</item>
|
||||
<item>@string/bold_blue</item>
|
||||
<item>@string/black</item>
|
||||
</string-array>
|
||||
|
||||
<string name="skip_ignore">Ignore</string>
|
||||
<string name="skip_automatically">Skip automatically</string>
|
||||
<string name="skip_ask">Ask to skip</string>
|
||||
<string-array name="skip_behaviors">
|
||||
<item>Ignore</item>
|
||||
<item>Skip automatically</item>
|
||||
<item>Ask to skip</item>
|
||||
<item>@string/skip_ignore</item>
|
||||
<item>@string/skip_automatically</item>
|
||||
<item>@string/skip_ask</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="content_scale">
|
||||
<item>Fit</item>
|
||||
<item>None</item>
|
||||
<item>Crop</item>
|
||||
<item>Fill</item>
|
||||
<item>Fill Width</item>
|
||||
<item>Fill Height</item>
|
||||
<item>@string/content_scale_fit</item>
|
||||
<item>@string/none</item>
|
||||
<item>@string/content_scale_crop</item>
|
||||
<item>@string/content_scale_fill</item>
|
||||
<item>@string/content_scale_fill_width</item>
|
||||
<item>@string/content_scale_fill_height</item>
|
||||
</string-array>
|
||||
|
||||
<string name="ffmpeg_fallback">Only use FFmpeg if no built-in decoder exists</string>
|
||||
<string name="ffmpeg_prefer">Prefer to use FFmpeg over built-in decoders</string>
|
||||
<string name="ffmpeg_never">Never use FFmpeg decoders</string>
|
||||
<string-array name="ffmpeg_extension_options">
|
||||
<item>Only use FFmpeg if no built-in decoder exists</item>
|
||||
<item>Prefer to use FFmpeg over built-in decoders</item>
|
||||
<item>Never use FFmpeg decoders</item>
|
||||
<item>@string/ffmpeg_fallback</item>
|
||||
<item>@string/ffmpeg_prefer</item>
|
||||
<item>@string/ffmpeg_never</item>
|
||||
</string-array>
|
||||
|
||||
<string name="next_up_playback_end">At the end of playback</string>
|
||||
<string name="next_up_outro">During end credits/outro</string>
|
||||
<string-array name="show_next_up_when_options">
|
||||
<item>At the end of playback</item>
|
||||
<item>During end credits/outro</item>
|
||||
<item>@string/next_up_playback_end</item>
|
||||
<item>@string/next_up_outro</item>
|
||||
</string-array>
|
||||
|
||||
<string name="white">White</string>
|
||||
<string name="light_gray">Light gray</string>
|
||||
<string name="dark_gray">Dark gray</string>
|
||||
<string name="yellow">Yellow</string>
|
||||
<string name="cyan">Cyan</string>
|
||||
<string name="magenta">Magenta</string>
|
||||
<string-array name="font_colors">
|
||||
<item>White</item>
|
||||
<item>Black</item>
|
||||
<item>Light Gray</item>
|
||||
<item>Dark Gray</item>
|
||||
<item>Red</item>
|
||||
<item>Yellow</item>
|
||||
<item>Green</item>
|
||||
<item>Cyan</item>
|
||||
<item>Blue</item>
|
||||
<item>Magenta</item>
|
||||
<item>@string/white</item>
|
||||
<item>@string/black</item>
|
||||
<item>@string/light_gray</item>
|
||||
<item>@string/dark_gray</item>
|
||||
<item>@string/red</item>
|
||||
<item>@string/yellow</item>
|
||||
<item>@string/green</item>
|
||||
<item>@string/cyan</item>
|
||||
<item>@string/blue</item>
|
||||
<item>@string/magenta</item>
|
||||
</string-array>
|
||||
|
||||
<string name="subtitle_edge_outline">Outline</string>
|
||||
<string name="subtitle_edge_shadow">Shadow</string>
|
||||
<string-array name="subtitle_edge">
|
||||
<item>None</item>
|
||||
<item>Outline</item>
|
||||
<item>Shadow</item>
|
||||
<item>@string/none</item>
|
||||
<item>@string/subtitle_edge_outline</item>
|
||||
<item>@string/subtitle_edge_shadow</item>
|
||||
</string-array>
|
||||
|
||||
<string name="background_style_wrap">Wrap</string>
|
||||
<string name="background_style_boxed">Boxed</string>
|
||||
<string-array name="background_style">
|
||||
<item>None</item>
|
||||
<item>Wrap</item>
|
||||
<item>Boxed</item>
|
||||
<item>@string/none</item>
|
||||
<item>@string/background_style_wrap</item>
|
||||
<item>@string/background_style_boxed</item>
|
||||
</string-array>
|
||||
|
||||
<string name="exoplayer" translatable="false">ExoPlayer</string>
|
||||
<string name="mpv" translatable="false">MPV</string>
|
||||
<string name="prefer_mpv">Prefer MPV</string>
|
||||
<string-array name="player_backend_options">
|
||||
<item>ExoPlayer</item>
|
||||
<item>MPV</item>
|
||||
<item>Prefer MPV</item>
|
||||
<item>@string/exoplayer</item>
|
||||
<item>@string/mpv</item>
|
||||
<item>@string/prefer_mpv</item>
|
||||
</string-array>
|
||||
|
||||
<string name="player_backend_options_subtitles_prefer_mpv">Use ExoPlayer for HDR playback</string>
|
||||
<string-array name="player_backend_options_subtitles">
|
||||
<item />
|
||||
<item />
|
||||
<item>Use ExoPlayer for HDR playback</item>
|
||||
<item /><!-- Intentionally blank -->
|
||||
<item /><!-- Intentionally blank -->
|
||||
<item>@string/player_backend_options_subtitles_prefer_mpv</item>
|
||||
</string-array>
|
||||
|
||||
<string name="aspect_ratios_poster">Poster (2:3)</string>
|
||||
<string name="aspect_ratios_16_9">16:9</string>
|
||||
<string name="aspect_ratios_4_3">4:3</string>
|
||||
<string name="aspect_ratios_square">Square (1:1)</string>
|
||||
<string-array name="aspect_ratios">
|
||||
<item>Poster (2:3)</item>
|
||||
<item>16:9</item>
|
||||
<item>4:3</item>
|
||||
<item>Square (1:1)</item>
|
||||
<item>@string/aspect_ratios_poster</item>
|
||||
<item>@string/aspect_ratios_16_9</item>
|
||||
<item>@string/aspect_ratios_4_3</item>
|
||||
<item>@string/aspect_ratios_square</item>
|
||||
</string-array>
|
||||
|
||||
<string name="image_type_primary">Primary</string>
|
||||
<string name="image_type_thumb">Thumbary</string>
|
||||
<string-array name="image_types">
|
||||
<item>Primary</item>
|
||||
<item>Thumb</item>
|
||||
<item>@string/image_type_primary</item>
|
||||
<item>@string/image_type_thumb</item>
|
||||
<!-- <item>Banner</item>-->
|
||||
</string-array>
|
||||
|
||||
<string name="backdrop_style_dynamic">Image with dynamic color</string>
|
||||
<string name="backdrop_style_image">Image only</string>
|
||||
<string name="enter_url_api_key"><![CDATA[Enter URL & API Key]]></string>
|
||||
<string name="api_key">API Key</string>
|
||||
<string name="seerr_login">Login to Seerr server</string>
|
||||
<string name="seerr_jellyfin_user">Jellyfin user</string>
|
||||
<string name="seerr_local_user">Local user</string>
|
||||
<string name="search_and_download_subtitles"><![CDATA[Search & download subtitles]]></string>
|
||||
<string name="no_subtitles_found">No remote subtitles were found</string>
|
||||
<string name="series_continueing">Present</string>
|
||||
<string-array name="backdrop_style_options">
|
||||
<item>Image with dynamic color</item>
|
||||
<item>Image only</item>
|
||||
<item>None</item>
|
||||
<item>@string/backdrop_style_dynamic</item>
|
||||
<item>@string/backdrop_style_image</item>
|
||||
<item>@string/none</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue