i18n(supporters): 전역 언어 전환(KO/EN)을 헤더 하나로 통일, 영어 홈 /en 신설

- 헤더 lang-switch: 현재 페이지의 상대 언어 페이지로 이동(/ ↔ /en, /plan ↔ /en/plan, 그 외는 언어 홈). 구조 기준선 갱신(haewon 승인)
- 영어 페이지에서는 메뉴·CTA·배너·뒤로가기·푸터(지원 고지·부작용 고지·링크·주소)까지 함께 전환. lib/i18n.ts, data/factSheetEn.json
- /en 영어 홈: 히어로, Start Here 카드, 병원 숫자, 오는 길(공항 경로·진료시간), 병원 사실, 원칙. 한국어 글은 번역 없이 링크만 안내
- 플래너의 페이지 내 언어 토글 제거, Step 1은 국적만. sitemap·hreflang 추가

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Haewon KamandClaude Fable 5.1 committed 2026-09-10 16:38:41 +09:00
1 parent 378ca7e7cd
commit c750cfd6d9
10 files changed
+217 -35

No files matched your search

+42 -18
View File
@@ -1,6 +1,8 @@
---
import '../styles/global.css';
import { SITE_NAME, SITE_TAGLINE, INDEXABLE, fact, site as S, surface, reservationUrl, editor, has, v } from '../lib';
import { UI, switchHref } from '../lib/i18n';
import EN from '../data/factSheetEn.json';
const ed = editor();
const f = fact as Record<string, any>;
@@ -18,6 +20,12 @@ const { title, description, jsonLd, ogImage = S.buildingImage?.src || '/favicon.
const site = Astro.site?.toString().replace(/\/$/, '') ?? '';
const cleanPath = Astro.url.pathname.replace(/\/index\.html$/, '/').replace(/\.html$/, '');
const canonical = (new URL(cleanPath, Astro.site).toString().replace(/\/$/, '') || site);
const u = UI[lang];
const other = lang === 'ko' ? 'en' : 'ko';
const switchTo = switchHref(Astro.url.pathname, other);
const clinicName = lang === 'en' ? EN.shortName : v(f.shortName, '병원');
const homeHref = lang === 'en' ? '/en' : '/';
const isHome = ['/', '', '/index.html', '/index', '/en', '/en/index.html', '/en/index'].includes(Astro.url.pathname.replace(/\/$/, '') || '/');
const ld = jsonLd ? JSON.stringify({ '@context': 'https://schema.org', ...(Array.isArray(jsonLd) ? { '@graph': jsonLd } : jsonLd) }) : null;
---
<!doctype html>
@@ -44,32 +52,44 @@ const ld = jsonLd ? JSON.stringify({ '@context': 'https://schema.org', ...(Array
{ld && <script type="application/ld+json" set:html={ld} />}
</head>
<body>
{!INDEXABLE && <div class="sample-banner">샘플 사이트입니다. 정식 공개 전입니다.</div>}
{!INDEXABLE && <div class="sample-banner">{u.sample}</div>}
<header class="site-header">
<div class="wrap-wide bar">
<a class="brand" href="/">{has(S.logo?.src) ? <img class="brand-logo" src={S.logo.src} alt={S.logo.alt} width={S.logo.width} height={S.logo.height} /> : <span class="brand-logo brand-name">{v(f.shortName, '병원')}</span>}<span class="brand-sep" aria-hidden="true"></span><span class="brand-text">서포터즈 <small>{S.siteNameEn || 'SUPPORTERS'}</small></span></a>
<a class="brand" href={homeHref}>{has(S.logo?.src) ? <img class="brand-logo" src={S.logo.src} alt={S.logo.alt} width={S.logo.width} height={S.logo.height} /> : <span class="brand-logo brand-name">{v(f.shortName, '병원')}</span>}<span class="brand-sep" aria-hidden="true"></span><span class="brand-text">{u.brand} <small>{S.siteNameEn || 'SUPPORTERS'}</small></span></a>
<div class="right">
<nav class="nav">
<a href="/posts">상담 전 질문</a>
<a href="/videos">의료진 영상</a>
<a href="/newsroom">뉴스룸</a>
<a href="/visit">방문 안내</a>
<a href="/plan">회복 일정</a>
<a href="/about">매체 소개</a>
{lang === 'ko' ? (
<>
<a href="/posts">{u.nav_posts}</a>
<a href="/videos">{u.nav_videos}</a>
<a href="/newsroom">{u.nav_news}</a>
<a href="/visit">{u.nav_visit}</a>
<a href="/plan">{u.nav_plan}</a>
<a href="/about">{u.nav_about}</a>
</>
) : (
<>
<a href="/en">{u.nav_home}</a>
<a href="/en/plan">{u.nav_plan}</a>
<a href="/en#visit">{u.nav_visit}</a>
<a href="/en#clinic">{u.nav_clinic}</a>
</>
)}
</nav>
<a class="cta" href={reservationUrl || '/visit'} rel="noopener">상담 예약</a>
<a class="lang-switch" href={switchTo} aria-label={u.switchAria} hreflang={other} lang={other}>{u.switchLabel}</a>
<a class="cta" href={reservationUrl || '/visit'} rel="noopener">{u.cta}</a>
</div>
</div>
</header>
{!['/', '', '/index.html', '/index'].includes(Astro.url.pathname.replace(/\/$/, '') || '/') && (
{!isHome && (
<div class="backbar-wrap"><div class="wrap-wide backbar">
<a href="/" class="backbtn" id="backbtn" aria-label="이전 페이지로 돌아가기"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M15.5 4.5 8 12l7.5 7.5 1.8-1.8L11.6 12l5.7-5.7z"/></svg>이전 페이지</a>
<a href={homeHref} class="backbtn" id="backbtn" aria-label={u.backAria}><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M15.5 4.5 8 12l7.5 7.5 1.8-1.8L11.6 12l5.7-5.7z"/></svg>{u.back}</a>
</div></div>
)}
<main>
<slot />
</main>
<button type="button" class="totop" id="totop" aria-label="맨 위로"><svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 5 4.5 12.5l1.8 1.8L11 9.6V20h2V9.6l4.7 4.7 1.8-1.8z"/></svg></button>
<button type="button" class="totop" id="totop" aria-label={u.totop}><svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 5 4.5 12.5l1.8 1.8L11 9.6V20h2V9.6l4.7 4.7 1.8-1.8z"/></svg></button>
<script>
const back = document.getElementById('backbtn');
if (back) back.addEventListener('click', (e) => { if (history.length > 1 && document.referrer && new URL(document.referrer).origin === location.origin) { e.preventDefault(); history.back(); } });
@@ -82,15 +102,19 @@ const ld = jsonLd ? JSON.stringify({ '@context': 'https://schema.org', ...(Array
<div class="wrap-wide cols">
<div>
<p><strong>{SITE_NAME}</strong> · {SITE_TAGLINE}</p>
<p>이 매체는 {v(f.shortName, '병원')}의 지원을 받아 서포터즈가 운영합니다. 글의 의학적 내용은 {v(f.shortName, '병원')} 담당 원장의 검토를 거쳐 표시하며, 검토 전 글은 "의학 검토 대기"로 표시합니다. 편집 책임 {ed.name}.</p>
<p>{fact.sideEffectNotice}</p>
<p><a href="/clinic">병원 정보</a> · <a href="/visit">방문 안내</a> · <a href="/plan">회복 일정</a> · <a href="/en/plan">Recovery Planner</a> · <a href="/about">이 사이트에 대해</a> · <a href="/corrections">정정 기록</a> · <a href={ed.email ? `mailto:${ed.email}` : '/corrections'}>정정 요청</a> · <a href="/editorial">편집 기준 (운영자용)</a></p>
<p>{u.foot_sponsor.replace(/\{clinic\}/g, clinicName).replace('{editor}', ed.name)}</p>
<p>{lang === 'en' ? u.foot_side : fact.sideEffectNotice}</p>
{lang === 'ko' ? (
<p><a href="/clinic">{u.foot_clinic}</a> · <a href="/visit">{u.foot_visit}</a> · <a href="/plan">{u.foot_plan}</a> · <a href="/about">{u.foot_about}</a> · <a href="/corrections">{u.foot_corrections}</a> · <a href={ed.email ? `mailto:${ed.email}` : '/corrections'}>{u.foot_request}</a> · <a href="/editorial">{u.foot_editorial}</a></p>
) : (
<p><a href="/en#clinic">{u.foot_clinic}</a> · <a href="/en#visit">{u.foot_visit}</a> · <a href="/en/plan">{u.foot_plan}</a> · <a href="/about">{u.foot_about}</a> · <a href="/corrections">{u.foot_corrections}</a> · <a href={ed.email ? `mailto:${ed.email}` : '/corrections'}>{u.foot_request}</a></p>
)}
</div>
<div>
{has(S.logoFoot?.src) && <p><img src={S.logoFoot.src} alt={S.logoFoot.alt} width={S.logoFoot.width} height={S.logoFoot.height} style="width:138px;height:auto;margin-bottom:0.5rem" /></p>}
<p><strong>{v(f.name)}</strong></p>
<p>{v(f.address?.full)}<br />전화 {v(f.phone)} · 팩스 {v(f.fax)}<br />대표 {v(f.representative)} · 사업자등록번호 {v(f.businessNo)}</p>
<p>{has(f.url) && <a href={f.url} rel="noopener">공식 홈페이지</a>}{has(surface('youtube').url) && <> · <a href={surface('youtube').url} rel="noopener">유튜브</a></>}{has(surface('gangnamunni').url) && <> · <a href={surface('gangnamunni').url} rel="noopener">강남언니</a></>}</p>
<p><strong>{lang === 'en' ? EN.name : v(f.name)}</strong></p>
<p>{lang === 'en' ? EN.address.full : v(f.address?.full)}<br />{u.foot_phone} {v(f.phone)} · {u.foot_fax} {v(f.fax)}<br />{u.foot_rep} {v(f.representative)} · {u.foot_biz} {v(f.businessNo)}</p>
<p>{lang === 'en' && has(f.urlEn) ? <a href={f.urlEn} rel="noopener">{u.foot_site}</a> : has(f.url) && <a href={f.url} rel="noopener">{u.foot_site}</a>}{has(surface('youtube').url) && <> · <a href={surface('youtube').url} rel="noopener">{u.foot_youtube}</a></>}{has(surface('gangnamunni').url) && <> · <a href={surface('gangnamunni').url} rel="noopener">{u.foot_gu}</a></>}</p>
</div>
</div>
<div class="wrap-wide powered">AI Discovery · Built with INFINITH</div>