o2o-infinith-demo/supporters/src/lib/i18n.ts
Haewon Kam f01bc6cafc merge: feature/supporters-autobuild + feature/ai-sentiment-rubric 를 Product 1.0 한 줄기로 합침
Product 1.0 범위는 진단 + 서포터즈 초안(haewon 결정).

브랜치 확인 결과 핸드오버 §1 의 미확인 항목 두 건은 이미 해결 상태였다.
리드 CTA(DiscoveryLeadModal·discovery_leads 마이그레이션)와 AEO/GEO v2 기준표는
셋 다 main 에 있고 blob 이 동일하다. feature/discovery-url-cta 는 main 대비
ahead 0 / behind 22 인 낡은 포인터라 머지 대상에서 뺐다.

supporters/ 정본은 메인 쪽(뷰 수작업 샘플)으로 정했다(haewon 결정).
겹친 22개 파일 중 실제로 다른 것은 9개였고 전부 메인 쪽을 취했다.
layout-baseline.json 은 Base.astro 가 내는 언어 전환 링크 모양(a.lang-switch)과
짝이라 같은 쪽으로 가져왔다.

Productize 쪽에만 있던 두 가지를 정본으로 옮겼다.
- GA4 태그: site.json 의 ga4MeasurementId 가 G-형식일 때만 삽입한다.
  값이 없으면 스크립트가 아예 나가지 않는다. 키 이벤트 이름은
  data/ai_channels.json 의 conversion_events 와 맞춘다.
- 영문 법적 고지: 지원 관계·부작용 고지는 의료법 56조 대상이라 임의 번역하지 않는다.
  i18n.ts 에 병원 승인 없는 영문 번역이 들어 있어 푸터에서 쓰지 않도록 했다.
  site.json 의 sponsorNoticeEn · factSheet 의 sideEffectNoticeEn 이 채워지기 전까지
  영문 화면은 한국어 원문과 확인 대기 표기를 함께 낸다.

검증: astro build 32페이지, 게이트 41/41 통과, check.mjs 오류 0건
(경고 23건은 기존 건으로 site.sponsorNotice 미설정 18건과 원고 수치 한정 5건),
루트 tsc --noEmit 0 에러. GA4 는 임시 측정 ID 로 삽입·미삽입 양쪽을 확인하고 원복했다.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-11 14:34:47 +09:00

49 lines
3.6 KiB
TypeScript

// 사이트 공통(헤더·푸터·배너) 문자열과 언어 전환 규칙. 페이지 본문은 각 페이지가 맡고, 이 모듈은 Base.astro 가 쓴다.
// 언어 전환은 전역 하나(헤더)로만 한다. 페이지마다 따로 토글을 두지 않는다 (haewon 결정, 2026-09-10).
export type Lang = 'ko' | 'en';
/** 한국어 경로 ↔ 영어 경로. 영어판이 없는 한국어 페이지는 영어 홈으로, 반대는 한국어 홈으로 보낸다. */
const PAIRS: [string, string][] = [
['/', '/en'],
['/plan', '/en/plan'],
];
export function switchHref(pathname: string, to: Lang): string {
const p = pathname.replace(/\/index\.html$/, '/').replace(/\.html$/, '').replace(/\/$/, '') || '/';
for (const [ko, en] of PAIRS) {
if (to === 'en' && p === ko) return en;
if (to === 'ko' && p === en) return ko;
}
return to === 'en' ? '/en' : '/';
}
export const isEnPath = (pathname: string): boolean => /^\/en(\/|\.html$|$)/.test(pathname);
export const UI: Record<Lang, Record<string, string>> = {
ko: {
sample: '샘플 사이트입니다. 정식 공개 전입니다.',
brand: '서포터즈',
nav_posts: '상담 전 질문', nav_videos: '의료진 영상', nav_news: '뉴스룸', nav_visit: '방문 안내', nav_plan: '회복 일정', nav_about: '매체 소개',
cta: '상담 예약',
back: '이전 페이지', backAria: '이전 페이지로 돌아가기', totop: '맨 위로',
switchLabel: 'EN', switchAria: 'Switch to English',
foot_sponsor: '이 매체는 {clinic}의 지원을 받아 서포터즈가 운영합니다. 글의 의학적 내용은 {clinic} 담당 원장의 검토를 거쳐 표시하며, 검토 전 글은 "의학 검토 대기"로 표시합니다. 편집 책임 {editor}.',
foot_clinic: '병원 정보', foot_visit: '방문 안내', foot_plan: '회복 일정', foot_about: '이 사이트에 대해', foot_corrections: '정정 기록', foot_request: '정정 요청', foot_editorial: '편집 기준 (운영자용)',
foot_phone: '전화', foot_fax: '팩스', foot_rep: '대표', foot_biz: '사업자등록번호',
foot_site: '공식 홈페이지', foot_youtube: '유튜브', foot_gu: '강남언니',
},
en: {
sample: 'Sample site. Not yet public.',
brand: 'Supporters',
nav_home: 'Home', nav_plan: 'Recovery Planner', nav_visit: 'Getting Here', nav_clinic: 'Clinic Facts', nav_korean: '한국어 전체 보기',
cta: 'Book a consultation',
back: 'Back', backAria: 'Go back to the previous page', totop: 'Back to top',
switchLabel: 'KO', switchAria: '한국어로 보기',
// 아래 영문 foot_sponsor · foot_side 는 병원이 확정한 문구가 아니라 푸터 고지에 쓰지 않는다.
// 고지는 Base.astro 가 site.json 의 sponsorNoticeEn · factSheet 의 sideEffectNoticeEn 에서 읽고, 없으면 한국어 원문에 확인 대기 표기를 붙인다.
foot_sponsor: 'This site is run by supporters with support from {clinic}. Medical content is reviewed by the clinic\'s attending surgeon before it is marked as reviewed. Editor in charge: {editor}.',
foot_side: 'After surgery, side effects such as inflammation, bleeding or nerve damage may occur depending on the individual.',
foot_clinic: 'Clinic facts', foot_visit: 'Getting here', foot_plan: 'Recovery planner', foot_about: 'About this site (Korean)', foot_corrections: 'Corrections (Korean)', foot_request: 'Request a correction', foot_editorial: '',
foot_phone: 'Tel', foot_fax: 'Fax', foot_rep: 'Representative', foot_biz: 'Business no.',
foot_site: 'Official website (English)', foot_youtube: 'YouTube', foot_gu: 'Gangnam Unni',
},
};