Welcome to mirror list, hosted at ThFree Co, Russian Federation.

bundlefs.go « i18n « v2 - github.com/gohugoio/go-i18n.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 50c794b65c690d7774906b9d34452c1e9a3143a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// +build go1.16

package i18n

import (
	"io/fs"
)

// LoadMessageFileFS is like LoadMessageFile but instead of reading from the
// hosts operating system's file system it reads from the fs file system.
func (b *Bundle) LoadMessageFileFS(fsys fs.FS, path string) (*MessageFile, error) {
	buf, err := fs.ReadFile(fsys, path)
	if err != nil {
		return nil, err
	}

	return b.ParseMessageFileBytes(buf, path)
}