Documentation
¶
Overview ¶
Package extract 提供从 Go 源码中提取本地化内容的功能
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶ added in v0.20.0
type Options struct {
// Language 提取内容的语言 ID
Language language.Tag
// 读取的根目录
//
// 需要位于一个 Go 的模块中。
Root string
// 是否读取子目录的内容
Recursive bool
// 忽略子模块
//
// 当 Recursive 为 true 时,此值为 true,可以不读取子模块的内容。
SkipSubModule bool
// 日志输出通道
Log Logger
// 用于输出本地化内容的函数列表
//
// 每个元素的格式为 mod/path[.struct].func,mod/path 为包的导出路径,
// struct 为结构体名称,可以省略,func 为函数或方法名。
//
// 函数至少需要一个参数,且其第一个参数的类型必须为 string。
// 如果指向的是方法,那么在调用此方法的结构必须有明确类型声明,不能由类型推荐获得。
// 比如,当 f 为 golang.org/x/text/message.Printer.Printf 时:
//
// // 以下无法提取内容
// p := message.NewPrinter();
// p.Printf(...)
//
// // 以下可以
// var p *message.Printer = message.NewPrinter();
// p.Printf(...)
Funcs []string
}
Click to show internal directories.
Click to hide internal directories.