locales

package
v1.0.22 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Default = StdConfig("default").Build()
)

Functions

func MustLocalize

func MustLocalize(ctx *ginserver.Context, localizeConfig *i18n.LocalizeConfig) string

func NewLocalizer

func NewLocalizer(languages ...string) *i18n.Localizer

Types

type Config

type Config struct {
	LanguageDir string `config:"languageDir" desc:"language files directory"`
	// contains filtered or unexported fields
}

Config 配置

func DefaultConfig

func DefaultConfig(key string) *Config

DefaultConfig 默认配置

func StdConfig

func StdConfig(key string, optionFunc ...OptionFunc) *Config

StdConfig 标准配置

func (*Config) Build

func (c *Config) Build() *Locales

Build 构建实例

func (*Config) Path

func (c *Config) Path() string

Path 实例配置目录

type Locales

type Locales struct {
	// contains filtered or unexported fields
}

func (*Locales) MustLocalize

func (locales *Locales) MustLocalize(ctx *ginserver.Context, localizeConfig *i18n.LocalizeConfig) string

func (*Locales) NewLocalizer

func (locales *Locales) NewLocalizer(languages ...string) *i18n.Localizer

type OptionFunc

type OptionFunc func(*Config)

OptionFunc 选项信息

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL