Skip to content

Commit

Permalink
feat(language): đa ngôn ngữ tại folder
Browse files Browse the repository at this point in the history
  • Loading branch information
VawnDao committed Nov 28, 2024
1 parent aa2b602 commit 1d57a33
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.ui.Modifier
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.hilt.navigation.compose.hiltViewModel
Expand All @@ -28,6 +29,7 @@ import com.ramcosta.composedestinations.annotation.RootGraph
import com.ramcosta.composedestinations.generated.destinations.CreateStudySetScreenDestination
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
import com.ramcosta.composedestinations.result.ResultBackNavigator
import com.pwhs.quickmem.R

@Destination<RootGraph>(
navArgs = AddStudySetToFolderArgs::class
Expand Down Expand Up @@ -103,7 +105,7 @@ fun AddStudySetToFolder(
AddStudySetToFolderTopAppBar(
onDoneClick = onDoneClick,
onNavigateCancel = onNavigateCancel,
title = "Add Study Set"
title = stringResource(id = R.string.txt_add_study_set)
)
},
floatingActionButton = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ import androidx.compose.ui.Alignment.Companion.CenterHorizontally
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
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.tooling.preview.Preview
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.color.ColorModel
import com.pwhs.quickmem.domain.model.study_set.GetStudySetResponseModel
import com.pwhs.quickmem.domain.model.subject.SubjectModel
Expand Down Expand Up @@ -87,7 +89,7 @@ fun AddStudySetToFolderList(
color = colorScheme.onSurface.copy(alpha = 0.1f),
)
Text(
text = "There are no owned study sets, create one to get started!",
text = stringResource(id = R.string.txt_there_are_no_owned_study_sets_create_one_to_get_started),
textAlign = TextAlign.Center,
style = typography.bodyMedium.copy(
color = colorScheme.onSurface.copy(alpha = 0.6f),
Expand All @@ -107,7 +109,7 @@ fun AddStudySetToFolderList(
SearchTextField(
searchQuery = searchQuery,
onSearchQueryChange = { searchQuery = it },
placeholder = "Search study sets"
placeholder = stringResource(id = R.string.txt_search_study_sets),
)

}
Expand All @@ -120,7 +122,7 @@ fun AddStudySetToFolderList(
horizontalAlignment = CenterHorizontally
) {
Text(
text = "No study set fold found",
text = stringResource(id = R.string.txt_no_study_set_fold_found),
style = typography.bodyLarge,
textAlign = TextAlign.Center
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
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.sp
import com.pwhs.quickmem.ui.theme.QuickMemTheme
import com.pwhs.quickmem.R

@OptIn(ExperimentalMaterial3Api::class)
@Composable
Expand Down Expand Up @@ -50,7 +52,7 @@ fun AddStudySetToFolderTopAppBar(
)
) {
Text(
text = "Done",
text = stringResource(id = R.string.txt_done),
style = typography.titleMedium.copy(
fontWeight = FontWeight.Bold,
color = colorScheme.onSurface,
Expand All @@ -67,7 +69,7 @@ fun AddStudySetToFolderTopAppBar(
)
) {
Text(
text = "Cancel",
text = stringResource(id = R.string.txt_cancel),
style = typography.titleMedium.copy(
fontWeight = FontWeight.Bold,
color = colorScheme.onSurface,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
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.hilt.navigation.compose.hiltViewModel
import com.pwhs.quickmem.R
import com.pwhs.quickmem.presentation.component.CreateTextField
import com.pwhs.quickmem.presentation.component.CreateTopAppBar
import com.pwhs.quickmem.presentation.component.LoadingOverlay
Expand Down Expand Up @@ -93,7 +95,7 @@ fun CreateFolder(
CreateTopAppBar(
onNavigateBack = onNavigateBack,
onDoneClick = onDoneClick,
title = "Create new folder"
title = stringResource(id = R.string.txt_create_folder)
)
}
) { innerPadding ->
Expand All @@ -105,20 +107,20 @@ fun CreateFolder(
) {
CreateTextField(
value = title,
title = "Folder Title",
title = stringResource(id = R.string.txt_folder_title),
valueError = titleError,
onValueChange = onTitleChange,
placeholder = "Enter Folder Title"
placeholder = stringResource(id = R.string.txt_enter_folder_title)
)
CreateTextField(
value = description,
title = "Description (Optional)",
title = stringResource(id = R.string.txt_description_optional),
valueError = descriptionError,
onValueChange = onDescriptionChange,
placeholder = "Enter Description"
placeholder = stringResource(id = R.string.txt_enter_description)
)
SwitchContainer(
text = "When you make a folder public, anyone can see it and use it.",
text = stringResource(R.string.txt_when_you_make_a_folder_public_anyone_can_see_it_and_use_it),
checked = isPublic,
onCheckedChange = onIsPublicChange
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
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.hilt.navigation.compose.hiltViewModel
import com.pwhs.quickmem.R
import com.pwhs.quickmem.presentation.component.CreateTextField
import com.pwhs.quickmem.presentation.component.CreateTopAppBar
import com.pwhs.quickmem.presentation.component.LoadingOverlay
Expand Down Expand Up @@ -93,7 +95,7 @@ fun EditFolder(
CreateTopAppBar(
onNavigateBack = onNavigateBack,
onDoneClick = onDoneClick,
title = "Edit folder"
title = stringResource(R.string.txt_edit_folder)
)
}
) { innerPadding ->
Expand All @@ -105,20 +107,20 @@ fun EditFolder(
) {
CreateTextField(
value = title,
title = "Folder Title",
title = stringResource(R.string.txt_folder_title),
valueError = titleError,
onValueChange = onTitleChange,
placeholder = "Enter Folder Title"
placeholder = stringResource(R.string.txt_enter_folder_title)
)
CreateTextField(
value = description,
title = "Description (Optional)",
title = stringResource(R.string.txt_description_optional),
valueError = descriptionError,
onValueChange = onDescriptionChange,
placeholder = "Enter Description"
placeholder = stringResource(R.string.txt_enter_description )
)
SwitchContainer(
text = "When you make a folder public, anyone can see it and use it.",
text = stringResource(R.string.txt_when_you_make_a_folder_public_anyone_can_see_it_and_use_it),
checked = isPublic,
onCheckedChange = onIsPublicChange
)
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-vi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -343,4 +343,5 @@
<string name="txt_draw">Vẽ</string>
<string name="txt_cancel_and_back">Hủy và quay lại</string>
<string name="txt_stroke_width">Độ rộng nét vẽ</string>
<string name="txt_when_you_make_a_folder_public_anyone_can_see_it_and_use_it">Khi bạn công khai một thư mục, bất kỳ ai cũng có thể xem và sử dụng nó.</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -346,4 +346,5 @@
<string name="txt_draw">Draw</string>
<string name="txt_cancel_and_back">Cancel and back</string>
<string name="txt_stroke_width">Stroke Width</string>
<string name="txt_when_you_make_a_folder_public_anyone_can_see_it_and_use_it">When you make a folder public, anyone can see it and use it.</string>
</resources>

0 comments on commit 1d57a33

Please sign in to comment.