debian/go/src/github.com/gohugoio/go-i18n/v2/i18n/bundlefs.go
raw| 1 | package i18n |
| 2 | |
| 3 | import ( |
| 4 | "io/fs" |
| 5 | ) |
| 6 | |
| 7 | // LoadMessageFileFS is like LoadMessageFile but instead of reading from the |
| 8 | // hosts operating system's file system it reads from the fs file system. |
| 9 | func (b *Bundle) LoadMessageFileFS(fsys fs.FS, path string) (*MessageFile, error) { |
| 10 | buf, err := fs.ReadFile(fsys, path) |
| 11 | if err != nil { |
| 12 | return nil, err |
| 13 | } |
| 14 | |
| 15 | return b.ParseMessageFileBytes(buf, path) |
| 16 | } |