i18n

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildTaxonomiesForLanguage

func BuildTaxonomiesForLanguage(langCode string, pages []*content.Page) map[string]interface{}

BuildTaxonomiesForLanguage generates taxonomy pages scoped to a specific language.

func ContentTreeRoute

func ContentTreeRoute(langCode string) string

ContentTreeRoute determines the content directory path for a language. Returns "content/<lang>/" for language-specific content trees.

func FilterByLanguage

func FilterByLanguage(pages []*content.Page, langCode string) []*content.Page

FilterByLanguage filters a page slice to only include pages for a given language.

func LanguageData

func LanguageData(ctx LanguageContext) map[string]interface{}

LanguageData returns the site.language data cascade entry for a language context.

func LanguageSiteTitle

func LanguageSiteTitle(globalTitle string, langCfg *config.LanguageConfig) string

LanguageSiteTitle returns the site title for a specific language, using the language-specific override if available, falling back to global title.

func LinkTranslations

func LinkTranslations(pages []*content.Page, languages []string) error

LinkTranslations connects pages across languages by matching relative paths. It strips any leading language prefix (matching entries in `languages`) from RelPath before grouping, so "en/about.md" and "fr/about.md" are linked.

func OutputPrefix

func OutputPrefix(langCode string, isRoot bool) string

OutputPrefix returns the output directory prefix for a language. Root languages output at "/" (empty prefix); non-root get "lang/" prefix.

Types

type LanguageContext

type LanguageContext struct {
	Code    string
	Title   string
	Strings map[string]string
	Root    bool
}

LanguageContext holds the active language state during a build.

func BuildLanguageContexts

func BuildLanguageContexts(cfg map[string]*config.LanguageConfig) ([]LanguageContext, error)

BuildLanguageContexts creates a LanguageContext for each declared language. Returns contexts sorted by weight (lowest first = default language).

type TranslationInfo

type TranslationInfo struct {
	URL      string
	LangCode string
}

TranslationInfo holds URL and language code for a page translation.

func GetTranslations

func GetTranslations(page *content.Page) []TranslationInfo

GetTranslations returns translation info for a page's linked translations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL