localization

package
v0.51.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package localization resolves stable SpeechKit message IDs against the repository-owned locale catalogs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveLocale

func ResolveLocale(locale string) string

ResolveLocale performs deterministic BCP-47 negotiation for the registered catalogs. Supported regional variants fall back to their registered base language. Simplified Chinese variants resolve to zh-Hans; traditional Chinese and unsupported languages fall back to English.

func SupportedLocales

func SupportedLocales() []string

SupportedLocales returns the initial SpeechKit locale set. English is the source locale and final fallback.

func Text

func Text(locale string, id MessageID) string

Text returns the localized text for id. Missing locale entries fall back to English. An unknown message ID returns an empty string so callers cannot accidentally surface the identifier itself as customer prose.

Types

type Message

type Message struct {
	ID     MessageID
	Locale string
	Text   string
}

Message is one catalog result with the negotiated locale that must also be used for result metadata and TTS.

func Resolve

func Resolve(locale string, id MessageID) Message

Resolve negotiates the locale once and resolves id from that exact catalog.

type MessageID

type MessageID string

MessageID is a stable semantic identifier for customer-facing prose.

const (
	CompanionHomeAssistantNotConfigured MessageID = "companion.home_assistant.not_configured"
	CompanionHomeAssistantCommandEmpty  MessageID = "companion.home_assistant.command.empty"
	CompanionHomeAssistantNotMatched    MessageID = "companion.home_assistant.command.not_matched"
	CompanionHomeAssistantRejected      MessageID = "companion.home_assistant.command.rejected"
	CompanionHomeAssistantUnavailable   MessageID = "companion.home_assistant.unavailable"
)

Jump to

Keyboard shortcuts

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