From 02b1cf005cf3e1df64183d20ba42930eb2767a9f Mon Sep 17 00:00:00 2001 From: dujinkim Date: Thu, 21 Aug 2025 06:57:36 +0000 Subject: (대표님, 최겸) 설계메뉴추가, 작업사항 업데이트 설계메뉴 - 문서관리 설계메뉴 - 벤더 데이터 gtc 메뉴 업데이트 정보시스템 - 메뉴리스트 및 정보 업데이트 파일 라우트 업데이트 엑셀임포트 개선 기본계약 개선 벤더 가입과정 변경 및 개선 벤더 기본정보 - pq 돌체 오류 수정 및 개선 벤더 로그인 과정 이메일 오류 수정 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/notice/notice-client.tsx | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) (limited to 'components/notice/notice-client.tsx') diff --git a/components/notice/notice-client.tsx b/components/notice/notice-client.tsx index e32a40c9..e5c05d84 100644 --- a/components/notice/notice-client.tsx +++ b/components/notice/notice-client.tsx @@ -1,6 +1,8 @@ "use client" import { useState, useEffect, useTransition } from "react" +import { useParams } from "next/navigation" +import { useTranslation } from "@/i18n/client" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { @@ -55,6 +57,25 @@ type SortField = "title" | "pagePath" | "createdAt" type SortDirection = "asc" | "desc" export function NoticeClient({ initialData = [], currentUserId }: NoticeClientProps) { + const params = useParams() + const lng = (params?.lng as string) || 'ko' + const { t } = useTranslation(lng, 'menu') + + // 안전한 번역 함수 (키가 없을 때 원본 키 반환) + const safeTranslate = (key: string): string => { + try { + const translated = t(key) + // 번역 키가 그대로 반환되는 경우 원본 키 사용 + if (translated === key) { + return key + } + return translated || key + } catch (error) { + console.warn(`Translation failed for key: ${key}`, error) + return key + } + } + const [notices, setNotices] = useState(initialData) const [loading, setLoading] = useState(false) const [searchQuery, setSearchQuery] = useState("") @@ -172,7 +193,7 @@ export function NoticeClient({ initialData = [], currentUserId }: NoticeClientPr const paths = await getPagePathList() const options = paths.map(path => ({ value: path.pagePath, - label: `${path.pageName} (${path.pagePath})` + label: path.pageName // i18n 키를 그대로 저장 (화면에서 번역) })) setPagePathOptions(options) } catch (error) { @@ -325,9 +346,17 @@ export function NoticeClient({ initialData = [], currentUserId }: NoticeClientPr - - {notice.pagePath} - +
+
+ {notice.pagePath} +
+
+ {(() => { + const pageOption = pagePathOptions.find(opt => opt.value === notice.pagePath) + return pageOption ? safeTranslate(pageOption.label) : notice.pagePath + })()} +
+
-- cgit v1.2.3