Extract strings into resources (#151)

Move all strings into resource files to make future translating easier

No user facing changes in this PR
This commit is contained in:
damontecres 2025-11-03 15:38:12 -05:00 committed by GitHub
parent 40267be633
commit 2840fa3f2a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
52 changed files with 616 additions and 306 deletions

View file

@ -1,16 +1,8 @@
package com.github.damontecres.wholphin.util
import com.github.damontecres.wholphin.ui.main.HomeSection
import org.jellyfin.sdk.model.api.BaseItemKind
import org.jellyfin.sdk.model.api.CollectionType
val supportedHomeSection =
setOf(
HomeSection.LATEST_MEDIA,
HomeSection.NEXT_UP,
HomeSection.RESUME,
)
val supportItemKinds =
setOf(
BaseItemKind.MOVIE,

View file

@ -48,7 +48,7 @@ class CrashReportSender : ReportSender {
val api =
createJellyfin {
this.context = context
clientInfo = AppModule.clientInfo()
clientInfo = AppModule.clientInfo(context)
deviceInfo = AppModule.deviceInfo(context)
apiClientFactory = okHttpFactory
socketConnectionFactory = okHttpFactory

View file

@ -1,6 +1,7 @@
package com.github.damontecres.wholphin.util
import android.os.Build
import androidx.annotation.StringRes
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import com.github.damontecres.wholphin.R
@ -11,6 +12,7 @@ import com.github.damontecres.wholphin.data.model.chooseStream
import com.github.damontecres.wholphin.preferences.UserPreferences
import com.github.damontecres.wholphin.ui.isNotNullOrBlank
import org.jellyfin.sdk.model.api.BaseItemDto
import org.jellyfin.sdk.model.api.MediaSegmentType
import org.jellyfin.sdk.model.api.MediaStream
import org.jellyfin.sdk.model.api.MediaStreamType
import java.time.LocalDate
@ -164,3 +166,15 @@ fun formatBytes(
}
return String.format(Locale.getDefault(), "%.2f%s", count, suffixes[unit])
}
@get:StringRes
val MediaSegmentType.stringRes: Int
get() =
when (this) {
MediaSegmentType.UNKNOWN -> R.string.unknown
MediaSegmentType.COMMERCIAL -> R.string.commercial
MediaSegmentType.PREVIEW -> R.string.preview
MediaSegmentType.RECAP -> R.string.recap
MediaSegmentType.OUTRO -> R.string.outro
MediaSegmentType.INTRO -> R.string.intro
}