1
0
forked from baron/baron-sso

최근 변경 앱 상세 다국어 정리

This commit is contained in:
2026-06-01 16:26:52 +09:00
parent d2a7ebd82f
commit d0f44de2d1
6 changed files with 128 additions and 46 deletions

View File

@@ -18,7 +18,6 @@ import {
OverviewMetric,
OverviewSelectionChips,
} from "../../../../common/core/components/overview";
import { formatAuditDateParts } from "../../../../common/core/audit";
import { DeveloperAccessRequestCard } from "../../components/common/DeveloperAccessRequestCard";
import { Badge } from "../../components/ui/badge";
import { Button } from "../../components/ui/button";
@@ -81,6 +80,7 @@ type UsageChartPalette = {
};
const deletedRecentChangeFilterId = "__deleted_recent_clients__";
const localeStorageKey = "locale";
type RecentChangePoint = {
date: string;
@@ -102,6 +102,73 @@ type RecentChangeSeries = {
points: RecentChangePoint[];
};
type AppLocale = "ko" | "en";
function resolveAppLocale(): AppLocale {
if (typeof window === "undefined") {
return "ko";
}
const stored = window.localStorage.getItem(localeStorageKey);
if (stored === "ko" || stored === "en") {
return stored;
}
const pathLocale = window.location.pathname.split("/")[1];
if (pathLocale === "ko" || pathLocale === "en") {
return pathLocale;
}
return window.navigator.language.toLowerCase().startsWith("ko")
? "ko"
: "en";
}
function formatRecentChangeTimestamp(value: string) {
if (!value) {
return { date: "-", time: "-" };
}
const parsed = new Date(value);
if (Number.isNaN(parsed.getTime())) {
return { date: value, time: "-" };
}
const locale = resolveAppLocale();
if (locale === "ko") {
const date = parsed.toISOString().slice(0, 10);
const timeParts = new Intl.DateTimeFormat("ko-KR", {
hour12: false,
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
}).formatToParts(parsed);
const hour = timeParts.find((part) => part.type === "hour")?.value ?? "00";
const minute =
timeParts.find((part) => part.type === "minute")?.value ?? "00";
const second =
timeParts.find((part) => part.type === "second")?.value ?? "00";
return {
date,
time: `${hour}${minute}${second}`,
};
}
return {
date: new Intl.DateTimeFormat("en-US", {
year: "numeric",
month: "short",
day: "numeric",
}).format(parsed),
time: new Intl.DateTimeFormat("en-US", {
hour: "numeric",
minute: "2-digit",
second: "2-digit",
}).format(parsed),
};
}
const usageChartPalettes: UsageChartPalette[] = [
{ bar: "#7dd3fc", line: "#10b981", point: "#059669" },
{ bar: "#f9a8d4", line: "#f97316", point: "#ea580c" },
@@ -1068,7 +1135,7 @@ function GlobalOverviewPage() {
id: deletedRecentChangeFilterId,
label: t(
"ui.dev.dashboard.recent_changes.deleted_group",
"삭제된 RP",
"삭제된 ",
),
},
];
@@ -1399,9 +1466,9 @@ function GlobalOverviewPage() {
<OverviewMetric
icon={<Layers3 size={14} />}
label={t(
"ui.dev.dashboard.recent_changes.summary.deleted_clients",
"삭제된 RP 수",
)}
"ui.dev.dashboard.recent_changes.summary.deleted_clients",
"삭제된 수",
)}
value={deletedRecentChangedClientCount.toLocaleString()}
/>
<OverviewMetric
@@ -1466,7 +1533,8 @@ function GlobalOverviewPage() {
</div>
) : (
visibleRecentClientChanges.map((item) => {
const { date, time } = formatAuditDateParts(item.timestamp);
const { date, time } =
formatRecentChangeTimestamp(item.timestamp);
return (
<div
key={item.eventId}