From 5924a81337e8ed63cace79c74fb3b551e392fb22 Mon Sep 17 00:00:00 2001
From: Daocon <134820492+Daocon@users.noreply.github.com>
Date: Mon, 2 Dec 2024 15:32:58 +0700
Subject: [PATCH] =?UTF-8?q?feat(feat/language):=20=C4=91a=20ng=C3=B4n=20ng?=
=?UTF-8?q?=E1=BB=AF=20=E1=BB=9F=20m=C3=A0n=20h=E1=BB=8Dc?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../studies/component/StudyTopAppBar.kt | 8 ++--
.../studies/flip/FlipFlashCardScreen.kt | 18 +++----
.../flip/component/FlipFlashCardFinish.kt | 16 ++++---
.../studies/flip/component/StudyFlipCard.kt | 19 ++++----
.../studies/quiz/LearnByQuizScreen.kt | 10 ++--
.../quiz/component/QuizFlashCardFinish.kt | 38 +++++++++------
.../studies/quiz/component/QuizView.kt | 16 ++++++-
.../true_false/LearnByTrueFalseScreen.kt | 14 +++---
.../component/TrueFalseFlashcardFinish.kt | 35 ++++++++------
.../studies/write/LearnByWriteScreen.kt | 10 ++--
.../write/component/WriteFlashcardFinish.kt | 40 ++++++++++------
app/src/main/res/values-vi/strings.xml | 48 +++++++++++++++++++
app/src/main/res/values/strings.xml | 48 +++++++++++++++++++
13 files changed, 234 insertions(+), 86 deletions(-)
diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/component/StudyTopAppBar.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/component/StudyTopAppBar.kt
index e351ed15..3b72c4db 100644
--- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/component/StudyTopAppBar.kt
+++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/component/StudyTopAppBar.kt
@@ -11,8 +11,10 @@ import androidx.compose.material3.MaterialTheme.typography
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.PreviewLightDark
+import com.pwhs.quickmem.R
import com.pwhs.quickmem.ui.theme.QuickMemTheme
@OptIn(ExperimentalMaterial3Api::class)
@@ -30,7 +32,7 @@ fun StudyTopAppBar(
modifier = modifier,
title = {
Text(
- text = if (isEnOfSet) "Congratulations!" else "Card $currentCardIndex of $totalCards",
+ text = if (isEnOfSet) stringResource(R.string.txt_congratulations) else "Card $currentCardIndex of $totalCards",
style = typography.titleMedium.copy(
fontWeight = FontWeight.Bold,
)
@@ -42,7 +44,7 @@ fun StudyTopAppBar(
) {
Icon(
imageVector = Default.Clear,
- contentDescription = "Back"
+ contentDescription = stringResource(R.string.txt_back)
)
}
},
@@ -53,7 +55,7 @@ fun StudyTopAppBar(
) {
Icon(
imageVector = Default.RestartAlt,
- contentDescription = "Restart"
+ contentDescription = stringResource(R.string.txt_restart)
)
}
}
diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/FlipFlashCardScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/FlipFlashCardScreen.kt
index bf83f502..79622c60 100644
--- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/FlipFlashCardScreen.kt
+++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/FlipFlashCardScreen.kt
@@ -30,6 +30,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
@@ -41,6 +42,7 @@ import com.msusman.compose.cardstack.Duration
import com.msusman.compose.cardstack.SwipeDirection
import com.msusman.compose.cardstack.SwipeMethod
import com.msusman.compose.cardstack.rememberStackState
+import com.pwhs.quickmem.R
import com.pwhs.quickmem.domain.model.flashcard.FlashCardResponseModel
import com.pwhs.quickmem.presentation.app.study_set.component.StudyCardBottomSheet
import com.pwhs.quickmem.presentation.app.study_set.studies.flip.component.FlipFlashCardButton
@@ -162,9 +164,9 @@ fun FlipFlashCard(
val knownColor = Color(0xff18ae79)
val stackState = rememberStackState()
val suggestedText = listOf(
- "Tap the card to flip",
- "Swipe left to mark as known",
- "Swipe right to mark as still learning"
+ stringResource(R.string.txt_tap_the_card_to_flip),
+ stringResource(R.string.txt_swipe_left_to_mark_as_known),
+ stringResource(R.string.txt_swipe_right_to_mark_as_still_learning)
)
var currentTextIndex by remember { mutableIntStateOf(0) }
LaunchedEffect(Unit) {
@@ -370,7 +372,7 @@ fun FlipFlashCard(
showHintBottomSheet = true
},
studySetColor = studySetColor,
- title = "Show Hint"
+ title = stringResource(R.string.txt_show_hint)
)
}
@@ -380,13 +382,13 @@ fun FlipFlashCard(
showExplanationBottomSheet = true
},
studySetColor = studySetColor,
- title = "Show Explanation"
+ title = stringResource(R.string.txt_show_explanation)
)
}
}
FlipFlashCardIconButton(
knownColor = knownColor,
- contentDescription = "Swipe Right",
+ contentDescription = stringResource(R.string.txt_swipe_right),
imageVector = Icons.AutoMirrored.Filled.ArrowForwardIos,
onClick = {
stackState.swipe(Direction.Right)
@@ -405,7 +407,7 @@ fun FlipFlashCard(
StudyCardBottomSheet(
modifier = Modifier,
- title = "Hint",
+ title = stringResource(R.string.txt_hint),
contentText = flashCards.getOrNull(currentCardIndex)?.hint ?: "",
onDismiss = {
showHintBottomSheet = false
@@ -416,7 +418,7 @@ fun FlipFlashCard(
StudyCardBottomSheet(
modifier = Modifier,
- title = "Explanation",
+ title = stringResource(R.string.txt_explanation),
contentText = flashCards.getOrNull(currentCardIndex)?.explanation ?: "",
onDismiss = {
showExplanationBottomSheet = false
diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/component/FlipFlashCardFinish.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/component/FlipFlashCardFinish.kt
index 2fc29208..9007bed1 100644
--- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/component/FlipFlashCardFinish.kt
+++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/component/FlipFlashCardFinish.kt
@@ -24,6 +24,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontWeight
@@ -79,7 +80,7 @@ fun FlipFlashCardFinish(
) {
item {
Text(
- text = "You're doing great!",
+ text = stringResource(R.string.txt_you_re_doing_great_keep_it_up),
style = MaterialTheme.typography.titleLarge.copy(
fontWeight = FontWeight.Bold
)
@@ -98,7 +99,7 @@ fun FlipFlashCardFinish(
item {
Text(
- text = "Keep focusing on your study set to master it!",
+ text = stringResource(R.string.txt_keep_focusing_on_your_study_set_to_master_it),
style = MaterialTheme.typography.bodyMedium.copy(
fontWeight = FontWeight.Bold
),
@@ -131,7 +132,7 @@ fun FlipFlashCardFinish(
contentScale = ContentScale.Crop
)
Text(
- text = "Flashcards learned",
+ text = stringResource(R.string.txt_flashcards_learned),
style = MaterialTheme.typography.bodyMedium.copy(
fontSize = 18.sp
),
@@ -185,7 +186,7 @@ fun FlipFlashCardFinish(
contentDescription = "Time",
)
Text(
- text = "Learning Time",
+ text = stringResource(R.string.txt_learning_time),
style = MaterialTheme.typography.bodyMedium.copy(
fontSize = 18.sp
),
@@ -229,7 +230,10 @@ fun FlipFlashCardFinish(
border = BorderStroke(1.dp, studySetColor)
) {
Text(
- text = "Keep reviewing $countStillLearning terms",
+ text = stringResource(
+ R.string.txt_keep_reviewing_terms_flip,
+ countStillLearning
+ ),
style = MaterialTheme.typography.bodyMedium.copy(
fontSize = 18.sp,
fontWeight = FontWeight.Bold
@@ -255,7 +259,7 @@ fun FlipFlashCardFinish(
border = BorderStroke(1.dp, studySetColor)
) {
Text(
- text = "Restart Flashcards",
+ text = stringResource(R.string.txt_restart_flashcards),
style = MaterialTheme.typography.bodyMedium.copy(
fontSize = 18.sp,
fontWeight = FontWeight.Bold
diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/component/StudyFlipCard.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/component/StudyFlipCard.kt
index bd7f1d21..174c5dd4 100644
--- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/component/StudyFlipCard.kt
+++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/component/StudyFlipCard.kt
@@ -5,7 +5,6 @@ import androidx.compose.animation.core.FastOutSlowInEasing
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.tween
import androidx.compose.foundation.BorderStroke
-import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
@@ -30,11 +29,13 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.layout.ContentScale
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import coil.compose.AsyncImage
+import com.pwhs.quickmem.R
import com.pwhs.quickmem.domain.model.flashcard.FlashCardResponseModel
@Composable
@@ -126,7 +127,7 @@ fun StudyFlipFlashCard(
isShowingEffect -> when {
isSwipingLeft -> {
Text(
- text = "Still Learning",
+ text = stringResource(R.string.txt_still_learning),
style = typography.bodyLarge.copy(
fontSize = 20.sp,
color = stillLearningColor,
@@ -137,7 +138,7 @@ fun StudyFlipFlashCard(
isSwipingRight -> {
Text(
- text = "Known",
+ text = stringResource(R.string.txt_known),
style = typography.bodyLarge.copy(
fontSize = 20.sp,
color = knownColor,
@@ -195,7 +196,7 @@ fun StudyFlipFlashCard(
isShowingEffect -> when {
isSwipingLeft -> {
Text(
- text = "Still Learning",
+ text = stringResource(R.string.txt_still_learning),
style = typography.bodyLarge.copy(
fontSize = 20.sp,
color = stillLearningColor,
@@ -206,7 +207,7 @@ fun StudyFlipFlashCard(
isSwipingRight -> {
Text(
- text = "Known",
+ text = stringResource(R.string.txt_known),
style = typography.bodyLarge.copy(
fontSize = 20.sp,
color = knownColor,
@@ -291,7 +292,7 @@ fun StudyFlipFlashCard(
isShowingEffect -> when {
isSwipingLeft -> {
Text(
- text = "Still Learning",
+ text = stringResource(R.string.txt_still_learning),
style = typography.bodyLarge.copy(
fontSize = 18.sp,
color = stillLearningColor,
@@ -302,7 +303,7 @@ fun StudyFlipFlashCard(
isSwipingRight -> {
Text(
- text = "Known",
+ text = stringResource(R.string.txt_known),
style = typography.bodyLarge.copy(
fontSize = 18.sp,
color = knownColor,
@@ -360,7 +361,7 @@ fun StudyFlipFlashCard(
isShowingEffect -> when {
isSwipingLeft -> {
Text(
- text = "Still Learning",
+ text = stringResource(R.string.txt_still_learning),
style = typography.bodyLarge.copy(
fontSize = 18.sp,
color = stillLearningColor,
@@ -371,7 +372,7 @@ fun StudyFlipFlashCard(
isSwipingRight -> {
Text(
- text = "Known",
+ text = stringResource(R.string.txt_known),
style = typography.bodyLarge.copy(
fontSize = 18.sp,
color = knownColor,
diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/LearnByQuizScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/LearnByQuizScreen.kt
index 06f7b7ec..e5d33933 100644
--- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/LearnByQuizScreen.kt
+++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/LearnByQuizScreen.kt
@@ -35,10 +35,12 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
+import com.pwhs.quickmem.R
import com.pwhs.quickmem.core.data.enums.QuizStatus
import com.pwhs.quickmem.core.data.states.RandomAnswer
import com.pwhs.quickmem.core.data.states.WrongAnswer
@@ -147,10 +149,10 @@ fun LearnByQuiz(
CenterAlignedTopAppBar(
title = {
when (isLoading) {
- true -> Text("Loading")
+ true -> Text(stringResource(R.string.txt_loading))
false -> when (isEndOfList) {
false -> Text("${currentCardIndex + 1}/${flashCardList.size}")
- true -> Text("Finished")
+ true -> Text(stringResource(R.string.txt_finished))
}
}
},
@@ -160,7 +162,7 @@ fun LearnByQuiz(
) {
Icon(
imageVector = Default.Clear,
- contentDescription = "Back"
+ contentDescription = stringResource(R.string.txt_back),
)
}
},
@@ -294,7 +296,7 @@ fun LearnByQuiz(
.padding(16.dp)
) {
Text(
- text = "Hint",
+ text = stringResource(R.string.txt_hint),
style = MaterialTheme.typography.bodyMedium.copy(
fontWeight = FontWeight.Bold
)
diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/component/QuizFlashCardFinish.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/component/QuizFlashCardFinish.kt
index bdabed27..6bb57ad8 100644
--- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/component/QuizFlashCardFinish.kt
+++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/component/QuizFlashCardFinish.kt
@@ -32,6 +32,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontWeight
@@ -73,11 +74,11 @@ fun QuizFlashCardFinish(
isPlaying = isEndOfList,
)
val encouragementMessage = when {
- correctAnswerCount == 0 -> "Don't give up! Keep trying!"
- correctAnswerCount <= flashCardSize * 0.3 -> "Good start! Keep going!"
- correctAnswerCount <= flashCardSize * 0.6 -> "You're doing great! Keep it up!"
- correctAnswerCount < flashCardSize -> "Almost there! Keep pushing!"
- else -> "Excellent! You've mastered it!"
+ correctAnswerCount == 0 -> stringResource(R.string.txt_don_t_give_up_keep_trying)
+ correctAnswerCount <= flashCardSize * 0.3 -> stringResource(R.string.txt_good_start_keep_going)
+ correctAnswerCount <= flashCardSize * 0.6 -> stringResource(R.string.txt_you_re_doing_great_keep_it_up)
+ correctAnswerCount < flashCardSize -> stringResource(R.string.txt_almost_there_keep_pushing)
+ else -> stringResource(R.string.txt_excellent_you_ve_mastered_it)
}
var isImageViewerOpen by remember { mutableStateOf(false) }
var definitionImageUri by remember { mutableStateOf("") }
@@ -117,7 +118,7 @@ fun QuizFlashCardFinish(
)
Text(
- text = "Keep focusing on your study set to master it!",
+ text = stringResource(R.string.txt_keep_focusing_on_your_study_set_to_master_it),
style = MaterialTheme.typography.bodyMedium.copy(
fontWeight = FontWeight.Bold
),
@@ -147,7 +148,7 @@ fun QuizFlashCardFinish(
contentDescription = "Card",
)
Text(
- text = "Flashcards learned",
+ text = stringResource(R.string.txt_flashcards_learned),
style = MaterialTheme.typography.bodyMedium.copy(
fontSize = 18.sp
),
@@ -199,7 +200,7 @@ fun QuizFlashCardFinish(
contentDescription = "Time",
)
Text(
- text = "Learning Time",
+ text = stringResource(R.string.txt_learning_time),
style = MaterialTheme.typography.bodyMedium.copy(
fontSize = 18.sp
),
@@ -239,7 +240,10 @@ fun QuizFlashCardFinish(
border = BorderStroke(1.dp, studySetColor)
) {
Text(
- text = "Finish $wrongAnswerCount answers now",
+ text = stringResource(
+ R.string.txt_finish_answers_now,
+ wrongAnswerCount
+ ),
style = MaterialTheme.typography.bodyMedium.copy(
fontSize = 18.sp,
fontWeight = FontWeight.Bold
@@ -263,7 +267,7 @@ fun QuizFlashCardFinish(
border = BorderStroke(1.dp, studySetColor)
) {
Text(
- text = "Learn from the beginning",
+ text = stringResource(R.string.txt_learn_from_the_beginning),
style = MaterialTheme.typography.bodyMedium.copy(
fontSize = 18.sp,
fontWeight = FontWeight.Bold
@@ -276,7 +280,7 @@ fun QuizFlashCardFinish(
if (wrongAnswerCount < 0) {
item {
Text(
- text = "Review your wrong answers",
+ text = stringResource(R.string.txt_review_your_wrong_answers),
style = MaterialTheme.typography.titleLarge.copy(
fontWeight = FontWeight.Bold
),
@@ -300,7 +304,10 @@ fun QuizFlashCardFinish(
horizontalArrangement = Arrangement.spacedBy(8.dp),
) {
Text(
- text = "Term: ${it.flashCard.term}",
+ text = stringResource(
+ R.string.txt_term_flashcard,
+ it.flashCard.term
+ ),
style = MaterialTheme.typography.bodyLarge.copy(
fontWeight = FontWeight.Bold
),
@@ -321,7 +328,10 @@ fun QuizFlashCardFinish(
}
}
Text(
- text = "Correct Answer: ${it.flashCard.definition}",
+ text = stringResource(
+ R.string.txt_correct_answer,
+ it.flashCard.definition
+ ),
style = MaterialTheme.typography.bodyMedium.copy(
color = correctColor
)
@@ -330,7 +340,7 @@ fun QuizFlashCardFinish(
modifier = Modifier.padding(vertical = 8.dp)
)
Text(
- text = "Your Answer: ${it.userAnswer}",
+ text = stringResource(R.string.txt_your_answer, it.userAnswer),
style = MaterialTheme.typography.bodyMedium.copy(
color = incorrectColor
)
diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/component/QuizView.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/component/QuizView.kt
index 9748b2be..e5af172e 100644
--- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/component/QuizView.kt
+++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/component/QuizView.kt
@@ -18,9 +18,11 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
+import com.pwhs.quickmem.R
import com.pwhs.quickmem.core.data.enums.QuizStatus
import com.pwhs.quickmem.core.data.states.RandomAnswer
import com.pwhs.quickmem.domain.model.flashcard.FlashCardResponseModel
@@ -38,8 +40,18 @@ fun QuizView(
var isSelectCorrectAnswer by remember { mutableStateOf(false) }
var selectedAnswer by remember { mutableStateOf("") }
var feedbackMessage by remember { mutableStateOf("Select an answer") }
- val correctMessages = listOf("Great job!", "Well done!", "Correct!", "Nice work!")
- val incorrectMessages = listOf("Try again!", "Incorrect!", "Not quite!", "Keep trying!")
+ val correctMessages = listOf(
+ stringResource(R.string.txt_great_job),
+ stringResource(R.string.txt_well_done),
+ stringResource(R.string.txt_correct),
+ stringResource(R.string.txt_nice_work)
+ )
+ val incorrectMessages = listOf(
+ stringResource(R.string.txt_try_again),
+ stringResource(R.string.txt_incorrect),
+ stringResource(R.string.txt_not_quite),
+ stringResource(R.string.txt_keep_trying)
+ )
LaunchedEffect(key1 = canResetState) {
selectedAnswer = ""
feedbackMessage = "Select an answer"
diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/LearnByTrueFalseScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/LearnByTrueFalseScreen.kt
index 9dbd88ed..b5cdf4ab 100644
--- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/LearnByTrueFalseScreen.kt
+++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/LearnByTrueFalseScreen.kt
@@ -40,11 +40,13 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.hilt.navigation.compose.hiltViewModel
import coil.compose.AsyncImage
+import com.pwhs.quickmem.R
import com.pwhs.quickmem.domain.model.flashcard.FlashCardResponseModel
import com.pwhs.quickmem.presentation.app.study_set.studies.true_false.component.TrueFalseButton
import com.pwhs.quickmem.presentation.app.study_set.studies.true_false.component.TrueFalseFlashcardFinish
@@ -136,10 +138,10 @@ fun LearnByTrueFalse(
CenterAlignedTopAppBar(
title = {
when (isLoading) {
- true -> Text("Loading")
+ true -> Text(stringResource(R.string.txt_loading))
false -> when (isEndOfList) {
false -> Text("${currentCardIndex + 1}/${flashCardList.size}")
- true -> Text("Finished")
+ true -> Text(stringResource(R.string.txt_finished))
}
}
},
@@ -149,7 +151,7 @@ fun LearnByTrueFalse(
) {
Icon(
imageVector = Default.Clear,
- contentDescription = "Back"
+ contentDescription = stringResource(R.string.txt_back),
)
}
},
@@ -201,7 +203,7 @@ fun LearnByTrueFalse(
) {
item {
Text(
- text = "Choose True or False",
+ text = stringResource(R.string.txt_choose_true_or_false),
style = MaterialTheme.typography.titleMedium.copy(
color = studySetColor
),
@@ -303,7 +305,7 @@ fun LearnByTrueFalse(
horizontalArrangement = Arrangement.SpaceEvenly
) {
TrueFalseButton(
- title = "True",
+ title = stringResource(R.string.txt_true),
onClick = {
if (randomQuestion?.isRandom == true) {
onAnswer(false, randomQuestion.id)
@@ -316,7 +318,7 @@ fun LearnByTrueFalse(
)
Spacer(modifier = Modifier.padding(horizontal = 8.dp))
TrueFalseButton(
- title = "False",
+ title = stringResource(R.string.txt_false),
onClick = {
if (randomQuestion?.isRandom == true) {
onAnswer(true, randomQuestion.id)
diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/component/TrueFalseFlashcardFinish.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/component/TrueFalseFlashcardFinish.kt
index 8059fd02..f26e58ed 100644
--- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/component/TrueFalseFlashcardFinish.kt
+++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/component/TrueFalseFlashcardFinish.kt
@@ -32,6 +32,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontWeight
@@ -73,11 +74,11 @@ fun TrueFalseFlashcardFinish(
isPlaying = isEndOfList,
)
val encouragementMessage = when {
- correctAnswerCount == 0 -> "Don't give up! Keep trying!"
- correctAnswerCount <= flashCardSize * 0.3 -> "Good start! Keep going!"
- correctAnswerCount <= flashCardSize * 0.6 -> "You're doing great! Keep it up!"
- correctAnswerCount < flashCardSize -> "Almost there! Keep pushing!"
- else -> "Excellent! You've mastered it!"
+ correctAnswerCount == 0 -> stringResource(R.string.txt_don_t_give_up_keep_trying)
+ correctAnswerCount <= flashCardSize * 0.3 -> stringResource(R.string.txt_good_start_keep_going)
+ correctAnswerCount <= flashCardSize * 0.6 -> stringResource(R.string.txt_you_re_doing_great_keep_it_up)
+ correctAnswerCount < flashCardSize -> stringResource(R.string.txt_almost_there_keep_pushing)
+ else -> stringResource(R.string.txt_excellent_you_ve_mastered_it)
}
var isImageViewerOpen by remember { mutableStateOf(false) }
var definitionImageUri by remember { mutableStateOf("") }
@@ -117,7 +118,7 @@ fun TrueFalseFlashcardFinish(
)
Text(
- text = "Keep focusing on your study set to master it!",
+ text = stringResource(R.string.txt_keep_focusing_on_your_study_set_to_master_it),
style = MaterialTheme.typography.bodyMedium.copy(
fontWeight = FontWeight.Bold
),
@@ -148,7 +149,7 @@ fun TrueFalseFlashcardFinish(
contentDescription = "Card",
)
Text(
- text = "Flashcards learned",
+ text = stringResource(R.string.txt_flashcards_learned),
style = MaterialTheme.typography.bodyMedium.copy(
fontSize = 18.sp
),
@@ -200,7 +201,7 @@ fun TrueFalseFlashcardFinish(
contentDescription = "Time",
)
Text(
- text = "Learning Time",
+ text = stringResource(R.string.txt_learning_time),
style = MaterialTheme.typography.bodyMedium.copy(
fontSize = 18.sp
),
@@ -240,7 +241,7 @@ fun TrueFalseFlashcardFinish(
border = BorderStroke(1.dp, studySetColor)
) {
Text(
- text = "Finish $wrongAnswerCount answers now",
+ text = stringResource(R.string.txt_finish_answers_now),
style = MaterialTheme.typography.bodyMedium.copy(
fontSize = 18.sp,
fontWeight = FontWeight.Bold
@@ -264,7 +265,7 @@ fun TrueFalseFlashcardFinish(
border = BorderStroke(1.dp, studySetColor)
) {
Text(
- text = "Learn from the beginning",
+ text = stringResource(R.string.txt_learn_from_the_beginning),
style = MaterialTheme.typography.bodyMedium.copy(
fontSize = 18.sp,
fontWeight = FontWeight.Bold
@@ -277,7 +278,7 @@ fun TrueFalseFlashcardFinish(
if (wrongAnswerCount < 0) {
item {
Text(
- text = "Review your wrong answers",
+ text = stringResource(R.string.txt_review_your_wrong_answers),
style = MaterialTheme.typography.titleLarge.copy(
fontWeight = FontWeight.Bold
),
@@ -301,7 +302,7 @@ fun TrueFalseFlashcardFinish(
horizontalArrangement = Arrangement.spacedBy(8.dp),
) {
Text(
- text = "Term: ${it.term}",
+ text = stringResource(R.string.txt_term_write, it.term),
style = MaterialTheme.typography.bodyLarge.copy(
fontWeight = FontWeight.Bold
),
@@ -322,7 +323,10 @@ fun TrueFalseFlashcardFinish(
}
}
Text(
- text = "Correct Answer: ${it.originalDefinition}",
+ text = stringResource(
+ R.string.txt_correct_answers,
+ it.originalDefinition
+ ),
style = MaterialTheme.typography.bodyMedium.copy(
color = correctColor
)
@@ -331,7 +335,10 @@ fun TrueFalseFlashcardFinish(
modifier = Modifier.padding(vertical = 8.dp)
)
Text(
- text = "Your Answer: ${it.definition}",
+ text = stringResource(
+ R.string.txt_your_answers,
+ it.definition
+ ),
style = MaterialTheme.typography.bodyMedium.copy(
color = incorrectColor
)
diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/LearnByWriteScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/LearnByWriteScreen.kt
index c129e810..af62abd9 100644
--- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/LearnByWriteScreen.kt
+++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/LearnByWriteScreen.kt
@@ -163,10 +163,10 @@ fun LearnByWrite(
CenterAlignedTopAppBar(
title = {
when (isLoading) {
- true -> Text(text = "Loading")
+ true -> Text(stringResource(R.string.txt_loading))
false -> when (isEndOfList) {
false -> Text("${currentCardIndex + 1}/${flashCardList.size}")
- true -> Text(text = "Finished")
+ true -> Text(stringResource(R.string.txt_finished))
}
}
},
@@ -301,7 +301,7 @@ fun LearnByWrite(
),
placeholder = {
Text(
- text = "Enter your answer",
+ text = stringResource(R.string.txt_enter_your_answer),
style = MaterialTheme.typography.bodyMedium.copy(
fontWeight = FontWeight.Bold
)
@@ -322,7 +322,7 @@ fun LearnByWrite(
}
) {
Text(
- text = "Don't know",
+ text = stringResource(R.string.txt_don_t_know),
style = MaterialTheme.typography.bodyMedium.copy(
color = studySetColor,
fontWeight = FontWeight.Bold
@@ -421,7 +421,7 @@ fun LearnByWrite(
.padding(16.dp)
) {
Text(
- text = "Hint",
+ text = stringResource(R.string.txt_hint),
style = MaterialTheme.typography.bodyMedium.copy(
fontWeight = FontWeight.Bold
)
diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/component/WriteFlashcardFinish.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/component/WriteFlashcardFinish.kt
index c9cc355e..f109f050 100644
--- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/component/WriteFlashcardFinish.kt
+++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/component/WriteFlashcardFinish.kt
@@ -32,6 +32,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontWeight
@@ -73,11 +74,11 @@ fun WriteFlashcardFinish(
isPlaying = isEndOfList,
)
val encouragementMessage = when {
- correctAnswerCount == 0 -> "Don't give up! Keep trying!"
- correctAnswerCount <= flashCardSize * 0.3 -> "Good start! Keep going!"
- correctAnswerCount <= flashCardSize * 0.6 -> "You're doing great! Keep it up!"
- correctAnswerCount < flashCardSize -> "Almost there! Keep pushing!"
- else -> "Excellent! You've mastered it!"
+ correctAnswerCount == 0 -> stringResource(R.string.txt_don_t_give_up_keep_trying)
+ correctAnswerCount <= flashCardSize * 0.3 -> stringResource(R.string.txt_good_start_keep_going)
+ correctAnswerCount <= flashCardSize * 0.6 -> stringResource(R.string.txt_you_re_doing_great_keep_it_up)
+ correctAnswerCount < flashCardSize -> stringResource(R.string.txt_almost_there_keep_pushing)
+ else -> stringResource(R.string.txt_excellent_you_ve_mastered_it)
}
var isImageViewerOpen by remember { mutableStateOf(false) }
var definitionImageUri by remember { mutableStateOf("") }
@@ -117,7 +118,7 @@ fun WriteFlashcardFinish(
)
Text(
- text = "Keep focusing on your study set to master it!",
+ text = stringResource(R.string.txt_keep_focusing_on_your_study_set_to_master_it),
style = MaterialTheme.typography.bodyMedium.copy(
fontWeight = FontWeight.Bold
),
@@ -147,7 +148,7 @@ fun WriteFlashcardFinish(
contentDescription = "Card",
)
Text(
- text = "Flashcards learned",
+ text = stringResource(R.string.txt_flashcards_learned),
style = MaterialTheme.typography.bodyMedium.copy(
fontSize = 18.sp
),
@@ -199,7 +200,7 @@ fun WriteFlashcardFinish(
contentDescription = "Time",
)
Text(
- text = "Learning Time",
+ text = stringResource(R.string.txt_learning_time),
style = MaterialTheme.typography.bodyMedium.copy(
fontSize = 18.sp
),
@@ -239,7 +240,10 @@ fun WriteFlashcardFinish(
border = BorderStroke(1.dp, studySetColor)
) {
Text(
- text = "Finish $wrongAnswerCount answers now",
+ text = stringResource(
+ R.string.txt_finish_answers_now,
+ wrongAnswerCount
+ ),
style = MaterialTheme.typography.bodyMedium.copy(
fontSize = 18.sp,
fontWeight = FontWeight.Bold
@@ -263,7 +267,7 @@ fun WriteFlashcardFinish(
border = BorderStroke(1.dp, studySetColor)
) {
Text(
- text = "Learn from the beginning",
+ text = stringResource(R.string.txt_learn_from_the_beginning),
style = MaterialTheme.typography.bodyMedium.copy(
fontSize = 18.sp,
fontWeight = FontWeight.Bold
@@ -276,7 +280,7 @@ fun WriteFlashcardFinish(
if (wrongAnswerCount < 0) {
item {
Text(
- text = "Review your wrong answers",
+ text = stringResource(R.string.txt_review_your_wrong_answers),
style = MaterialTheme.typography.titleLarge.copy(
fontWeight = FontWeight.Bold
),
@@ -300,7 +304,7 @@ fun WriteFlashcardFinish(
horizontalArrangement = Arrangement.spacedBy(8.dp),
) {
Text(
- text = "Term: ${it.term}",
+ text = stringResource(R.string.txt_term_write, it.term),
style = MaterialTheme.typography.bodyLarge.copy(
fontWeight = FontWeight.Bold
),
@@ -321,7 +325,10 @@ fun WriteFlashcardFinish(
}
}
Text(
- text = "Correct Answer: ${it.definition}",
+ text = stringResource(
+ R.string.txt_correct_answer_definition,
+ it.definition
+ ),
style = MaterialTheme.typography.bodyMedium.copy(
color = correctColor
)
@@ -331,14 +338,17 @@ fun WriteFlashcardFinish(
)
if (it.userAnswer.isNotEmpty()) {
Text(
- text = "Your Answer: ${it.userAnswer}",
+ text = stringResource(
+ R.string.txt_your_answer_userAnswer,
+ it.userAnswer
+ ),
style = MaterialTheme.typography.bodyMedium.copy(
color = incorrectColor
)
)
} else {
Text(
- text = "You skipped this question",
+ text = stringResource(R.string.txt_you_skipped_this_question),
style = MaterialTheme.typography.bodyMedium.copy(
color = incorrectColor
)
diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml
index d42604ad..1a486f00 100644
--- a/app/src/main/res/values-vi/strings.xml
+++ b/app/src/main/res/values-vi/strings.xml
@@ -371,4 +371,52 @@
Đã chỉnh sửa vào %1$s
Đã tạo vào %1$s
Sắp ra mắt
+ Chúc mừng!
+ Bạn đang làm rất tốt!
+ Tiếp tục tập trung vào bộ học của bạn để thành thạo nó!
+ Thẻ
+ Flashcards đã học
+ Thời gian
+ Thời gian học
+ Tiếp tục ôn lại %1$s thuật ngữ
+ Khởi động lại Flashcards
+ Đã biết
+ Nhấn vào thẻ để lật
+ Vuốt sang trái để đánh dấu là đã biết
+ Vuốt sang phải để đánh dấu là vẫn đang học
+ Hiển thị gợi ý
+ Hiển thị giải thích
+ Vuốt sang phải
+ Đừng bỏ cuộc! Hãy tiếp tục cố gắng!
+ Khởi đầu tốt! Tiếp tục đi!
+ Bạn đang làm rất tốt! Hãy duy trì nhé!
+ Sắp tới đích rồi! Hãy cố lên!
+ Xuất sắc! Bạn đã thành thạo nó!
+ Học lại từ đầu
+ Xem lại câu trả lời sai
+ Câu trả lời đúng: %1$s
+ Câu trả lời của bạn: %1$s
+ Làm tốt lắm!
+ Làm tốt lắm!
+ Chính xác!
+ Tốt lắm!
+ Thử lại!
+ Sai rồi!
+ Chưa hẳn!
+ Tiếp tục cố gắng!
+ Hoàn thành
+ Chọn Đúng hoặc Sai
+ Đúng
+ Sai
+ Hoàn thành %1$s câu trả lời ngay
+ Câu trả lời đúng: %1$s
+ Câu trả lời của bạn: %1$s
+ Câu trả lời đúng: %1$s
+ Câu trả lời của bạn: %1$s
+ Bạn đã bỏ qua câu hỏi này
+ Thuật ngữ: %1$s
+ Thuật ngữ: %1$s
+ Tiếp tục ôn lại %1$s thuật ngữ
+ Không biết
+ Nhập câu trả lời của bạn
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index eb16740d..20471fae 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -374,4 +374,52 @@
Modified %1$s
Created %1$s
Coming soon
+ Congratulations!
+ You\'re doing great!
+ Keep focusing on your study set to master it!
+ Card
+ Flashcards learned
+ Time
+ Learning Time
+ Keep reviewing %1$s terms
+ Restart Flashcards
+ Known
+ Tap the card to flip
+ Swipe left to mark as known
+ Swipe right to mark as still learning
+ Show Hint
+ Show Explanation
+ Swipe Right
+ Don\'t give up! Keep trying!
+ Good start! Keep going!
+ You\'re doing great! Keep it up!
+ Almost there! Keep pushing!
+ Excellent! You\'ve mastered it!
+ Learn from the beginning
+ Review your wrong answers
+ Correct Answer: %1$s
+ Your Answer: %1$s
+ Great job!
+ Well done!
+ Correct!
+ Nice work!
+ Try again!
+ Incorrect!
+ Not quite!
+ Keep trying!
+ Finished
+ Choose True or False
+ True
+ False
+ Finish %1$s answers now
+ Correct Answer: %1$s
+ Your Answer: %1$s
+ Correct Answer: %1$s
+ Your Answer: %1$s
+ You skipped this question
+ Term: %1$s
+ Term: %1$s
+ Keep reviewing %1$s terms
+ Don\'t know
+ Enter your answer
\ No newline at end of file