localization

package
v0.68.39 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 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 (
	DesktopCaptureBusy MessageID = "desktop.capture.busy"

	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"

	// Network-scope display names shown wherever a scope is named to the user.
	PrivacyScopeOpenName         MessageID = "sk.privacy.scope.open"
	PrivacyScopeLocalNetworkName MessageID = "sk.privacy.scope.local_network"
	PrivacyScopeDeviceOnlyName   MessageID = "sk.privacy.scope.device_only"

	// Disabled-reason prose for the stable reason IDs attached by the
	// network-scope policy (see NetworkScopeReason* in pkg/speechkit).
	PrivacyDisabledCloudProvider   MessageID = "sk.privacy.disabled.cloud_provider"
	PrivacyDisabledLocalService    MessageID = "sk.privacy.disabled.local_service_in_device_only"
	PrivacyDisabledServerScope     MessageID = "sk.privacy.disabled.server_in_device_only"
	PrivacyDisabledServerNotLocal  MessageID = "sk.privacy.disabled.server_url_not_local"
	PrivacyDisabledAgentBridge     MessageID = "sk.privacy.disabled.agent_bridge"
	PrivacyDisabledHomeAssistant   MessageID = "sk.privacy.disabled.home_assistant"
	PrivacyDisabledEdgeBeta        MessageID = "sk.privacy.disabled.edge_beta"
	PrivacyDisabledSetupTraffic    MessageID = "sk.privacy.disabled.setup_traffic"
	PrivacyDisabledTelemetry       MessageID = "sk.privacy.disabled.telemetry"
	PrivacyDisabledCloudAccount    MessageID = "sk.privacy.disabled.cloud_account"
	PrivacyDisabledVoiceAgentCloud MessageID = "sk.privacy.disabled.voice_agent_cloud"

	// Retention-scope display names and disabled reasons (see RetentionScope
	// and RetentionScopeReason* in pkg/speechkit). The retention axis is
	// orthogonal to the network scope: it says what outlives the work, not
	// where the process may reach.
	PrivacyRetentionRetainName      MessageID = "sk.privacy.retention.retain"
	PrivacyRetentionEphemeralName   MessageID = "sk.privacy.retention.ephemeral"
	PrivacyDisabledRetentionEphemer MessageID = "sk.privacy.disabled.retention_ephemeral"
	PrivacyDisabledProviderRetains  MessageID = "sk.privacy.disabled.provider_retains"

	// Meeting Mode screenshot status prose. These mirror the stable status
	// codes emitted by internal/meetingsnapshot so the device UI can surface
	// selecting/capturing/saving/saved/cancelled/error accessibly and
	// translated. Captures stay local; none of these strings name a window.
	MeetingSnapshotSelecting MessageID = "meeting.snapshot.selecting"
	MeetingSnapshotCapturing MessageID = "meeting.snapshot.capturing"
	MeetingSnapshotSaving    MessageID = "meeting.snapshot.saving"
	MeetingSnapshotSaved     MessageID = "meeting.snapshot.saved"
	MeetingSnapshotCancelled MessageID = "meeting.snapshot.cancelled"
	MeetingSnapshotError     MessageID = "meeting.snapshot.error"
)

Jump to

Keyboard shortcuts

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