parser.go 598 B

123456789101112131415161718192021
  1. // Copyright 2018 Frédéric Guillot. All rights reserved.
  2. // Use of this source code is governed by the Apache 2.0
  3. // license that can be found in the LICENSE file.
  4. package locale // import "miniflux.app/locale"
  5. import (
  6. "encoding/json"
  7. "fmt"
  8. )
  9. type catalogMessages map[string]interface{}
  10. type catalog map[string]catalogMessages
  11. func parseCatalogMessages(data string) (catalogMessages, error) {
  12. var translations catalogMessages
  13. if err := json.Unmarshal([]byte(data), &translations); err != nil {
  14. return nil, fmt.Errorf("invalid translation file: %v", err)
  15. }
  16. return translations, nil
  17. }