Skip to content

Commit d151ba8

Browse files
committed
refactor: update translation imports
1 parent b7ca404 commit d151ba8

File tree

13 files changed

+26
-26
lines changed

13 files changed

+26
-26
lines changed

website/src/components/templates/BaseTemplate.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { html } from "hono/html";
22
import type { FC, PropsWithChildren } from "hono/jsx";
33
import { basePath, originUrl, typstOfficialDocsUrl } from "../../metadata";
4-
import { Translation, t } from "../../translations";
4+
import { Translation, translation } from "../../translation";
55
import type { Page } from "../../types/model";
66
import { joinPath, removeBasePath } from "../../utils/path";
77
import { getTranslationStatus } from "../../utils/translationStatus";
@@ -55,19 +55,19 @@ export const BaseTemplate: FC<BaseTemplateProps> = ({
5555
removeBasePath(basePath, route),
5656
);
5757
return (
58-
<html lang={t("lang")} class="scroll-pt-24">
58+
<html lang={translation.lang()} class="scroll-pt-24">
5959
<head>
6060
<meta charSet="utf-8" />
6161
<title>
62-
{title}{t("documentationTitle")}
62+
{title}{translation.documentationTitle()}
6363
</title>
6464
<meta name="description" content={description} />
6565
<meta name="viewport" content="width=device-width,initial-scale=1" />
6666
<meta name="theme-color" content="#239dad" />
6767
<meta property="og:url" content={absoluteRouteUrl} />
6868
<meta
6969
property="og:title"
70-
content={`${title}${t("documentationTitle")}`}
70+
content={`${title}${translation.documentationTitle()}`}
7171
/>
7272
<meta property="og:site_name" content="Typst" />
7373
<meta property="og:description" content={description} />
@@ -181,7 +181,7 @@ export const BaseTemplate: FC<BaseTemplateProps> = ({
181181
type="button"
182182
class="text-gray-600"
183183
x-on:click="sidebarOpen = false"
184-
aria-label={t("ariaCloseMenu")}
184+
aria-label={translation.ariaCloseMenu()}
185185
>
186186
<div class="w-6 h-6 text-gray-600 hover:text-gray-800 transition-colors">
187187
<CloseIcon />

website/src/components/templates/CategoryTemplate.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { FC } from "hono/jsx";
2-
import { Translation } from "../../translations";
2+
import { Translation } from "../../translation";
33
import type { CategoryBody, Page } from "../../types/model";
44
import { HtmlContent } from "../ui/HtmlContent";
55
import BaseTemplate, { type BaseTemplateProps } from "./BaseTemplate";

website/src/components/templates/FuncTemplate.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { FC } from "hono/jsx";
2-
import { Translation, t } from "../../translations";
2+
import { Translation } from "../../translation";
33
import type { Func, FuncBody, Page } from "../../types/model";
44
import {
55
FunctionDefinition,

website/src/components/templates/TypeTemplate.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { FC } from "hono/jsx";
2-
import { Translation } from "../../translations";
2+
import { Translation } from "../../translation";
33
import type { Page, TypeBody } from "../../types/model";
44
import { FunctionDisplay, Tooltip } from "../ui";
55
import { HtmlContent } from "../ui/HtmlContent";

website/src/components/ui/FunctionDisplay.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { FC } from "hono/jsx";
2-
import { Translation } from "../../translations";
2+
import { Translation } from "../../translation";
33
import type { Func } from "../../types/model";
44
import { ChevronRightIcon } from "../icons";
55
import { FunctionDefinition } from "./FunctionDefinition";

website/src/components/ui/FunctionParameters.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { FC } from "hono/jsx";
22
import { basePath } from "../../metadata";
3-
import { Translation } from "../../translations";
3+
import { Translation } from "../../translation";
44
import type { Func } from "../../types/model";
55
import { joinPath } from "../../utils/path";
66
import { ChevronRightIcon } from "../icons";

website/src/components/ui/Tooltip.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { FC, JSX, JSXNode } from "hono/jsx";
2-
import { Translation, TranslationProps, t } from "../../translations";
2+
import { Translation, TranslationProps, translation } from "../../translation";
33
import { CloseIcon, HelpCircleIcon } from "../icons";
44

55
type TooltipProps = {
@@ -17,8 +17,8 @@ type TooltipProps = {
1717
const tooltipContent: Record<
1818
TooltipProps["kind"],
1919
{
20-
label: JSXNode;
21-
desc: JSXNode;
20+
label: ReturnType<typeof Translation>;
21+
desc: ReturnType<typeof Translation>;
2222
isShowLabel: boolean;
2323
bgColor: string;
2424
textColor: string;
@@ -101,7 +101,7 @@ export const Tooltip: FC<TooltipProps> = ({ kind }) => {
101101
<button
102102
type="button"
103103
class="w-4 h-4 hover:bg-black/10 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 cursor-pointer"
104-
aria-label={`${content.label}${t("ariaShowInformation")}`}
104+
aria-label={`${content.label}${translation.ariaShowInformation({ name: String(content.label) })}`}
105105
tabindex={0}
106106
{...{ "x-on:click": "helpOpen = true" }}
107107
{...{ "x-on:keydown.enter": "helpOpen = true" }}
@@ -146,7 +146,7 @@ export const Tooltip: FC<TooltipProps> = ({ kind }) => {
146146
{...{ "x-on:click": "helpOpen = false" }}
147147
{...{ "x-on:keydown.enter": "helpOpen = false" }}
148148
{...{ "x-on:keydown.space": "helpOpen = false" }}
149-
aria-label={t("ariaClose")}
149+
aria-label={translation.ariaClose()}
150150
>
151151
<div class="w-6 h-6">
152152
<CloseIcon />

website/src/components/ui/common/Header.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
typstOfficialUrl,
66
version,
77
} from "../../../metadata";
8-
import { Translation, t } from "../../../translations";
8+
import { Translation, translation } from "../../../translation";
99
import { calculateTranslationProgressRate } from "../../../utils/translationStatus";
1010
import {
1111
DiscordIcon,
@@ -137,7 +137,7 @@ export const Header = () => {
137137
type="button"
138138
class="p-2 text-gray-600 hover:text-gray-800 transition-colors"
139139
x-on:click="searchOpen = true"
140-
aria-label={t("ariaOpenSearch")}
140+
aria-label={translation.ariaOpenSearch()}
141141
>
142142
<div class="w-6 h-6 text-gray-600 hover:text-gray-800 transition-colors">
143143
<SearchIcon />
@@ -147,7 +147,7 @@ export const Header = () => {
147147
type="button"
148148
class="p-1 bg-white rounded-md border border-gray-200"
149149
x-on:click="sidebarOpen = !sidebarOpen"
150-
aria-label={t("ariaOpenMenu")}
150+
aria-label={translation.ariaOpenMenu()}
151151
>
152152
<div class="w-6 h-6 text-gray-600 hover:text-gray-800 transition-colors">
153153
<MenuIcon />

website/src/components/ui/common/SearchWindow.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { FC } from "hono/jsx";
22
import { basePath } from "../../../metadata";
3-
import { Translation, t } from "../../../translations";
3+
import { Translation, translation } from "../../../translation";
44
import { joinPath } from "../../../utils/path";
55
import { CloseIcon } from "../../icons";
66

@@ -24,7 +24,7 @@ export const SearchWindow: FC = () => {
2424
type="button"
2525
class="text-gray-400 hover:text-gray-600"
2626
x-on:click="searchOpen = false"
27-
aria-label={t("ariaCloseSearch")}
27+
aria-label={translation.ariaCloseSearch()}
2828
>
2929
<div class="w-6 h-6 text-gray-600 hover:text-gray-800 transition-colors">
3030
<CloseIcon />

website/src/components/ui/common/SiteNoticeBanner.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
typstOfficialDocsUrl,
66
version,
77
} from "../../../metadata";
8-
import { Translation } from "../../../translations";
8+
import { Translation } from "../../../translation";
99
import { InfoCircleIcon } from "../../icons";
1010

1111
export const SiteNoticeBanner = () => {

0 commit comments

Comments
 (0)