i18n

package
v0.0.0-...-efb0f5e Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2025 License: EUPL-1.2 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(c *core.Core) (any, error)

Register is the constructor for dynamic dependency injection (used with core.WithService). It creates a Service instance and initializes its core.Runtime field. Dependencies are injected during ServiceStartup.

Types

type Options

type Options struct{}

Options holds configuration for the i18n service.

type Service

type Service struct {
	*core.Runtime[Options]
	// contains filtered or unexported fields
}

Service provides internationalization and localization.

func New

func New() (*Service, error)

New is the constructor for static dependency injection. It creates a Service instance without initializing the core.Runtime field. Dependencies are passed directly here.

func (*Service) HandleIPCEvents

func (s *Service) HandleIPCEvents(c *core.Core, msg core.Message) error

HandleIPCEvents processes IPC messages, including injecting dependencies on startup.

func (*Service) ServiceStartup

func (s *Service) ServiceStartup(context.Context, application.ServiceOptions) error

ServiceStartup is called when the app starts, after dependencies are injected.

func (*Service) SetBundle

func (s *Service) SetBundle(bundle *i18n.Bundle)

SetBundle is a test helper to inject a bundle.

func (*Service) SetLanguage

func (s *Service) SetLanguage(lang string) error

func (*Service) Translate

func (s *Service) Translate(messageID string) string