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.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
lang | string | yes | Language; a value starting with fr selects French, anything else English. | |
key | string | yes | Message 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.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
lang | string | yes | Language; a value starting with fr selects French, anything else English. | |
key | string | yes | Message key, for example error.not_found. | |
args | ...any | no | Values put in place of {0}, {1}... in their order. |
Returns: string. The localized message with its placeholders replaced, or key itself when unknown.