Skip to content

Commit

Permalink
🌐 added localized strings
Browse files Browse the repository at this point in the history
  • Loading branch information
schachi5000 committed Sep 22, 2024
1 parent 82c32ed commit 8efff9d
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
version = "1.3">
<BuildAction>
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForRunning = "YES">
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7555FF7A242A565900829871"
Expand All @@ -15,11 +21,25 @@
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7555FF7A242A565900829871"
Expand All @@ -29,4 +49,18 @@
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
4 changes: 3 additions & 1 deletion shared/src/commonMain/composeResources/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
<string name="app_name">MCC</string>
<string name="database">Database</string>
<string name="delete">Delete</string>
<string name="decks">Decks</string>
<string name="my_decks">My Decks</string>
<string name="cards">Cards</string>
<string name="spotlight">Spotlight</string>
<string name="search">Search</string>
<string name="more">More</string>
<string name="settings">Settings</string>
<string name="create_new_deck">Create new deck</string>
<string name="login_with_marvelcdb">Login with MarvelCDB</string>
<string name="login_as_guest">Continue as Guest</string>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package net.schacher.mcc.shared.design.compose

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.Row
Expand All @@ -22,22 +21,6 @@ import androidx.compose.ui.draw.blur
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.times


// TODO Needs better name
@Composable
fun FreeBottomSheetContainer(modifier: Modifier = Modifier, content: @Composable () -> Unit) {
Box(modifier = modifier) {
content()

Column(
modifier = Modifier.fillMaxWidth()
) {
Spacer(Modifier.height(8.dp))
BottomSheetHandle()
}
}
}

@Composable
fun BottomSheetContainer(modifier: Modifier = Modifier, content: @Composable () -> Unit) {
Column(
Expand All @@ -54,7 +37,7 @@ fun BottomSheetContainer(modifier: Modifier = Modifier, content: @Composable ()
}

@Composable
fun ColumnScope.BottomSheetHandle() {
private fun ColumnScope.BottomSheetHandle() {
Row(
modifier = Modifier.size(40.dp, 4.dp)
.background(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.shape.RoundedCornerShape
Expand Down Expand Up @@ -42,10 +43,14 @@ import net.schacher.mcc.shared.model.CardType
fun CardScreen(modifier: Modifier = Modifier, card: Card, onCloseClick: () -> Unit) {
Logger.i { card.toString() }

Box(modifier = modifier) {
Box(
modifier = modifier
.statusBarsPadding()
.background(MaterialTheme.colors.background)
) {
Card(
modifier = Modifier.fillMaxWidth()
.blur(0.5.dp)
.blur(20.dp)
.graphicsLayer { translationY = getTranslationY(card).toPx() },
card = card
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.foundation.pager.HorizontalPager
import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Scaffold
import androidx.compose.material.SnackbarHost
Expand All @@ -25,6 +24,11 @@ import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import kotlinx.coroutines.launch
import marvelchampionscompanion.shared.generated.resources.Res
import marvelchampionscompanion.shared.generated.resources.cards
import marvelchampionscompanion.shared.generated.resources.my_decks
import marvelchampionscompanion.shared.generated.resources.settings
import marvelchampionscompanion.shared.generated.resources.spotlight
import net.schacher.mcc.shared.design.compose.Animation
import net.schacher.mcc.shared.design.compose.BackHandler
import net.schacher.mcc.shared.design.compose.PagerHeader
Expand All @@ -50,12 +54,14 @@ import net.schacher.mcc.shared.screens.search.SearchScreen
import net.schacher.mcc.shared.screens.settings.SettingsScreen
import net.schacher.mcc.shared.screens.spotlight.SpotlightScreen
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.stringResource
import org.koin.compose.koinInject

internal val topInset = ContentPadding + 72.dp

@OptIn(
ExperimentalMaterialApi::class, ExperimentalResourceApi::class, ExperimentalFoundationApi::class
ExperimentalResourceApi::class,
ExperimentalFoundationApi::class
)
@Composable
fun MainScreen(viewModel: MainViewModel = koinInject()) {
Expand Down Expand Up @@ -111,7 +117,7 @@ fun MainScreen(viewModel: MainViewModel = koinInject()) {
.padding(
top = ContentPadding, bottom = ContentPadding + 16.dp
),
pageLabels = pageLabels.map { it.localizedLabel },
pageLabels = pageLabels.map { it.label },
pagerState = pagerState,
) {
scope.launch {
Expand Down Expand Up @@ -178,10 +184,11 @@ private val MainScreen.tabIndex: Int
Settings -> 3
}

private val MainScreen.localizedLabel: String
private val MainScreen.label: String
@Composable
get() = when (this) {
MyDecks -> "Meine Decks"
Spotlight -> "Spotlight"
Cards -> "Cards"
Settings -> "Einstellungen"
Spotlight -> stringResource(Res.string.spotlight)
MyDecks -> stringResource(Res.string.my_decks)
Cards -> stringResource(Res.string.cards)
Settings -> stringResource(Res.string.settings)
}

0 comments on commit 8efff9d

Please sign in to comment.