Skip to content

Commit 37b73b3

Browse files
HesterGZettat123
andauthored
Add Chinese docs for help, contribution and development (#24925) (#25011)
Backport #24925, partially backport #24934 (`docs/content/doc/help/faq.zh-cn.md` file) Part of backport has already done by #24942 Also backport #24881 to avoid "deadlock" --------- Co-authored-by: Zettat123 <[email protected]>
1 parent d2c9fb0 commit 37b73b3

18 files changed

+2705
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
date: "2023-05-23T09:00:00+08:00"
3+
title: "添加法律页面"
4+
slug: adding-legal-pages
5+
weight: 110
6+
toc: false
7+
draft: false
8+
aliases:
9+
- /zh-cn/adding-legal-pages
10+
menu:
11+
sidebar:
12+
parent: "administration"
13+
name: "添加法律页面"
14+
identifier: "adding-legal-pages"
15+
weight: 110
16+
---
17+
18+
一些法域(例如欧盟)要求在网站上添加特定的法律页面(例如隐私政策)。按照以下步骤将它们添加到你的 Gitea 实例中。
19+
20+
## 获取页面
21+
22+
Gitea 源代码附带了示例页面,位于 `contrib/legal` 目录中。将它们复制到 `custom/public/` 目录下。例如,如果要添加隐私政策:
23+
24+
```
25+
wget -O /path/to/custom/public/privacy.html https://raw.githubusercontent.com/go-gitea/gitea/main/contrib/legal/privacy.html.sample
26+
```
27+
28+
现在,你需要编辑该页面以满足你的需求。特别是,你必须更改电子邮件地址、网址以及与 "Your Gitea Instance" 相关的引用,以匹配你的情况。
29+
30+
请务必不要放置会暗示 Gitea 项目对你的服务器负责的一般服务条款或隐私声明。
31+
32+
## 使其可见
33+
34+
创建或追加到 `/path/to/custom/templates/custom/extra_links_footer.tmpl` 文件中:
35+
36+
```go
37+
<a class="item" href="{{AppSubUrl}}/assets/privacy.html">隐私政策</a>
38+
```
39+
40+
重启 Gitea 以查看更改。
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
---
2+
date: "2023-05-23T09:00:00+08:00"
3+
title: "嵌入资源提取工具"
4+
slug: "cmd-embedded"
5+
weight: 20
6+
toc: false
7+
draft: false
8+
aliases:
9+
- /zh-cn/cmd-embedded
10+
menu:
11+
sidebar:
12+
parent: "administration"
13+
name: "嵌入资源提取工具"
14+
weight: 20
15+
identifier: "cmd-embedded"
16+
---
17+
18+
# 嵌入资源提取工具
19+
20+
**目录**
21+
22+
{{< toc >}}
23+
24+
Gitea 的可执行文件包含了运行所需的所有资源:模板、图片、样式表和翻译文件。你可以通过在 `custom` 目录下的相应路径中放置替换文件来覆盖其中的任何资源(详见 [自定义 Gitea 配置]({{< relref "doc/administration/customizing-gitea.zh-cn.md" >}}))。
25+
26+
要获取嵌入资源的副本以进行编辑,可以使用 CLI 中的 `embedded` 命令,通过操作系统的 shell 执行。
27+
28+
**注意:** 嵌入资源提取工具包含在 Gitea 1.12 及以上版本中。
29+
30+
## 资源列表
31+
32+
要列出嵌入在 Gitea 可执行文件中的资源,请使用以下语法:
33+
34+
```sh
35+
gitea embedded list [--include-vendored] [patterns...]
36+
```
37+
38+
`--include-vendored` 标志使命令包括被供应的文件,这些文件通常被排除在外;即来自外部库的文件,这些文件是 Gitea 所需的(例如 [octicons](https://octicons.github.com/) 等)。
39+
40+
可以提供一系列文件搜索模式。Gitea 使用 [gobwas/glob](https://github.com/gobwas/glob) 作为其 glob 语法。以下是一些示例:
41+
42+
- 列出所有模板文件,无论在哪个虚拟目录下:`**.tmpl`
43+
- 列出所有邮件模板文件:`templates/mail/**.tmpl`
44+
- 列出 `public/img` 目录下的所有文件:`public/img/**`
45+
46+
不要忘记为模式使用引号,因为空格、`*` 和其他字符可能对命令行解释器有特殊含义。
47+
48+
如果未提供模式,则列出所有文件。
49+
50+
### 示例
51+
52+
列出所有路径中包含 `openid` 的嵌入文件:
53+
54+
```sh
55+
$ gitea embedded list '**openid**'
56+
public/img/auth/openid_connect.svg
57+
public/img/openid-16x16.png
58+
templates/user/auth/finalize_openid.tmpl
59+
templates/user/auth/signin_openid.tmpl
60+
templates/user/auth/signup_openid_connect.tmpl
61+
templates/user/auth/signup_openid_navbar.tmpl
62+
templates/user/auth/signup_openid_register.tmpl
63+
templates/user/settings/security_openid.tmpl
64+
```
65+
66+
## 提取资源
67+
68+
要提取嵌入在 Gitea 可执行文件中的资源,请使用以下语法:
69+
70+
```sh
71+
gitea [--config {file}] embedded extract [--destination {dir}|--custom] [--overwrite|--rename] [--include-vendored] {patterns...}
72+
```
73+
74+
`--config` 选项用于告知 Gitea `app.ini` 配置文件的位置(如果不在默认位置)。此选项仅在使用 `--custom` 标志时使用。
75+
76+
`--destination` 选项用于指定提取文件的目标目录。默认为当前目录。
77+
78+
`--custom` 标志告知 Gitea 直接将文件提取到 `custom` 目录中。为使其正常工作,该命令需要知道 `app.ini` 配置文件的位置(通过 `--config` 指定),并且根据配置的不同,需要从 Gitea 通常启动的目录运行。有关详细信息,请参阅 [自定义 Gitea 配置]({{< relref "doc/administration/customizing-gitea.zh-cn.md" >}})。
79+
80+
`--overwrite` 标志允许覆盖目标目录中的任何现有文件。
81+
82+
`--rename` 标志告知 Gitea 将目标目录中的任何现有文件重命名为 `filename.bak`。之前的 `.bak` 文件将被覆盖。
83+
84+
至少需要提供一个文件搜索模式;有关模式的语法和示例,请参阅上述 `list` 子命令。
85+
86+
### 重要提示
87+
88+
请确保**只提取需要自定义的文件**。位于 `custom` 目录中的文件不会受到 Gitea 的升级过程的影响。当 Gitea 升级到新版本(通过替换可执行文件)时,许多嵌入文件将发生变化。Gitea 将尊重并使用在 `custom` 目录中找到的任何文件,即使这些文件是旧的和不兼容的。
89+
90+
### 示例
91+
92+
将邮件模板提取到临时目录:
93+
94+
```sh
95+
$ mkdir tempdir
96+
$ gitea embedded extract --destination tempdir 'templates/mail/**.tmpl'
97+
Extracting to tempdir:
98+
tempdir/templates/mail/auth/activate.tmpl
99+
tempdir/templates/mail/auth/activate_email.tmpl
100+
tempdir/templates/mail/auth/register_notify.tmpl
101+
tempdir/templates/mail/auth/reset_passwd.tmpl
102+
tempdir/templates/mail/issue/assigned.tmpl
103+
tempdir/templates/mail/issue/default.tmpl
104+
tempdir/templates/mail/notify/collaborator.tmpl
105+
```

0 commit comments

Comments
 (0)