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",
|
"title": "Notifications",
|
||||||
"all": "All",
|
"all": "All",
|
||||||
"retentionNotice": "※ Notifications are kept for 90 days and then deleted.",
|
"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": {
|
"faceAuth": {
|
||||||
"title": "Face Authentication"
|
"title": "Face Authentication"
|
||||||
|
|||||||
@@ -1278,7 +1278,16 @@
|
|||||||
"title": "알림함",
|
"title": "알림함",
|
||||||
"all": "전체",
|
"all": "전체",
|
||||||
"retentionNotice": "※ 알림은 90일간 보관 후 삭제됩니다.",
|
"retentionNotice": "※ 알림은 90일간 보관 후 삭제됩니다.",
|
||||||
"goTo": "{{category}} 바로가기"
|
"goTo": "{{category}} 바로가기",
|
||||||
|
"categories": {
|
||||||
|
"benefits": "혜택/이벤트",
|
||||||
|
"notice": "공지사항",
|
||||||
|
"serviceGuide": "서비스안내",
|
||||||
|
"etc": "기타",
|
||||||
|
"settlement": "정산",
|
||||||
|
"settlementStatus": "정산 현황",
|
||||||
|
"settlementLimit": "정산 한도"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"faceAuth": {
|
"faceAuth": {
|
||||||
"title": "안면인증"
|
"title": "안면인증"
|
||||||
|
|||||||
@@ -20,11 +20,32 @@ export const ListPage = () => {
|
|||||||
|
|
||||||
const [appNotificationCategory, setAppNotificationCategory] = useState<string>('');
|
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 = () => {
|
const resetAlarmCategories = () => {
|
||||||
if(appNotificationCategories){
|
if(appNotificationCategories){
|
||||||
let newAppNotificationCategories = appNotificationCategories.filter((value, index) => {
|
let newAppNotificationCategories = appNotificationCategories.filter((value, index) => {
|
||||||
return value.code1 !== '****' && value.code2 === '*';
|
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)
|
console.log(newAppNotificationCategories)
|
||||||
setAppNotificationCategories(newAppNotificationCategories);
|
setAppNotificationCategories(newAppNotificationCategories);
|
||||||
}
|
}
|
||||||
@@ -34,6 +55,10 @@ export const ListPage = () => {
|
|||||||
resetAlarmCategories();
|
resetAlarmCategories();
|
||||||
}, [totalAppNotificationCategories])
|
}, [totalAppNotificationCategories])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
console.log('totalAppNotificationCategories', totalAppNotificationCategories);
|
||||||
|
}, [totalAppNotificationCategories]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<main className="pop">
|
<main className="pop">
|
||||||
@@ -46,9 +71,10 @@ export const ListPage = () => {
|
|||||||
{ !!appNotificationCategories &&
|
{ !!appNotificationCategories &&
|
||||||
appNotificationCategories.map((value, index) => (
|
appNotificationCategories.map((value, index) => (
|
||||||
<button
|
<button
|
||||||
|
key={index}
|
||||||
className={ `tab36 ${(appNotificationCategory === value.code1)? 'on': ''}`}
|
className={ `tab36 ${(appNotificationCategory === value.code1)? 'on': ''}`}
|
||||||
onClick={ () => setAppNotificationCategory(value.code1) }
|
onClick={ () => setAppNotificationCategory(value.code1) }
|
||||||
>{ value.desc1 }</button>
|
>{ getCategoryLabel(value.code1) }</button>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user