|
| 1 | +import { Fragment } from "hono/jsx/jsx-runtime"; |
| 2 | +import type { TooltipProps } from "../components/ui/Tooltip"; |
| 3 | +import { |
| 4 | + discordServerUrl, |
| 5 | + githubOrganizationUrl, |
| 6 | + githubRepositoryUrl, |
| 7 | + typstOfficialDocsUrl, |
| 8 | + version, |
| 9 | +} from "../metadata"; |
| 10 | +import type { TranslationComponent, TranslationObject } from "./"; |
| 11 | + |
| 12 | +export const translation: TranslationObject = { |
| 13 | + htmlLang: () => "zh-Hans", |
| 14 | + documentationTitle: () => "Typst中文文档", |
| 15 | + close: () => "关闭", |
| 16 | + closeMenu: () => "关闭菜单", |
| 17 | + closeSearch: () => "关闭搜索", |
| 18 | + openMenu: () => "打开菜单", |
| 19 | + openSearch: () => "打开搜索", |
| 20 | + showInformation: (props: { name: string }) => `具体解释${props.name}`, |
| 21 | + tooltipKind: (props: { kind: TooltipProps["kind"] }) => { |
| 22 | + const map: Record<TooltipProps["kind"], string> = { |
| 23 | + element: "元素函数", |
| 24 | + contextual: "上下文相关", |
| 25 | + constructor: "构造函数", |
| 26 | + definitions: "定义", |
| 27 | + parameters: "参数", |
| 28 | + variadic: "变长参数", |
| 29 | + settable: "可用set规则", |
| 30 | + positional: "位置参数", |
| 31 | + required: "必需参数", |
| 32 | + }; |
| 33 | + return map[props.kind]; |
| 34 | + }, |
| 35 | +} as const; |
| 36 | + |
| 37 | +export const Translation: TranslationComponent = (props) => { |
| 38 | + switch (props.translationKey) { |
| 39 | + // Function tooltips |
| 40 | + case "elementFunction": |
| 41 | + return <Fragment>元素</Fragment>; |
| 42 | + case "elementFunctionDescription": |
| 43 | + return ( |
| 44 | + <Fragment> |
| 45 | + 元素函数可用<code>set</code>和<code>show</code>规则自定义样式。 |
| 46 | + </Fragment> |
| 47 | + ); |
| 48 | + case "contextFunction": |
| 49 | + return <Fragment>上下文相关函数</Fragment>; |
| 50 | + case "contextFunctionDescription": |
| 51 | + return <Fragment>上下文相关函数只能在确定上下文之后使用。</Fragment>; |
| 52 | + |
| 53 | + // Section tooltips |
| 54 | + case "constructor": |
| 55 | + return <Fragment>构造函数</Fragment>; |
| 56 | + case "constructorDescription": |
| 57 | + return ( |
| 58 | + <Fragment>若某类型提供构造函数,可调用它生成该类型的新实例。</Fragment> |
| 59 | + ); |
| 60 | + case "definitionsOf": |
| 61 | + return ( |
| 62 | + <Fragment> |
| 63 | + <code>{props.name}</code>的定义 |
| 64 | + </Fragment> |
| 65 | + ); |
| 66 | + case "definitions": |
| 67 | + return <Fragment>定义</Fragment>; |
| 68 | + case "definitionsDescription": |
| 69 | + return ( |
| 70 | + <Fragment> |
| 71 | + 这些函数和类型带有附属定义。要访问这种定义,请先写上函数或类型的名称,再加上定义的名称,并用句点在中间分隔。 |
| 72 | + </Fragment> |
| 73 | + ); |
| 74 | + case "parameters": |
| 75 | + return <Fragment>参数</Fragment>; |
| 76 | + case "parametersDescription": |
| 77 | + return <Fragment>参数是传给函数的输入,写在函数名后的括号中。</Fragment>; |
| 78 | + |
| 79 | + // Parameter tooltips |
| 80 | + case "variadic": |
| 81 | + return <Fragment>变长参数</Fragment>; |
| 82 | + case "variadicDescription": |
| 83 | + return <Fragment>变长参数可以传入多次。</Fragment>; |
| 84 | + case "settable": |
| 85 | + return <Fragment>可用set规则</Fragment>; |
| 86 | + case "settableDescription": |
| 87 | + return ( |
| 88 | + <Fragment> |
| 89 | + 可用<code>set</code>规则设置参数,更改后续调用时的默认值。 |
| 90 | + </Fragment> |
| 91 | + ); |
| 92 | + case "positional": |
| 93 | + return <Fragment>位置参数</Fragment>; |
| 94 | + case "positionalDescription": |
| 95 | + return <Fragment>位置参数按顺序传入,不带参数名。</Fragment>; |
| 96 | + case "required": |
| 97 | + return <Fragment>必需参数</Fragment>; |
| 98 | + case "requiredDescription": |
| 99 | + return <Fragment>必需参数在调用函数时必须传入。</Fragment>; |
| 100 | + |
| 101 | + // Other texts in documentation |
| 102 | + case "tutorial": |
| 103 | + return <Fragment>教程</Fragment>; |
| 104 | + case "tutorialDescription": |
| 105 | + return <Fragment>逐步学习如何使用Typst。</Fragment>; |
| 106 | + case "reference": |
| 107 | + return <Fragment>参考手册</Fragment>; |
| 108 | + case "referenceDescription": |
| 109 | + return ( |
| 110 | + <Fragment>Typst语法、概念、类型、函数等方面的详细参考手册。</Fragment> |
| 111 | + ); |
| 112 | + case "defaultValue": |
| 113 | + return <Fragment>默认值:</Fragment>; |
| 114 | + case "stringValues": |
| 115 | + return <Fragment>可填写的值</Fragment>; |
| 116 | + case "showExample": |
| 117 | + return <Fragment>展开例子</Fragment>; |
| 118 | + |
| 119 | + // Translation statuses |
| 120 | + case "untranslated": |
| 121 | + return <Fragment>未翻译</Fragment>; |
| 122 | + case "untranslatedMessage": |
| 123 | + return <Fragment>本页尚未翻译,以下展示原文。</Fragment>; |
| 124 | + case "communityContent": |
| 125 | + return <Fragment>中文版特色内容</Fragment>; |
| 126 | + case "contentAddedByCommunity": |
| 127 | + return <Fragment>本页不属于官方文档,由中文社区独立增加。</Fragment>; |
| 128 | + case "partiallyTranslated": |
| 129 | + return <Fragment>部分翻译</Fragment>; |
| 130 | + case "partiallyTranslatedMessage": |
| 131 | + return <Fragment>本页仅部分翻译,会残余一些原文。</Fragment>; |
| 132 | + case "translated": |
| 133 | + return <Fragment>已翻译</Fragment>; |
| 134 | + case "translatedMessage": |
| 135 | + return <Fragment>本页已翻译为中文。</Fragment>; |
| 136 | + |
| 137 | + // Header, sidebar, and footer |
| 138 | + case "document": |
| 139 | + return <Fragment>文档</Fragment>; |
| 140 | + case "langVersion": |
| 141 | + return <Fragment>简体中文版</Fragment>; |
| 142 | + case "translationRate": |
| 143 | + return <Fragment>翻译率</Fragment>; |
| 144 | + case "search": |
| 145 | + return <Fragment>搜索</Fragment>; |
| 146 | + case "typstOfficialWebsite": |
| 147 | + return <Fragment>Typst官方网站</Fragment>; |
| 148 | + case "typstOfficialDocs": |
| 149 | + return <Fragment>Typst官方文档</Fragment>; |
| 150 | + case "openOfficialDocs": |
| 151 | + return <Fragment>转到官方文档(英文)</Fragment>; |
| 152 | + case "tableOfContents": |
| 153 | + return <Fragment>目录</Fragment>; |
| 154 | + case "footer": |
| 155 | + return ( |
| 156 | + <Fragment> |
| 157 | + Translated by{" "} |
| 158 | + <a href={githubOrganizationUrl}>Typst Chinese Community</a> |
| 159 | + </Fragment> |
| 160 | + ); |
| 161 | + case "previousPage": |
| 162 | + return <Fragment>上一页</Fragment>; |
| 163 | + case "nextPage": |
| 164 | + return <Fragment>下一页</Fragment>; |
| 165 | + |
| 166 | + // Site notice |
| 167 | + case "siteNoticeBannerTitle": |
| 168 | + return <Fragment>注意 / Info</Fragment>; |
| 169 | + case "siteNoticeBannerDescription": |
| 170 | + return ( |
| 171 | + <Fragment> |
| 172 | + 本站经 Typst GmbH 许可,提供{" "} |
| 173 | + <a href={typstOfficialDocsUrl}>Typst v{version} 官方文档</a>的翻译,由 |
| 174 | + <a href={githubOrganizationUrl}>中文社区</a>维护。建议与 |
| 175 | + <a href={typstOfficialDocsUrl}>官方文档</a> |
| 176 | + 一同阅读,因为可能存在错译、漏译或过时信息。如有意改进翻译内容或网站本身,可在 |
| 177 | + <a href={githubRepositoryUrl}>GitHub</a>上提出 Issue、发起 Pull |
| 178 | + Requests。此外,也欢迎加入 |
| 179 | + <a href={discordServerUrl}> |
| 180 | + 「Typst 非官方中文交流群」(QQ 793548390) |
| 181 | + </a> |
| 182 | + 。 |
| 183 | + <br /> |
| 184 | + This site provides a Chinese translation of the{" "} |
| 185 | + <a href={typstOfficialDocsUrl}>Typst v{version} documentation</a>{" "} |
| 186 | + maintained by the “ |
| 187 | + <a href={githubOrganizationUrl}>Typst Chinese Community</a>” with |
| 188 | + permission from Typst GmbH. We recommend using this alongside the{" "} |
| 189 | + <a href={typstOfficialDocsUrl}>official documentation</a>. We welcome |
| 190 | + contributions through Issues and Pull Requests on{" "} |
| 191 | + <a href={githubRepositoryUrl}>our GitHub repository</a> for both |
| 192 | + translation improvements and website enhancements. Feel free to join{" "} |
| 193 | + <a href={discordServerUrl}> |
| 194 | + our QQ chat group “Typst 非官方中文交流群” (793548390) |
| 195 | + </a> |
| 196 | + . |
| 197 | + </Fragment> |
| 198 | + ); |
| 199 | + |
| 200 | + default: |
| 201 | + return null; |
| 202 | + } |
| 203 | +}; |
0 commit comments