Skip to main content
Version: 1.16.x

GoFrame 框架提供了常用的 I18N 国际化组件,由 gi18n 模块实现。

使用方式

import "github.com/gogf/gf/i18n/gi18n"

接口文档

https://pkg.go.dev/github.com/gogf/gf/i18n/gi18n

方法列表:

func GetContent(ctx context.Context, key string) string
func LanguageFromCtx(ctx context.Context) string
func SetDelimiters(left, right string)
func SetLanguage(language string)
func SetPath(path string) error
func T(ctx context.Context, content string) string
func Tf(ctx context.Context, format string, values ...interface{}) string
func Translate(ctx context.Context, content string) string
func TranslateFormat(ctx context.Context, format string, values ...interface{}) string
func WithLanguage(ctx context.Context, language string) context.Context
type Manager
func Instance(name ...string) *Manager
func New(options ...Options) *Manager
func (m *Manager) GetContent(ctx context.Context, key string) string
func (m *Manager) SetDelimiters(left, right string)
func (m *Manager) SetLanguage(language string)
func (m *Manager) SetPath(path string) error
func (m *Manager) T(ctx context.Context, content string) string
func (m *Manager) Tf(ctx context.Context, format string, values ...interface{}) string
func (m *Manager) Translate(ctx context.Context, content string) string
func (m *Manager) TranslateFormat(ctx context.Context, format string, values ...interface{}) string
type Options
func DefaultOptions() Options