日本語

The hypersig_i18n crate

Translations the compiler checks

Each text holds its translations in one value, so a text without one of them fails to compile. The language is part of each page's route, and / redirects to the page in the language the browser asks for.

A missing translation fails to compile

A text is a struct with one field per language, so a text without its Japanese, or a language added without its texts, is a compile error.

The language is in the route

A locale is the first segment of a page's route, so the link to the page in another language is checked like any other link.

No macro

The texts are plain struct literals and the languages a plain enum, so the compiler's own checks find what is missing.

A text without its translation

A text without its Japanese is a compile error at that line. Overview shows how the languages are declared.

// error[E0063]: missing field `ja` in initializer of `ByLang<_>`
let title = ByLang { en: "Settings" };

Part of hypersig

This site is translated with it: every page is rendered once per language from the same Rust function.