언어선택 UI 반영 및 언어 CSV 변환 Gradle Task 추가#524
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a localization framework that uses a Python script to generate Android string resources from a central CSV file, adding support for English, Japanese, and Vietnamese. It also includes a new EatSsuRadioCheckBox component and updates the language selection screen. The reviewer identified several improvement opportunities, including the removal of dead code, enabling the Vietnamese language enum, and translating remaining Korean strings in the English resource file. Furthermore, the feedback suggests adhering to Compose best practices by incorporating modifier parameters and optimizing list rendering for small datasets.
| // Text( | ||
| // text = stringResource(R.string.language_select_description), | ||
| // style = EatssuTheme.typography.body2, | ||
| // modifier = Modifier.padding(vertical = 20.dp) | ||
| // ) |
| KOREAN("ko", "Korean", "한국어"), | ||
| ENGLISH("en", "English", "English"), // 다국어 재활성화 시 주석 해제 | ||
| JAPANESE("ja", "Japanese", "日本語"); // 다국어 재활성화 시 주석 해제 | ||
| // CHINESE("zh", "Chinese", "中文"), // 다국어 재활성화 시 주석 해제 | ||
| // VIETNAMESE("vi", "Vietnamese", "Tiếng Việt"); // 다국어 재활성화 시 주석 해제 |
There was a problem hiding this comment.
values-vi/strings.xml 파일이 추가되었음에도 불구하고 VIETNAMESE 항목이 여전히 주석 처리되어 있습니다. 베트남어 지원을 의도하신 것이라면 주석을 해제하고 세미콜론 위치를 조정해야 합니다.
| KOREAN("ko", "Korean", "한국어"), | |
| ENGLISH("en", "English", "English"), // 다국어 재활성화 시 주석 해제 | |
| JAPANESE("ja", "Japanese", "日本語"); // 다국어 재활성화 시 주석 해제 | |
| // CHINESE("zh", "Chinese", "中文"), // 다국어 재활성화 시 주석 해제 | |
| // VIETNAMESE("vi", "Vietnamese", "Tiếng Việt"); // 다국어 재활성화 시 주석 해제 | |
| KOREAN("ko", "Korean", "한국어"), | |
| ENGLISH("en", "English", "English"), | |
| JAPANESE("ja", "Japanese", "日本語"), | |
| VIETNAMESE("vi", "Vietnamese", "Tiếng Việt"); | |
| // CHINESE("zh", "Chinese", "中文"), // 다국어 재활성화 시 주석 해제 |
| <string name="mypage_push_activity_section_title">알림 및 활동</string> | ||
| <string name="mypage_service_section_title">서비스 정보</string> | ||
| <string name="mypage_etc_section_title">기타</string> |
| fun EatSsuRadioCheckBox( | ||
| text: String, | ||
| isSelected: Boolean, | ||
| onSelect: () -> Unit | ||
| ) { | ||
|
|
||
| Row( | ||
| modifier = Modifier | ||
| .fillMaxWidth() | ||
| .clickable { onSelect() } | ||
| .padding(15.dp), | ||
| verticalAlignment = Alignment.CenterVertically | ||
| ) { | ||
| Text( | ||
| text = text, | ||
| color = MaterialTheme.colorScheme.onSurface, | ||
| style = com.eatssu.design_system.theme.EatssuTheme.typography.body2 | ||
| ) | ||
|
|
||
| Spacer(Modifier.weight(1f)) | ||
| if (!isSelected) { | ||
| Box( | ||
| modifier = Modifier | ||
| .size(18.dp) | ||
| .border(width = 2.dp, shape = CircleShape, color = Gray400) | ||
| ) | ||
| } else { | ||
| Box( | ||
| modifier = Modifier | ||
| .size(18.dp) | ||
| .border(width = 5.dp, shape = CircleShape, color = CheckedColor) | ||
| ) | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Compose 컴포넌트의 관례에 따라 외부에서 스타일이나 레이아웃을 조정할 수 있도록 modifier 파라미터를 추가하는 것이 좋습니다.
fun EatSsuRadioCheckBox(
text: String,
isSelected: Boolean,
onSelect: () -> Unit,
modifier: Modifier = Modifier
) {
Row(
modifier = modifier
.fillMaxWidth()
.clickable { onSelect() }
.padding(15.dp),
verticalAlignment = Alignment.CenterVertically
) {
Text(
text = text,
color = MaterialTheme.colorScheme.onSurface,
style = com.eatssu.design_system.theme.EatssuTheme.typography.body2
)
Spacer(Modifier.weight(1f))
if (!isSelected) {
Box(
modifier = Modifier
.size(18.dp)
.border(width = 2.dp, shape = CircleShape, color = Gray400)
)
} else {
Box(
modifier = Modifier
.size(18.dp)
.border(width = 5.dp, shape = CircleShape, color = CheckedColor)
)
}
}
}| fun EatSsuRadioCheckBoxGroup( | ||
| options: List<String>, | ||
| selectedOption: String, | ||
| onOptionSelected: (String) -> Unit | ||
| ) { | ||
| LazyColumn(modifier = Modifier.fillMaxWidth()) { | ||
| items(options, key = { it }) { option -> | ||
| val isSelected = option == selectedOption | ||
| EatSsuRadioCheckBox( | ||
| text = option, | ||
| isSelected = isSelected, | ||
| onSelect = { onOptionSelected(option) } | ||
| ) | ||
| Spacer(modifier = Modifier.height(8.dp)) | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
언어 목록과 같이 아이템 개수가 적고 고정된 경우에는 LazyColumn 대신 일반 Column을 사용하는 것이 권장됩니다. 이는 불필요한 성능 오버헤드를 줄이고, 부모 레이아웃이 스크롤 가능한 경우 발생할 수 있는 중첩 스크롤 문제를 방지할 수 있습니다.
| fun EatSsuRadioCheckBoxGroup( | |
| options: List<String>, | |
| selectedOption: String, | |
| onOptionSelected: (String) -> Unit | |
| ) { | |
| LazyColumn(modifier = Modifier.fillMaxWidth()) { | |
| items(options, key = { it }) { option -> | |
| val isSelected = option == selectedOption | |
| EatSsuRadioCheckBox( | |
| text = option, | |
| isSelected = isSelected, | |
| onSelect = { onOptionSelected(option) } | |
| ) | |
| Spacer(modifier = Modifier.height(8.dp)) | |
| } | |
| } | |
| } | |
| fun EatSsuRadioCheckBoxGroup( | |
| options: List<String>, | |
| selectedOption: String, | |
| onOptionSelected: (String) -> Unit, | |
| modifier: Modifier = Modifier | |
| ) { | |
| Column(modifier = modifier.fillMaxWidth()) { | |
| options.forEach { option -> | |
| val isSelected = option == selectedOption | |
| EatSsuRadioCheckBox( | |
| text = option, | |
| isSelected = isSelected, | |
| onSelect = { onOptionSelected(option) } | |
| ) | |
| Spacer(modifier = Modifier.height(8.dp)) | |
| } | |
| } | |
| } |
Summary
저번 마이페이지 작업에서 반영하지 못한 언어선택 UI를 Figma에 맞게 수정하고, 하나의 CSV 파일을 언어별 strings.xml로 자동으로 변환할 수 있도록 Gradle Task에 추가했습니다.
Describe your changes
이후, 생성된 언어의 strings.xml과 맞는 언어 정보를 AppLanguage에 추가하면 마이페이지에서 확인 가능합니다
각 strings.xml 생성 방식은 원본 strings.xml(한국어)를 기준으로 합니다. 만약 csv에 없거나 매칭되지 않는 string에 대해서는 원본 한국어가 들어갑니다.
Issue
To reviewers
이미 EatSsuRadioButton 네이밍이 있었어서 얘도 똑같은 RadioButton인데 EatSsuRadioCheckBox(Group)라는 이름이 되버렸습니다..