From 6d13b5099bb4597629f465b1ef33730d96c24da5 Mon Sep 17 00:00:00 2001 From: Jay Sheen Date: Tue, 4 Nov 2025 10:00:41 +0900 Subject: [PATCH] Add localization for alarm notification categories MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- src/locales/en.json | 11 ++++++++++- src/locales/ko.json | 11 ++++++++++- src/pages/alarm/list/list-page.tsx | 30 ++++++++++++++++++++++++++++-- 3 files changed, 48 insertions(+), 4 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index 473ebba..36f1693 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -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" diff --git a/src/locales/ko.json b/src/locales/ko.json index d3b1ab0..186a22a 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -1278,7 +1278,16 @@ "title": "์•Œ๋ฆผํ•จ", "all": "์ „์ฒด", "retentionNotice": "โ€ป ์•Œ๋ฆผ์€ 90์ผ๊ฐ„ ๋ณด๊ด€ ํ›„ ์‚ญ์ œ๋ฉ๋‹ˆ๋‹ค.", - "goTo": "{{category}} ๋ฐ”๋กœ๊ฐ€๊ธฐ" + "goTo": "{{category}} ๋ฐ”๋กœ๊ฐ€๊ธฐ", + "categories": { + "benefits": "ํ˜œํƒ/์ด๋ฒคํŠธ", + "notice": "๊ณต์ง€์‚ฌํ•ญ", + "serviceGuide": "์„œ๋น„์Šค์•ˆ๋‚ด", + "etc": "๊ธฐํƒ€", + "settlement": "์ •์‚ฐ", + "settlementStatus": "์ •์‚ฐ ํ˜„ํ™ฉ", + "settlementLimit": "์ •์‚ฐ ํ•œ๋„" + } }, "faceAuth": { "title": "์•ˆ๋ฉด์ธ์ฆ" diff --git a/src/pages/alarm/list/list-page.tsx b/src/pages/alarm/list/list-page.tsx index a115720..cf06a78 100644 --- a/src/pages/alarm/list/list-page.tsx +++ b/src/pages/alarm/list/list-page.tsx @@ -20,11 +20,32 @@ export const ListPage = () => { const [appNotificationCategory, setAppNotificationCategory] = useState(''); + 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')} { !!appNotificationCategories && appNotificationCategories.map((value, index) => ( - + >{ getCategoryLabel(value.code1) } )) }