Discover Packages
github.com/issue9/localeutil
message
package
Version:
v0.24.1
Opens a new window with list of versions in this module.
Published: Nov 23, 2023
License: MIT
Opens a new window with license information.
Imports: 5
Opens a new window with list of imports.
Imported by: 2
Opens a new window with list of known importers.
Documentation
Documentation
¶
type Case struct {
Case string `xml:"case,attr" json:"case" yaml:"case"`
Value string `xml:",chardata"`
}
type Language struct {
XMLName struct{} `xml:"language" json:"-" yaml:"-"`
ID language .Tag `xml:"id,attr" json:"id" yaml:"id"`
Messages []Message `xml:"message" json:"messages" yaml:"messages"`
}
Language 某一语言的本地化内容
Join 将 l2.Messages 并入 l.Messages
执行以下操作:
-如果 l2 的 [Message.Key] 存在于 l,则覆盖 l 的项;
-如果 l2 的 [Message.Key] 不存在于 l,则写入 l;
Merge 将 l.Messages 写入 dest 中的每个元素
这将会执行以下几个步骤:
-删除只存在于 dest 元素中而不存在于 l 的内容;
-将 l 独有的项写入 dest;
最终内容是 dest 为准。
log 所有删除的记录都将通过此输出;
type Message struct {
Key string `xml:"key" json:"key" yaml:"key"`
Message Text `xml:"message" json:"message" yaml:"message"`
}
Message 单条本地化内容
type Select struct {
Arg int `xml:"arg,attr" json:"arg" yaml:"arg"`
Format string `xml:"format,attr,omitempty" json:"format,omitempty" yaml:"format,omitempty"`
Cases []*Case `xml:"case,omitempty" json:"cases,omitempty" yaml:"cases,omitempty"`
}
type Text struct {
Msg string `xml:"msg,omitempty" json:"msg,omitempty" yaml:"msg,omitempty"`
Select *Select `xml:"select,omitempty" json:"select,omitempty" yaml:"select,omitempty"`
Vars []*Var `xml:"var,omitempty" json:"vars,omitempty" yaml:"vars,omitempty"`
}
type Var struct {
Name string `xml:"name,attr" json:"name" yaml:"name"`
Arg int `xml:"arg,attr" json:"arg" yaml:"arg"`
Format string `xml:"format,attr,omitempty" json:"format,omitempty" yaml:"format,omitempty"`
Cases []*Case `xml:"case,omitempty" json:"cases,omitempty" yaml:"cases,omitempty"`
}
Source Files
¶
Directories
¶
Package extract 提供从 Go 源码中提取本地化内容的功能
Package extract 提供从 Go 源码中提取本地化内容的功能
Package serialize 提供对 message 包的序列化操作
Package serialize 提供对 message 包的序列化操作
Click to show internal directories.
Click to hide internal directories.