aboutsummaryrefslogtreecommitdiffhomepage
path: root/locale/parser.go
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2018-09-21 18:53:29 -0700
committerGravatar Frédéric Guillot <fred@miniflux.net>2018-09-21 22:23:23 -0700
commitbeb7a0cfcb6a5a76d680707a4c458eee51d87c07 (patch)
treef6e23ffbffcdd58f8438e2d2711acb4fa86bb83b /locale/parser.go
parentf244df62936eea307a5fc3f27fb9968527d402ac (diff)
Use unique translation IDs instead of English text as key
Diffstat (limited to 'locale/parser.go')
-rw-r--r--locale/parser.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/locale/parser.go b/locale/parser.go
new file mode 100644
index 0000000..03591c1
--- /dev/null
+++ b/locale/parser.go
@@ -0,0 +1,21 @@
+// Copyright 2018 Frédéric Guillot. All rights reserved.
+// Use of this source code is governed by the Apache 2.0
+// license that can be found in the LICENSE file.
+
+package locale // import "miniflux.app/locale"
+
+import (
+ "encoding/json"
+ "fmt"
+)
+
+type catalogMessages map[string]interface{}
+type catalog map[string]catalogMessages
+
+func parseCatalogMessages(data string) (catalogMessages, error) {
+ var translations catalogMessages
+ if err := json.Unmarshal([]byte(data), &translations); err != nil {
+ return nil, fmt.Errorf("invalid translation file: %v", err)
+ }
+ return translations, nil
+}