diff --git a/.github/README.zh-Hans.md b/.github/README.zh-Hans.md index 1be45ce1..bd71f100 100644 --- a/.github/README.zh-Hans.md +++ b/.github/README.zh-Hans.md @@ -38,6 +38,15 @@ bundle.RegisterUnmarshalFunc("toml", toml.Unmarshal) bundle.LoadMessageFile("es.toml") ``` +```go +// 如果使用 go:embed +//go:embed locale.*.toml +var LocaleFS embed.FS + +bundle.RegisterUnmarshalFunc("toml", toml.Unmarshal) +bundle.LoadMessageFileFS(LocaleFS, "locale.es.toml") +``` + 创建一个 Localizer 以用于一组语言首选项。 ```go diff --git a/README.md b/README.md index 0856dc8d..4136baed 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,15 @@ bundle.RegisterUnmarshalFunc("toml", toml.Unmarshal) bundle.LoadMessageFile("es.toml") ``` +```go +// If use go:embed +//go:embed locale.*.toml +var LocaleFS embed.FS + +bundle.RegisterUnmarshalFunc("toml", toml.Unmarshal) +bundle.LoadMessageFileFS(LocaleFS, "locale.es.toml") +``` + Create a Localizer to use for a set of language preferences. ```go