i18n

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package i18n 提供 binder 共用的语言上下文工具。

取代了旧 *App.langCtx() 和 *App.pickMsg(),让任何 binder 持有 lang 字段后 都能复用同一套规范,把 cago i18n + ai PolicyLang 一次注入到 context。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ctx

func Ctx(ctx context.Context, lang string) context.Context

Ctx 把 lang 同时绑定到 cago i18n 与 ai policy 两套 context key。 每个 binder 在调用 service 前调用一次:service.Foo(i18n.Ctx(b.ctx, b.lang.Lang()), ...)

func Pick

func Pick(lang, zh, en string) string

Pick 按当前语言挑中英文消息。给那些不走 cago i18n 注册表、 但又会展示给用户的小段文案(连接进度、绑定层错误等)用。

Types

This section is empty.

Jump to

Keyboard shortcuts

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