aboutsummaryrefslogtreecommitdiffhomepage
path: root/locale/parser.go
blob: 03591c1f9d3eca8f434cc07782dc2a93ff361279 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
}