Documentation
¶
Index ¶
- Constants
- func DetectLanguage(service LanguageService, resolver ProfileLanguageResolver) echo.MiddlewareFunc
- func LanguageFromContext(ctx context.Context) string
- func LanguageSwitcherURL(currentURL string, lang string) string
- func LocaleDir() string
- func New(cfg *config.Config) core.I18n
- func WithLanguage(ctx context.Context, lang string) context.Context
- type LanguageService
- type Module
- type Options
- type ProfileLanguageResolver
- type Service
- func (s *Service) DefaultLanguage() string
- func (s *Service) NormalizeLanguage(raw string) string
- func (s *Service) SupportedLanguages() []string
- func (s *Service) T(ctx context.Context, key string, templateData ...map[string]any) string
- func (s *Service) TC(ctx context.Context, key string, count any, templateData ...map[string]any) string
- func (s *Service) TS(ctx context.Context, key string, choice string, templateData ...map[string]any) string
Constants ¶
View Source
const ModuleID = "i18n"
Variables ¶
This section is empty.
Functions ¶
func DetectLanguage ¶
func DetectLanguage(service LanguageService, resolver ProfileLanguageResolver) echo.MiddlewareFunc
func LanguageFromContext ¶
func LanguageSwitcherURL ¶
LanguageSwitcherURL preserves current route/query while switching the `lang` query value.
Types ¶
type LanguageService ¶
type ProfileLanguageResolver ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) DefaultLanguage ¶
func (*Service) NormalizeLanguage ¶
func (*Service) SupportedLanguages ¶
Click to show internal directories.
Click to hide internal directories.