localization

package
v0.81.12 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 7 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

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

Stability: Stable — no breaking change without a minor version bump and a changelog callout.

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 tells the user the current recording must finish or
	// be cancelled before switching modes.
	DesktopCaptureBusy MessageID = "desktop.capture.busy"

	// Home Assistant smart-home command outcomes reported by the Companion
	// voice skill.
	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"

	// Provider-allowlist disabled reasons (see PolicyReason* in
	// pkg/speechkit): a provider the administrator's allowlist does not name,
	// and a cloud provider a managed host refuses without a machine policy.
	PolicyDisabledProvider        MessageID = "sk.policy.disabled.provider"
	PolicyDisabledNoMachinePolicy MessageID = "sk.policy.disabled.no_machine_policy"

	// Teams transcript preflight outcomes and the reasons a transcript paste is
	// refused (see app/internal/desktop/microsoft365). One stable ID each; the
	// control plane answers with the ID and the client localizes it.
	MeetingPreflightReady                MessageID = "sk.meeting.preflight.ready"
	MeetingPreflightNoTeamsMeeting       MessageID = "sk.meeting.preflight.no_teams_meeting"
	MeetingPreflightSignedOut            MessageID = "sk.meeting.preflight.signed_out"
	MeetingPreflightAdminConsentRequired MessageID = "sk.meeting.preflight.admin_consent_required"
	MeetingPreflightTenantDisabled       MessageID = "sk.meeting.preflight.tenant_disabled"
	MeetingPreflightDisabled             MessageID = "sk.meeting.preflight.disabled"
	MeetingPreflightUnavailable          MessageID = "sk.meeting.preflight.unavailable"
	MeetingPasteRefusedGrantMissing      MessageID = "sk.meeting.paste.refused.grant_missing"
	MeetingPasteRefusedImportOff         MessageID = "sk.meeting.paste.refused.import_off"
	MeetingPasteRefusedPasteOff          MessageID = "sk.meeting.paste.refused.paste_off"
	MeetingPasteRefusedNotFinished       MessageID = "sk.meeting.paste.refused.not_finished"
	MeetingPasteRefusedTranscriptPresent MessageID = "sk.meeting.paste.refused.transcript_present"
	MeetingPasteRefusedTooLarge          MessageID = "sk.meeting.paste.refused.too_large"
	MeetingPasteRefusedUnreadable        MessageID = "sk.meeting.paste.refused.unreadable"

	// Meeting Mode screenshot status prose. These mirror the stable status
	// codes emitted by app/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"
	MeetingSnapshotProtected MessageID = "meeting.snapshot.protected"
	MeetingSnapshotDenied    MessageID = "meeting.snapshot.denied"

	// Notes export statuses (see app/host/meetingexport): one
	// stable ID per state of the export of a meeting to a target such as
	// OneNote, plus the warning a failed export carries while it keeps the
	// meeting's raw material. None of them names a meeting or a destination.
	ExportPending               MessageID = "sk.export.pending"
	ExportSynced                MessageID = "sk.export.synced"
	ExportSignedOut             MessageID = "sk.export.signed_out"
	ExportConsentRequired       MessageID = "sk.export.consent_required"
	ExportDestinationGone       MessageID = "sk.export.destination_gone"
	ExportDestinationFull       MessageID = "sk.export.destination_full"
	ExportDestinationNotAllowed MessageID = "sk.export.destination_not_allowed"
	ExportTooLarge              MessageID = "sk.export.too_large"
	ExportThrottled             MessageID = "sk.export.throttled"
	ExportUnavailable           MessageID = "sk.export.unavailable"
	ExportFailed                MessageID = "sk.export.failed"
	ExportTargetUnavailable     MessageID = "sk.export.target_unavailable"
	ExportNoDestination         MessageID = "sk.export.no_destination"
	ExportReviewNotReady        MessageID = "sk.export.review_not_ready"
	ExportKeptUntilSynced       MessageID = "sk.export.kept_until_synced"

	// Headings the export renderers add to a page, in the review's language.
	ExportLabelBrief       MessageID = "sk.export.label.brief"
	ExportLabelNotes       MessageID = "sk.export.label.notes"
	ExportLabelCitations   MessageID = "sk.export.label.citations"
	ExportLabelScreenshots MessageID = "sk.export.label.screenshots"
	ExportLabelScreenshot  MessageID = "sk.export.label.screenshot"
)

Message IDs that Go code resolves directly. Each must also appear in messageIDs and in every embedded catalog; the package panics at init otherwise.

Jump to

Keyboard shortcuts

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