Add localization for alarm notification categories
- Add translation keys for alarm categories in ko.json and en.json - Implement getCategoryLabel function to map category codes to localized labels - Sort categories to display "etc" category at the end - Replace hardcoded desc1 values with localized category labels 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1301,7 +1301,16 @@
|
||||
"title": "Notifications",
|
||||
"all": "All",
|
||||
"retentionNotice": "※ Notifications are kept for 90 days and then deleted.",
|
||||
"goTo": "Go to {{category}}"
|
||||
"goTo": "Go to {{category}}",
|
||||
"categories": {
|
||||
"benefits": "Benefits/Events",
|
||||
"notice": "Notice",
|
||||
"serviceGuide": "Service Guide",
|
||||
"etc": "Others",
|
||||
"settlement": "Settlement",
|
||||
"settlementStatus": "Settlement Status",
|
||||
"settlementLimit": "Settlement Limit"
|
||||
}
|
||||
},
|
||||
"faceAuth": {
|
||||
"title": "Face Authentication"
|
||||
|
||||
@@ -1278,7 +1278,16 @@
|
||||
"title": "알림함",
|
||||
"all": "전체",
|
||||
"retentionNotice": "※ 알림은 90일간 보관 후 삭제됩니다.",
|
||||
"goTo": "{{category}} 바로가기"
|
||||
"goTo": "{{category}} 바로가기",
|
||||
"categories": {
|
||||
"benefits": "혜택/이벤트",
|
||||
"notice": "공지사항",
|
||||
"serviceGuide": "서비스안내",
|
||||
"etc": "기타",
|
||||
"settlement": "정산",
|
||||
"settlementStatus": "정산 현황",
|
||||
"settlementLimit": "정산 한도"
|
||||
}
|
||||
},
|
||||
"faceAuth": {
|
||||
"title": "안면인증"
|
||||
|
||||
@@ -20,11 +20,32 @@ export const ListPage = () => {
|
||||
|
||||
const [appNotificationCategory, setAppNotificationCategory] = useState<string>('');
|
||||
|
||||
const getCategoryLabel = (code1: string) => {
|
||||
const categoryMap: { [key: string]: string } = {
|
||||
'10': t('alarm.categories.benefits'),
|
||||
'20': t('alarm.categories.notice'),
|
||||
'30': t('alarm.categories.serviceGuide'),
|
||||
'40': t('alarm.categories.etc'),
|
||||
'60': t('alarm.categories.settlement'),
|
||||
'61': t('alarm.categories.settlementStatus'),
|
||||
'62': t('alarm.categories.settlementLimit')
|
||||
};
|
||||
return categoryMap[code1] || '';
|
||||
};
|
||||
|
||||
const resetAlarmCategories = () => {
|
||||
if(appNotificationCategories){
|
||||
let newAppNotificationCategories = appNotificationCategories.filter((value, index) => {
|
||||
return value.code1 !== '****' && value.code2 === '*';
|
||||
});
|
||||
|
||||
// '기타' 카테고리(code1 === '40')를 맨 마지막으로 이동
|
||||
newAppNotificationCategories.sort((a, b) => {
|
||||
if (a.code1 === '40') return 1;
|
||||
if (b.code1 === '40') return -1;
|
||||
return 0;
|
||||
});
|
||||
|
||||
console.log(newAppNotificationCategories)
|
||||
setAppNotificationCategories(newAppNotificationCategories);
|
||||
}
|
||||
@@ -33,6 +54,10 @@ export const ListPage = () => {
|
||||
useEffect(() => {
|
||||
resetAlarmCategories();
|
||||
}, [totalAppNotificationCategories])
|
||||
|
||||
useEffect(() => {
|
||||
console.log('totalAppNotificationCategories', totalAppNotificationCategories);
|
||||
}, [totalAppNotificationCategories]);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -45,10 +70,11 @@ export const ListPage = () => {
|
||||
>{t('alarm.all')}</button>
|
||||
{ !!appNotificationCategories &&
|
||||
appNotificationCategories.map((value, index) => (
|
||||
<button
|
||||
<button
|
||||
key={index}
|
||||
className={ `tab36 ${(appNotificationCategory === value.code1)? 'on': ''}`}
|
||||
onClick={ () => setAppNotificationCategory(value.code1) }
|
||||
>{ value.desc1 }</button>
|
||||
>{ getCategoryLabel(value.code1) }</button>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user