feat: add internationalization message platform
This commit is contained in:
@@ -2,6 +2,7 @@ import type { ReactNode } from "react";
|
||||
|
||||
import { PageHeader } from "../components/page-header.jsx";
|
||||
import { Button } from "../components/ui/button.jsx";
|
||||
import { useLocale } from "../i18n/index.js";
|
||||
|
||||
export type PageHeading = Readonly<{
|
||||
title: string;
|
||||
@@ -36,10 +37,14 @@ export type PageTemplateSlots = Readonly<{
|
||||
}>;
|
||||
|
||||
export function StandardPage(props: PageTemplateSlots) {
|
||||
const { message } = useLocale();
|
||||
return (
|
||||
<article className="ui-page page-template page-template--standard">
|
||||
{props.breadcrumb ? (
|
||||
<nav className="page-template__breadcrumb" aria-label="현재 위치">
|
||||
<nav
|
||||
className="page-template__breadcrumb"
|
||||
aria-label={message("template.breadcrumb")}
|
||||
>
|
||||
{props.breadcrumb}
|
||||
</nav>
|
||||
) : null}
|
||||
@@ -64,7 +69,10 @@ export function StandardPage(props: PageTemplateSlots) {
|
||||
>
|
||||
<div className="page-template__content">{props.children}</div>
|
||||
{props.aside ? (
|
||||
<aside className="page-template__aside" aria-label="관련 정보">
|
||||
<aside
|
||||
className="page-template__aside"
|
||||
aria-label={message("template.relatedInformation")}
|
||||
>
|
||||
{props.aside}
|
||||
</aside>
|
||||
) : null}
|
||||
@@ -83,6 +91,7 @@ export function CollectionPage(
|
||||
pagination?: ReactNode;
|
||||
}>,
|
||||
) {
|
||||
const { message } = useLocale();
|
||||
return (
|
||||
<StandardPage
|
||||
{...props}
|
||||
@@ -92,7 +101,7 @@ export function CollectionPage(
|
||||
{props.toolbar ? (
|
||||
<section
|
||||
className="collection-page__toolbar"
|
||||
aria-label="검색과 필터"
|
||||
aria-label={message("template.searchAndFilter")}
|
||||
>
|
||||
{props.toolbar}
|
||||
</section>
|
||||
@@ -117,7 +126,10 @@ export function CollectionPage(
|
||||
>
|
||||
<div className="collection-page__results">{props.children}</div>
|
||||
{props.pagination ? (
|
||||
<nav className="collection-page__pagination" aria-label="페이지 탐색">
|
||||
<nav
|
||||
className="collection-page__pagination"
|
||||
aria-label={message("template.pagination")}
|
||||
>
|
||||
{props.pagination}
|
||||
</nav>
|
||||
) : null}
|
||||
@@ -132,16 +144,23 @@ export function DetailPage(
|
||||
destructiveAction?: ReactNode;
|
||||
}>,
|
||||
) {
|
||||
const { message } = useLocale();
|
||||
return (
|
||||
<StandardPage {...props}>
|
||||
{props.metadata ? (
|
||||
<section className="detail-page__metadata" aria-label="요약 정보">
|
||||
<section
|
||||
className="detail-page__metadata"
|
||||
aria-label={message("template.summary")}
|
||||
>
|
||||
{props.metadata}
|
||||
</section>
|
||||
) : null}
|
||||
<div className="detail-page__sections">{props.children}</div>
|
||||
{props.destructiveAction ? (
|
||||
<section className="detail-page__danger" aria-label="위험 작업">
|
||||
<section
|
||||
className="detail-page__danger"
|
||||
aria-label={message("template.dangerActions")}
|
||||
>
|
||||
{props.destructiveAction}
|
||||
</section>
|
||||
) : null}
|
||||
@@ -190,6 +209,7 @@ export function StatusPage(
|
||||
supportReference?: string;
|
||||
}>,
|
||||
) {
|
||||
const { message } = useLocale();
|
||||
return (
|
||||
<section
|
||||
className={`ui-page page-template status-page status-page--${props.variant}`}
|
||||
@@ -208,7 +228,9 @@ export function StatusPage(
|
||||
) : null}
|
||||
{props.supportReference ? (
|
||||
<p className="status-page__support">
|
||||
지원 참조: <code>{props.supportReference}</code>
|
||||
{message("template.supportReference", {
|
||||
reference: props.supportReference,
|
||||
})}
|
||||
</p>
|
||||
) : null}
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user