Skip to content

Latest commit

 

History

History
103 lines (73 loc) · 3.72 KB

File metadata and controls

103 lines (73 loc) · 3.72 KB

shortcode-missing-translation | FixIt

image image

Temporarily renders the translated content of the current page in the specified language when translation is missing.

简体中文 | 繁體中文 | English | Français | Русский язык | Español | हिन्दी | Deutsch | 한국어 | 日本語

Requirements

Applicable to all Hugo themes.

Install Component

The installation method is the same as installing a theme. There are several ways to install, choose one, Here are two mainstream ways.

Install as Hugo Module

First make sure that your project itself is a Hugo module.

Then add this theme component to your hugo.toml configuration file:

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

On the first start of Hugo it will download the required files.

To update to the latest version of the module run:

hugo mod get -u
hugo mod tidy

Install as Git Submodule

Clone FixIt and this git repository into your theme folder and add it as submodules of your website directory.

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

Next edit hugo.toml of your project and add this theme component to your themes:

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

Configuration

[gitInfo]
  repo = "https://github.com/hugo-fixit/docs"
  branch = "main"
  # the content directory path relative to the root of the repository
  dir = "content"

Use Shortcode

Here is an example of usage:

{{< missing-translation >}}

Tip

Please ensure that there is at least one language translation available. If there are multiple language translations, the first one will be selected by default.

Or, specify an existing translation language:

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

Whether to render the original content inside a dashed box. Default is true.

{{< missing-translation original=false >}}

References