-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(language): đa ngôn ngữ ở màn học #87
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -149,10 +151,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)) | ||
} | ||
Comment on lines
+154
to
158
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Cần đồng bộ việc sử dụng stringResource Phát hiện việc sử dụng không nhất quán của stringResource. Trong khi loading và finished text đã được localize, text hiển thị số thứ tự "${currentCardIndex + 1}/${flashCardList.size}" vẫn đang hardcode. Đề xuất sửa như sau: true -> Text(stringResource(R.string.txt_loading))
false -> when (isEndOfList) {
- false -> Text("${currentCardIndex + 1}/${flashCardList.size}")
+ false -> Text(
+ text = stringResource(
+ R.string.txt_progress_format,
+ currentCardIndex + 1,
+ flashCardList.size
+ )
+ )
true -> Text(stringResource(R.string.txt_finished))
}
|
||
} | ||
}, | ||
|
@@ -168,7 +170,7 @@ fun LearnByQuiz( | |
) { | ||
Icon( | ||
imageVector = Default.Clear, | ||
contentDescription = "Back" | ||
contentDescription = stringResource(R.string.txt_back), | ||
) | ||
} | ||
}, | ||
|
@@ -302,7 +304,7 @@ fun LearnByQuiz( | |
.padding(16.dp) | ||
) { | ||
Text( | ||
text = "Hint", | ||
text = stringResource(R.string.txt_hint), | ||
style = MaterialTheme.typography.bodyMedium.copy( | ||
fontWeight = FontWeight.Bold | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thêm kiểm tra null safety cho hint
Hiện tại chỉ kiểm tra
isNotEmpty()
mà chưa kiểm tra null, có thể gây ra NullPointerException.