Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
24 lines
933 B
Markdown
24 lines
933 B
Markdown
---
|
|
title: i18n
|
|
---
|
|
# Service: `i18n`
|
|
|
|
The `i18n` service handles internationalization and localization, allowing the application to support multiple languages.
|
|
|
|
## Methods
|
|
|
|
### `func SetLanguage(lang string) error`
|
|
|
|
`SetLanguage` sets the active application language. It loads the appropriate message bundle for the specified language tag (e.g., "en-US", "fr").
|
|
|
|
### `func Translate(messageID string) string`
|
|
|
|
`Translate` retrieves the localized string for the given `messageID` in the current active language. If no translation is found, it may return the ID or a fallback.
|
|
|
|
### `func HandleIPCEvents(c *core.Core, msg core.Message) error`
|
|
|
|
`HandleIPCEvents` handles IPC messages related to language changes or translation requests.
|
|
|
|
### `func ServiceStartup(ctx context.Context, options application.ServiceOptions) error`
|
|
|
|
`ServiceStartup` initializes the i18n service, loading available languages and setting the default locale.
|