Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

Extracted hardcoded string resources. Added some Spanish translations. #960

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import it.vfsfitvnm.compose.persist.persist
import it.vfsfitvnm.vimusic.Database
import it.vfsfitvnm.vimusic.LocalPlayerAwareWindowInsets
Expand Down Expand Up @@ -81,7 +82,7 @@ fun ArtistLocalSongs(
Column(horizontalAlignment = Alignment.CenterHorizontally) {
headerContent {
SecondaryTextButton(
text = "Enqueue",
text = stringResource(R.string.Enqueue),
enabled = !songs.isNullOrEmpty(),
onClick = {
binder?.player?.enqueue(songs!!.map(Song::asMediaItem))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import androidx.compose.foundation.verticalScroll
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import it.vfsfitvnm.innertube.Innertube
Expand Down Expand Up @@ -103,7 +104,7 @@ fun ArtistOverview(
headerContent {
youtubeArtistPage?.shuffleEndpoint?.let { endpoint ->
SecondaryTextButton(
text = "Shuffle",
text = stringResource(R.string.Shuffle),
onClick = {
binder?.stopRadio()
binder?.playRadio(endpoint)
Expand All @@ -125,14 +126,14 @@ fun ArtistOverview(
.padding(endPaddingValues)
) {
BasicText(
text = "Songs",
text = stringResource(R.string.Songs),
style = typography.m.semiBold,
modifier = sectionTextModifier
)

youtubeArtistPage.songsEndpoint?.let {
BasicText(
text = "View all",
text = stringResource(R.string.ViewAll),
style = typography.xs.secondary,
modifier = sectionTextModifier
.clickable(onClick = onViewAllSongsClick),
Expand Down Expand Up @@ -178,14 +179,14 @@ fun ArtistOverview(
.padding(endPaddingValues)
) {
BasicText(
text = "Albums",
text = stringResource(R.string.Albums),
style = typography.m.semiBold,
modifier = sectionTextModifier
)

youtubeArtistPage.albumsEndpoint?.let {
BasicText(
text = "View all",
text = stringResource(R.string.ViewAll),
style = typography.xs.secondary,
modifier = sectionTextModifier
.clickable(onClick = onViewAllAlbumsClick),
Expand Down Expand Up @@ -223,14 +224,14 @@ fun ArtistOverview(
.padding(endPaddingValues)
) {
BasicText(
text = "Singles",
text = stringResource(R.string.Singles),
style = typography.m.semiBold,
modifier = sectionTextModifier
)

youtubeArtistPage.singlesEndpoint?.let {
BasicText(
text = "View all",
text = stringResource(R.string.ViewAll),
style = typography.xs.secondary,
modifier = sectionTextModifier
.clickable(onClick = onViewAllSinglesClick),
Expand Down Expand Up @@ -299,7 +300,7 @@ fun ArtistOverview(

if (attributionsIndex != -1) {
BasicText(
text = "From Wikipedia under Creative Commons Attribution CC-BY-SA 3.0",
text = stringResource(R.string.FromWikipediaAttribution),
style = typography.xxs.color(colorPalette.textDisabled).align(TextAlign.End),
modifier = Modifier
.padding(horizontal = 16.dp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import androidx.compose.runtime.setValue
import androidx.compose.runtime.snapshotFlow
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.valentinilk.shimmer.shimmer
import it.vfsfitvnm.compose.persist.PersistMapCleanup
Expand Down Expand Up @@ -123,7 +124,7 @@ fun ArtistScreen(browseId: String) {
val (colorPalette) = LocalAppearance.current
val context = LocalContext.current

Header(title = artist?.name ?: "Unknown") {
Header(title = artist?.name ?: stringResource(R.string.HeaderUnknown)) {
textButton?.invoke()

Spacer(
Expand Down Expand Up @@ -176,11 +177,11 @@ fun ArtistScreen(browseId: String) {
tabIndex = tabIndex,
onTabChanged = { tabIndex = it },
tabColumnContent = { Item ->
Item(0, "Overview", R.drawable.sparkles)
Item(1, "Songs", R.drawable.musical_notes)
Item(2, "Albums", R.drawable.disc)
Item(3, "Singles", R.drawable.disc)
Item(4, "Library", R.drawable.library)
Item(0, stringResource(R.string.ScaffoldOverview), R.drawable.sparkles)
Item(1, stringResource(R.string.Songs), R.drawable.musical_notes)
Item(2, stringResource(R.string.Albums), R.drawable.disc)
Item(3, stringResource(R.string.ScaffoldSingles), R.drawable.disc)
Item(4, stringResource(R.string.ScaffoldLibrary), R.drawable.library)
},
) { currentTabIndex ->
saveableStateHolder.SaveableStateProvider(key = currentTabIndex) {
Expand Down Expand Up @@ -267,7 +268,7 @@ fun ArtistScreen(browseId: String) {
ItemsPage(
tag = "artist/$browseId/albums",
headerContent = headerContent,
emptyItemsText = "This artist didn't release any album",
emptyItemsText = stringResource(R.string.EmptyReleases),
itemsPageProvider = artistPage?.let {
({ continuation ->
continuation?.let {
Expand Down Expand Up @@ -317,7 +318,7 @@ fun ArtistScreen(browseId: String) {
ItemsPage(
tag = "artist/$browseId/singles",
headerContent = headerContent,
emptyItemsText = "This artist didn't release any single",
emptyItemsText = stringResource(R.string.EmptyReleases),
itemsPageProvider = artistPage?.let {
({ continuation ->
continuation?.let {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.saveable.rememberSaveableStateHolder
import androidx.compose.ui.res.stringResource
import it.vfsfitvnm.compose.persist.PersistMapCleanup
import it.vfsfitvnm.compose.routing.RouteHandler
import it.vfsfitvnm.vimusic.R
Expand Down Expand Up @@ -38,8 +39,8 @@ fun BuiltInPlaylistScreen(builtInPlaylist: BuiltInPlaylist) {
tabIndex = tabIndex,
onTabChanged = onTabIndexChanged,
tabColumnContent = { Item ->
Item(0, "Favorites", R.drawable.heart)
Item(1, "Offline", R.drawable.airplane)
Item(0, stringResource(R.string.ScaffoldFavorites), R.drawable.heart)
Item(1, stringResource(R.string.ScaffoldOffline), R.drawable.airplane)
}
) { currentTabIndex ->
saveableStateHolder.SaveableStateProvider(key = currentTabIndex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import it.vfsfitvnm.compose.persist.persistList
import it.vfsfitvnm.vimusic.Database
Expand Down Expand Up @@ -94,14 +95,14 @@ fun BuiltInPlaylistSongs(builtInPlaylist: BuiltInPlaylist) {
) {
Header(
title = when (builtInPlaylist) {
BuiltInPlaylist.Favorites -> "Favorites"
BuiltInPlaylist.Offline -> "Offline"
BuiltInPlaylist.Favorites -> stringResource(R.string.BuiltInPlaylistFavorites)
BuiltInPlaylist.Offline -> stringResource(R.string.BuiltInPlaylistOffline)
},
modifier = Modifier
.padding(bottom = 8.dp)
) {
SecondaryTextButton(
text = "Enqueue",
text = stringResource(R.string.Enqueue),
enabled = songs.isNotEmpty(),
onClick = {
binder?.player?.enqueue(songs.map(Song::asMediaItem))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import it.vfsfitvnm.compose.persist.persist
import it.vfsfitvnm.vimusic.Database
Expand Down Expand Up @@ -85,7 +86,7 @@ fun HomeAlbums(
key = "header",
contentType = 0
) {
Header(title = "Albums") {
Header(title = stringResource(R.string.AlbumsHeader)) {
HeaderIconButton(
icon = R.drawable.calendar,
color = if (sortBy == AlbumSortBy.Year) colorPalette.text else colorPalette.textDisabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import it.vfsfitvnm.compose.persist.persistList
import it.vfsfitvnm.vimusic.Database
Expand Down Expand Up @@ -94,7 +95,7 @@ fun HomeArtistList(
contentType = 0,
span = { GridItemSpan(maxLineSpan) }
) {
Header(title = "Artists") {
Header(title = stringResource(R.string.ArtistsHeader)) {
HeaderIconButton(
icon = R.drawable.text,
color = if (sortBy == ArtistSortBy.Name) colorPalette.text else colorPalette.textDisabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import it.vfsfitvnm.compose.persist.persistList
import it.vfsfitvnm.vimusic.Database
Expand Down Expand Up @@ -69,7 +70,7 @@ fun HomePlaylists(

if (isCreatingANewPlaylist) {
TextFieldDialog(
hintText = "Enter the playlist name",
hintText = stringResource(R.string.PlaylistNameHint),
onDismiss = {
isCreatingANewPlaylist = false
},
Expand Down Expand Up @@ -116,9 +117,9 @@ fun HomePlaylists(
.background(colorPalette.background0)
) {
item(key = "header", contentType = 0, span = { GridItemSpan(maxLineSpan) }) {
Header(title = "Playlists") {
Header(title = stringResource(R.string.PlaylistsHeader)) {
SecondaryTextButton(
text = "New playlist",
text = stringResource(R.string.NewPlaylist),
onClick = { isCreatingANewPlaylist = true }
)

Expand Down Expand Up @@ -164,7 +165,7 @@ fun HomePlaylists(
PlaylistItem(
icon = R.drawable.heart,
colorTint = colorPalette.red,
name = "Favorites",
name = stringResource(R.string.Favorites),
songCount = null,
thumbnailSizeDp = thumbnailSizeDp,
alternative = true,
Expand All @@ -178,7 +179,7 @@ fun HomePlaylists(
PlaylistItem(
icon = R.drawable.airplane,
colorTint = colorPalette.blue,
name = "Offline",
name = stringResource(R.string.Offline),
songCount = null,
thumbnailSizeDp = thumbnailSizeDp,
alternative = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.runtime.Composable
import androidx.compose.runtime.saveable.rememberSaveableStateHolder
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import it.vfsfitvnm.compose.persist.PersistMapCleanup
import it.vfsfitvnm.compose.routing.RouteHandler
import it.vfsfitvnm.compose.routing.defaultStacking
Expand Down Expand Up @@ -69,7 +70,7 @@ fun HomeScreen(onPlaylistUrl: (String) -> Unit) {

localPlaylistRoute { playlistId ->
LocalPlaylistScreen(
playlistId = playlistId ?: error("playlistId cannot be null")
playlistId = playlistId ?: error(stringResource(R.string.PlaylistIdNullError))
)
}

Expand Down Expand Up @@ -119,11 +120,11 @@ fun HomeScreen(onPlaylistUrl: (String) -> Unit) {
tabIndex = tabIndex,
onTabChanged = onTabChanged,
tabColumnContent = { Item ->
Item(0, "Quick picks", R.drawable.sparkles)
Item(1, "Songs", R.drawable.musical_notes)
Item(2, "Playlists", R.drawable.playlist)
Item(3, "Artists", R.drawable.person)
Item(4, "Albums", R.drawable.disc)
Item(0, stringResource(R.string.ScaffoldQuickPicks), R.drawable.sparkles)
Item(1, stringResource(R.string.ScaffoldSongs), R.drawable.musical_notes)
Item(2, stringResource(R.string.ScaffoldPlaylists), R.drawable.playlist)
Item(3, stringResource(R.string.ScaffoldArtists), R.drawable.person)
Item(4, stringResource(R.string.ScaffoldAlbums), R.drawable.disc)
}
) { currentTabIndex ->
saveableStateHolder.SaveableStateProvider(key = currentTabIndex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import it.vfsfitvnm.compose.persist.persistList
Expand Down Expand Up @@ -102,7 +103,7 @@ fun HomeSongs(
key = "header",
contentType = 0
) {
Header(title = "Songs") {
Header(title = stringResource(R.string.SongsHeader)) {
HeaderIconButton(
icon = R.drawable.trending,
color = if (sortBy == SongSortBy.PlayTime) colorPalette.text else colorPalette.textDisabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import it.vfsfitvnm.compose.persist.persist
import it.vfsfitvnm.innertube.Innertube
Expand Down Expand Up @@ -152,7 +153,7 @@ fun QuickPicks(
)
) {
Header(
title = "Quick picks",
title = stringResource(R.string.QuickPicksHeader),
modifier = Modifier
.padding(endPaddingValues)
)
Expand Down Expand Up @@ -248,7 +249,7 @@ fun QuickPicks(

related.albums?.let { albums ->
BasicText(
text = "Related albums",
text = stringResource(R.string.RelatedAlbums),
style = typography.m.semiBold,
modifier = sectionTextModifier
)
Expand All @@ -272,7 +273,7 @@ fun QuickPicks(

related.artists?.let { artists ->
BasicText(
text = "Similar artists",
text = stringResource(R.string.SimilarArtists),
style = typography.m.semiBold,
modifier = sectionTextModifier
)
Expand All @@ -296,7 +297,7 @@ fun QuickPicks(

related.playlists?.let { playlists ->
BasicText(
text = "Playlists you might like",
text = stringResource(R.string.PlaylistsMightLike),
style = typography.m.semiBold,
modifier = Modifier
.padding(horizontal = 16.dp)
Expand All @@ -323,7 +324,7 @@ fun QuickPicks(
Unit
} ?: relatedPageResult?.exceptionOrNull()?.let {
BasicText(
text = "An error has occurred",
text = stringResource(R.string.OcurredError),
style = typography.s.secondary.center,
modifier = Modifier
.align(Alignment.CenterHorizontally)
Expand Down
Loading