i18n

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

i18n checker — validates translation completeness across protocols.

Index

Constants

This section is empty.

Variables

View Source
var CliFS embed.FS
View Source
var SupportedLanguages = []string{"en", "zh", "ja", "ko", "de", "fr", "es", "pt", "ru"}

SupportedLanguages lists all supported languages.

Functions

func FormatTranslationReport

func FormatTranslationReport(statuses []*TranslationStatus) string

FormatTranslationReport formats translation status as a report.

Types

type Bundle

type Bundle struct {
	// contains filtered or unexported fields
}

Bundle holds loaded translations for a specific domain (e.g. "cli").

func NewBundle

func NewBundle() *Bundle

NewBundle creates an empty Bundle.

func (*Bundle) Get

func (b *Bundle) Get(lang, key string) string

Get returns the message for the given language and key. Falls back to English, then returns the key itself.

func (*Bundle) LoadFS

func (b *Bundle) LoadFS(fs embed.FS, dir string) error

LoadFS loads all JSON files from an embed.FS directory. Each file name (without .json) is treated as a language code.

type TranslationStatus

type TranslationStatus struct {
	Protocol     string   `json:"protocol"`
	Languages    []string `json:"languages"`
	Missing      []string `json:"missing"`
	Completeness float64  `json:"completeness"` // 0.0 to 1.0
}

TranslationStatus represents the translation status of a protocol.

func CheckTranslation

func CheckTranslation(title, description map[string]string) *TranslationStatus

CheckTranslation checks translation completeness for a protocol's meta.

Jump to

Keyboard shortcuts

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