Skip to content

Commit 653d96a

Browse files
Added translation for git timestamp (#449)
1 parent 82074a1 commit 653d96a

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

theme.config.js

+18
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
editTextMap,
88
feedbackLinkMap,
99
footerTextMap,
10+
gitTimestampMap,
1011
headDescriptionMap,
1112
languageMap,
1213
searchPlaceholderMap,
@@ -135,6 +136,23 @@ const themeConfig = {
135136
);
136137
},
137138
},
139+
gitTimestamp({ timestamp }) {
140+
const { locale } = useRouter();
141+
const lastUpdatedOn = useLocalesMap(gitTimestampMap);
142+
143+
return (
144+
<>
145+
{lastUpdatedOn}{" "}
146+
<time dateTime={timestamp.toISOString()}>
147+
{timestamp.toLocaleDateString(locale, {
148+
day: "numeric",
149+
month: "long",
150+
year: "numeric",
151+
})}
152+
</time>
153+
</>
154+
);
155+
},
138156
i18n: Object.entries(languageMap).map(([locale, text]) => ({
139157
locale,
140158
text,

translations/text.js

+6
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,9 @@ export const searchPlaceholderMap = {
115115
ko: "문서 검색...",
116116
ru: "Искать в документации...",
117117
};
118+
119+
/** @type {Readonly<Record<Locale, string>>} */
120+
export const gitTimestampMap = {
121+
"en-US": "Last updated on",
122+
ru: "Последнее обновление",
123+
};

0 commit comments

Comments
 (0)