Skip to main content

i18n.go (package eai)

Source: sdks/go/i18n.go. Back to the Go SDK reference index.

note

This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.

Functions​

HasMessage​

HasMessage(lang string, key string) bool

HasMessage reports whether key exists in the catalog.

NameTypeDefaultRequiredDescription
langstringyesLanguage; a value starting with fr selects French, anything else English.
keystringyesMessage key, for example error.not_found.

Returns: bool. true when the catalog of that language has the key.

Message​

Message(lang string, key string, args ...any) string

Message returns the localized message for key ("en" or "fr"), replacing {0}, {1}... with args. Unknown keys return the key.

NameTypeDefaultRequiredDescription
langstringyesLanguage; a value starting with fr selects French, anything else English.
keystringyesMessage key, for example error.not_found.
args...anynoValues put in place of {0}, {1}... in their order.

Returns: string. The localized message with its placeholders replaced, or key itself when unknown.