Skip to content

hugo-fixit/shortcode-missing-translation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shortcode-missing-translation | FixIt

image image

用于多语言站点,缺少翻译时暂时以指定的语言呈现当前页面翻译的内容。

简体中文 | 繁體中文 | English | Français | Русский язык | Español | हिन्दी | deutsch | 한국어 | しろうと

要求

适用于所有 Hugo 主题。

安装组件

安装方式与 安装主题 相同,有多种安装方式,任选一种即可,这里介绍两种主流方式。

作为 Hugo 模块安装

首先确保你的项目本身是一个 Hugo 模块

然后将此主题组件添加到你的 hugo.toml 配置文件中:

[module]
  [[module.imports]]
    path = "github.com/hugo-fixit/FixIt"
  [[module.imports]]
    path = "github.com/hugo-fixit/shortcode-missing-translation"

在 Hugo 的第一次启动时,它将下载所需的文件。

要更新到模块的最新版本,请运行:

hugo mod get -u
hugo mod tidy

作为 Git 子模块安装

FixIt 和此 git 存储库克隆到你的主题文件夹中,并将其作为网站目录的子模块添加。

git submodule add https://github.com/hugo-fixit/FixIt.git themes/FixIt
git submodule add https://github.com/hugo-fixit/shortcode-missing-translation.git themes/shortcode-missing-translation

接下来编辑项目的 hugo.toml 并将此主题组件添加到你的主题中:

theme = ["FixIt", "shortcode-missing-translation"]

配置

[gitInfo]
  repo = "https://github.com/hugo-fixit/docs"
  branch = "main"
  # 相对于仓库根目录的内容目录路径
  dir = "content"

使用 Shortcode

以下是一个使用示例:

{{< missing-translation >}}

Tip

请至少保证有一个语言的翻译内容,如果有多个语言的翻译内容,默认选择第一个翻译内容。

或者,指定已有翻译语言:

{{< missing-translation "en" >}}

参考

About

A Hugo theme component with missing-translation shortcode.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages