Skip to content

Commit 4b4361e

Browse files
committed
feat: move translations to singlefile
1 parent 739d975 commit 4b4361e

22 files changed

+193
-83
lines changed

website/src/components/icons/AlertTriangleIcon.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { menuTranslations } from "../../translations";
2+
13
export const AlertTriangleIcon = () => {
24
return (
35
<svg
@@ -10,7 +12,7 @@ export const AlertTriangleIcon = () => {
1012
stroke-linejoin="round"
1113
class="icon icon-tabler icons-tabler-outline icon-tabler-alert-triangle"
1214
>
13-
<title>警告アイコン</title>
15+
<title>{menuTranslations.iconAlert}</title>
1416
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
1517
<path d="M12 9v4" />
1618
<path d="M10.363 3.591l-8.106 13.534a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636 -2.87l-8.106 -13.536a1.914 1.914 0 0 0 -3.274 0z" />

website/src/components/icons/CaretRightCircleIcon.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { menuTranslations } from "../../translations";
2+
13
export const CaretRightCircleIcon = () => {
24
return (
35
<svg
@@ -10,7 +12,7 @@ export const CaretRightCircleIcon = () => {
1012
stroke-linejoin="round"
1113
class="icon icon-tabler icons-tabler-outline icon-tabler-circle-caret-right"
1214
>
13-
<title>再生アイコン</title>
15+
<title>{menuTranslations.iconRead}</title>
1416
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
1517
<path d="M15 12l-4 -4v8z" />
1618
<path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" />

website/src/components/icons/ChevronLeftIcon.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { menuTranslations } from "../../translations";
2+
13
export const ChevronLeftIcon = () => {
24
return (
35
<svg
@@ -10,7 +12,7 @@ export const ChevronLeftIcon = () => {
1012
stroke-linejoin="round"
1113
class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-left"
1214
>
13-
<title>左矢印アイコン</title>
15+
<title>{menuTranslations.iconLeftArrow}</title>
1416
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
1517
<path d="M15 6l-6 6l6 6" />
1618
</svg>

website/src/components/icons/ChevronRightIcon.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { menuTranslations } from "../../translations";
2+
13
export const ChevronRightIcon = () => {
24
return (
35
<svg
@@ -10,7 +12,7 @@ export const ChevronRightIcon = () => {
1012
stroke-linejoin="round"
1113
class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-right"
1214
>
13-
<title>右矢印アイコン</title>
15+
<title>{menuTranslations.iconRightArrow}</title>
1416
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
1517
<path d="M9 6l6 6l-6 6" />
1618
</svg>

website/src/components/icons/CloseIcon.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { menuTranslations } from "../../translations";
2+
13
export const CloseIcon = () => {
24
return (
35
<svg
@@ -10,7 +12,7 @@ export const CloseIcon = () => {
1012
stroke-linejoin="round"
1113
class="icon icon-tabler icons-tabler-outline icon-tabler-x"
1214
>
13-
<title>閉じるアイコン</title>
15+
<title>{menuTranslations.iconClose}</title>
1416
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
1517
<path d="M18 6l-12 12" />
1618
<path d="M6 6l12 12" />

website/src/components/icons/InfoCircleIcon.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { menuTranslations } from "../../translations";
2+
13
export const InfoCircleIcon = () => {
24
return (
35
<svg
@@ -10,7 +12,7 @@ export const InfoCircleIcon = () => {
1012
stroke-linejoin="round"
1113
class="icon icon-tabler icons-tabler-outline icon-tabler-info-circle"
1214
>
13-
<title>情報アイコン</title>
15+
<title>{menuTranslations.iconInformation}</title>
1416
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
1517
<path d="M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0" />
1618
<path d="M12 9h.01" />

website/src/components/icons/LanguageIcon.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { menuTranslations } from "../../translations";
2+
13
export const LanguageIcon = () => {
24
return (
35
<svg
@@ -9,7 +11,7 @@ export const LanguageIcon = () => {
911
stroke-linejoin="round"
1012
class="icon icon-tabler icons-tabler-outline icon-tabler-language-hiragana"
1113
>
12-
<title>言語アイコン</title>
14+
<title>{menuTranslations.iconLang}</title>
1315
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
1416
<path d="M4 5h7" />
1517
<path d="M7 4c0 4.846 0 7 .5 8" />

website/src/components/icons/SearchIcon.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { menuTranslations } from "../../translations";
2+
13
export const SearchIcon = () => {
24
return (
35
<svg
@@ -10,7 +12,7 @@ export const SearchIcon = () => {
1012
stroke-linejoin="round"
1113
class="icon icon-tabler icons-tabler-outline icon-tabler-search"
1214
>
13-
<title>検索アイコン</title>
15+
<title>{menuTranslations.iconSearch}</title>
1416
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
1517
<path d="M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" />
1618
<path d="M21 21l-6 -6" />

website/src/components/templates/BaseTemplate.tsx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
TableOfContents,
2020
TranslationStatusAlert,
2121
} from "../ui/common/";
22+
import { menuTranslations } from "../../translations";
2223

2324
export type BaseTemplateProps = PropsWithChildren<{
2425
page: Page;
@@ -42,10 +43,10 @@ export const BaseTemplate: FC<BaseTemplateProps> = ({
4243
const outline = page.outline;
4344
const translationStatus = getTranslationStatus(route);
4445
return (
45-
<html lang="ja" class="scroll-pt-24">
46+
<html lang={menuTranslations.lang} class="scroll-pt-24">
4647
<head>
4748
<meta charSet="utf-8" />
48-
<title>{title}Typstドキュメント日本語版</title>
49+
<title>{title}{menuTranslations.documentationTitle}</title>
4950
<meta name="description" content={description} />
5051
<meta name="viewport" content="width=device-width,initial-scale=1" />
5152
<meta name="theme-color" content="#239dad" />
@@ -55,7 +56,7 @@ export const BaseTemplate: FC<BaseTemplateProps> = ({
5556
/>
5657
<meta
5758
property="og:title"
58-
content={`${title}Typstドキュメント日本語版`}
59+
content={`${title}${menuTranslations.documentationTitle}`}
5960
/>
6061
<meta property="og:site_name" content="Typst" />
6162
<meta property="og:description" content={description} />
@@ -152,7 +153,7 @@ export const BaseTemplate: FC<BaseTemplateProps> = ({
152153
type="button"
153154
class="text-gray-600"
154155
x-on:click="sidebarOpen = false"
155-
aria-label="メニューを閉じる"
156+
aria-label={menuTranslations.closeMenu}
156157
>
157158
<div class="w-6 h-6 text-gray-600 hover:text-gray-800 transition-colors">
158159
<CloseIcon />
@@ -192,7 +193,7 @@ export const BaseTemplate: FC<BaseTemplateProps> = ({
192193
<div class="w-4 h-4 mr-1 ">
193194
<WorldIcon />
194195
</div>
195-
原文(英語)を開く
196+
{menuTranslations.originalArticle}
196197
</a>
197198
</div>
198199
)}
@@ -212,7 +213,7 @@ export const BaseTemplate: FC<BaseTemplateProps> = ({
212213
<WorldIcon />
213214
</div>
214215
<span class="text-sm font-medium text-gray-800 group-hover:text-gray-900 transition-colors">
215-
原文(英語)を開く
216+
{menuTranslations.originalArticle}
216217
</span>
217218
<div class="w-4 h-4 ml-2 text-gray-400 transition-colors">
218219
<ChevronRightIcon />
@@ -231,11 +232,11 @@ export const BaseTemplate: FC<BaseTemplateProps> = ({
231232
<CaretRightCircleIcon />
232233
</div>
233234
<strong class="text-base font-semibold text-gray-800">
234-
チュートリアル
235+
{menuTranslations.tutorial}
235236
</strong>
236237
</div>
237238
<p class="text-sm text-gray-600">
238-
一歩一歩、Typstの使い方を学びましょう。
239+
{menuTranslations.learnTypst}
239240
</p>
240241
</a>
241242
<a
@@ -247,11 +248,11 @@ export const BaseTemplate: FC<BaseTemplateProps> = ({
247248
<InfoCircleIcon />
248249
</div>
249250
<strong class="text-base font-semibold text-gray-800">
250-
リファレンス
251+
{menuTranslations.referenceTo}
251252
</strong>
252253
</div>
253254
<p class="text-sm text-gray-600">
254-
Typstのあらゆる構文、概念、型、関数についての詳細なリファレンスです。
255+
{menuTranslations.reference}
255256
</p>
256257
</a>
257258
</div>
@@ -268,7 +269,7 @@ export const BaseTemplate: FC<BaseTemplateProps> = ({
268269
<ChevronLeftIcon />
269270
</div>
270271
<strong class="text-base font-semibold text-gray-800">
271-
前のページ
272+
{menuTranslations.previousPage}
272273
</strong>
273274
</div>
274275
<p class="text-sm text-gray-600">{previousPage.title}</p>
@@ -279,7 +280,7 @@ export const BaseTemplate: FC<BaseTemplateProps> = ({
279280
>
280281
<div class="flex items-center mb-3 justify-between">
281282
<strong class="text-base font-semibold text-gray-800">
282-
次のページ
283+
{menuTranslations.nextPage}
283284
</strong>
284285
<div class="w-6 h-6 text-gray-400">
285286
<ChevronRightIcon />

website/src/components/templates/CategoryTemplate.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { FC } from "hono/jsx";
22
import type { CategoryBody, Page } from "../../types/model";
33
import { HtmlContent } from "../ui/HtmlContent";
44
import BaseTemplate, { type BaseTemplateProps } from "./BaseTemplate";
5+
import { menuTranslations } from "../../translations";
56

67
export type CategoryTemplateProps = Omit<BaseTemplateProps, "page"> & {
78
page: Omit<Page, "body"> & {
@@ -26,7 +27,7 @@ export const CategoryTemplate: FC<CategoryTemplateProps> = ({
2627
>
2728
<h1 id="summary">{page.body.content.title}</h1>
2829
<HtmlContent html={page.body.content.details} />
29-
<h2 id="definitions">定義</h2>
30+
<h2 id="definitions">{menuTranslations.definition}</h2>
3031
<ul class="subgridded">
3132
{page.body.content.items.map((item) => (
3233
<li key={item.route}>

0 commit comments

Comments
 (0)