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

github.com/gohugoio/go-i18n.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--v2/i18n/bundlefs.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/v2/i18n/bundlefs.go b/v2/i18n/bundlefs.go
new file mode 100644
index 0000000..50c794b
--- /dev/null
+++ b/v2/i18n/bundlefs.go
@@ -0,0 +1,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)
+}