Skip to content

Commit

Permalink
Add Chinese docs for help, contribution and development (go-gitea#24925
Browse files Browse the repository at this point in the history
…) (go-gitea#25011)

Backport go-gitea#24925, partially backport go-gitea#24934
(`docs/content/doc/help/faq.zh-cn.md` file)

Part of backport has already done by go-gitea#24942

Also backport go-gitea#24881 to avoid "deadlock"

---------

Co-authored-by: Zettat123 <zettat123@gmail.com>
(cherry picked from commit 37b73b3)
  • Loading branch information
HesterG authored and earl-warren committed Jun 5, 2023
1 parent 35c503f commit 3f4a67e
Show file tree
Hide file tree
Showing 18 changed files with 2,705 additions and 0 deletions.
40 changes: 40 additions & 0 deletions docs/content/doc/administration/adding-legal-pages.zh-cn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
date: "2023-05-23T09:00:00+08:00"
title: "添加法律页面"
slug: adding-legal-pages
weight: 110
toc: false
draft: false
aliases:
- /zh-cn/adding-legal-pages
menu:
sidebar:
parent: "administration"
name: "添加法律页面"
identifier: "adding-legal-pages"
weight: 110
---

一些法域(例如欧盟)要求在网站上添加特定的法律页面(例如隐私政策)。按照以下步骤将它们添加到你的 Gitea 实例中。

## 获取页面

Gitea 源代码附带了示例页面,位于 `contrib/legal` 目录中。将它们复制到 `custom/public/` 目录下。例如,如果要添加隐私政策:

```
wget -O /path/to/custom/public/privacy.html https://raw.githubusercontent.com/go-gitea/gitea/main/contrib/legal/privacy.html.sample
```

现在,你需要编辑该页面以满足你的需求。特别是,你必须更改电子邮件地址、网址以及与 "Your Gitea Instance" 相关的引用,以匹配你的情况。

请务必不要放置会暗示 Gitea 项目对你的服务器负责的一般服务条款或隐私声明。

## 使其可见

创建或追加到 `/path/to/custom/templates/custom/extra_links_footer.tmpl` 文件中:

```go
<a class="item" href="{{AppSubUrl}}/assets/privacy.html">隐私政策</a>
```

重启 Gitea 以查看更改。
105 changes: 105 additions & 0 deletions docs/content/doc/administration/cmd-embedded.zh-cn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
---
date: "2023-05-23T09:00:00+08:00"
title: "嵌入资源提取工具"
slug: "cmd-embedded"
weight: 20
toc: false
draft: false
aliases:
- /zh-cn/cmd-embedded
menu:
sidebar:
parent: "administration"
name: "嵌入资源提取工具"
weight: 20
identifier: "cmd-embedded"
---

# 嵌入资源提取工具

**目录**

{{< toc >}}

Gitea 的可执行文件包含了运行所需的所有资源:模板、图片、样式表和翻译文件。你可以通过在 `custom` 目录下的相应路径中放置替换文件来覆盖其中的任何资源(详见 [自定义 Gitea 配置]({{< relref "doc/administration/customizing-gitea.zh-cn.md" >}}))。

要获取嵌入资源的副本以进行编辑,可以使用 CLI 中的 `embedded` 命令,通过操作系统的 shell 执行。

**注意:** 嵌入资源提取工具包含在 Gitea 1.12 及以上版本中。

## 资源列表

要列出嵌入在 Gitea 可执行文件中的资源,请使用以下语法:

```sh
gitea embedded list [--include-vendored] [patterns...]
```

`--include-vendored` 标志使命令包括被供应的文件,这些文件通常被排除在外;即来自外部库的文件,这些文件是 Gitea 所需的(例如 [octicons](https://octicons.github.com/) 等)。

可以提供一系列文件搜索模式。Gitea 使用 [gobwas/glob](https://github.com/gobwas/glob) 作为其 glob 语法。以下是一些示例:

- 列出所有模板文件,无论在哪个虚拟目录下:`**.tmpl`
- 列出所有邮件模板文件:`templates/mail/**.tmpl`
- 列出 `public/img` 目录下的所有文件:`public/img/**`

不要忘记为模式使用引号,因为空格、`*` 和其他字符可能对命令行解释器有特殊含义。

如果未提供模式,则列出所有文件。

### 示例

列出所有路径中包含 `openid` 的嵌入文件:

```sh
$ gitea embedded list '**openid**'
public/img/auth/openid_connect.svg
public/img/openid-16x16.png
templates/user/auth/finalize_openid.tmpl
templates/user/auth/signin_openid.tmpl
templates/user/auth/signup_openid_connect.tmpl
templates/user/auth/signup_openid_navbar.tmpl
templates/user/auth/signup_openid_register.tmpl
templates/user/settings/security_openid.tmpl
```

## 提取资源

要提取嵌入在 Gitea 可执行文件中的资源,请使用以下语法:

```sh
gitea [--config {file}] embedded extract [--destination {dir}|--custom] [--overwrite|--rename] [--include-vendored] {patterns...}
```

`--config` 选项用于告知 Gitea `app.ini` 配置文件的位置(如果不在默认位置)。此选项仅在使用 `--custom` 标志时使用。

`--destination` 选项用于指定提取文件的目标目录。默认为当前目录。

`--custom` 标志告知 Gitea 直接将文件提取到 `custom` 目录中。为使其正常工作,该命令需要知道 `app.ini` 配置文件的位置(通过 `--config` 指定),并且根据配置的不同,需要从 Gitea 通常启动的目录运行。有关详细信息,请参阅 [自定义 Gitea 配置]({{< relref "doc/administration/customizing-gitea.zh-cn.md" >}})。

`--overwrite` 标志允许覆盖目标目录中的任何现有文件。

`--rename` 标志告知 Gitea 将目标目录中的任何现有文件重命名为 `filename.bak`。之前的 `.bak` 文件将被覆盖。

至少需要提供一个文件搜索模式;有关模式的语法和示例,请参阅上述 `list` 子命令。

### 重要提示

请确保**只提取需要自定义的文件**。位于 `custom` 目录中的文件不会受到 Gitea 的升级过程的影响。当 Gitea 升级到新版本(通过替换可执行文件)时,许多嵌入文件将发生变化。Gitea 将尊重并使用在 `custom` 目录中找到的任何文件,即使这些文件是旧的和不兼容的。

### 示例

将邮件模板提取到临时目录:

```sh
$ mkdir tempdir
$ gitea embedded extract --destination tempdir 'templates/mail/**.tmpl'
Extracting to tempdir:
tempdir/templates/mail/auth/activate.tmpl
tempdir/templates/mail/auth/activate_email.tmpl
tempdir/templates/mail/auth/register_notify.tmpl
tempdir/templates/mail/auth/reset_passwd.tmpl
tempdir/templates/mail/issue/assigned.tmpl
tempdir/templates/mail/issue/default.tmpl
tempdir/templates/mail/notify/collaborator.tmpl
```
Loading

0 comments on commit 3f4a67e

Please sign in to comment.