func GetMessageRegistryByLanguage(
	c common.Client,
	link string,
	registry string,
	language string,
) (*MessageRegistry, error) {
	registry = strings.TrimSpace(registry)
	if registry == "" {
		return nil, fmt.Errorf("received empty registry")
	}
	language = strings.TrimSpace(language)
	if language == "" {
		return nil, fmt.Errorf("received empty language")
	}
	links, err := common.GetCollection(c, link)
	if err != nil {
		return nil, err
	}
	for _, sLink := range links.ItemLinks {
		s, err := GetMessageRegistryFile(c, sLink)
		if err != nil {
			return nil, err
		}
		if s.Registry == registry {
			for _, location := range s.Location {
				if location.Language == language {
					return GetMessageRegistry(c, location.URI)
				}
			}
		}
	}
	return nil, fmt.Errorf("message registry not found")
}
GetMessageRegistryByLanguage gets the message registry by language.
registry is used to identify the correct Message Registry
file (MessageRegistryFile.Registry) and it shall contain the
Message Registry name and it major and minor versions, as defined
by the Redfish Specification.
language is the RFC5646-conformant language code for the message registry.
package redfish
import (
	"encoding/json"
	"fmt"
	"strings"
	"github.com/stmcginnis/gofish/common"
)
const MessageIDSectionLength = 4
type MessageRegistryMessage struct {
	Description string
	Message string
	Severity string
	MessageSeverity string
	NumberOfArgs int
	ParamTypes []string
	Resolution string
	Oem interface{}
}
type MessageRegistry struct {
	common.Entity
	ODataType string `json:"@odata.type"`
	Description string
	RegistryPrefix string
	RegistryVersion string
	Language string
	OwningEntity string
	Messages map[string]MessageRegistryMessage
}
func GetMessageRegistry(
	c common.Client,
	uri string,
) (*MessageRegistry, error) {
	resp, err := c.Get(uri)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	var t MessageRegistry
	err = json.NewDecoder(resp.Body).Decode(&t)
	if err != nil {
		return nil, err
	}
	return &t, nil
}
func ListReferencedMessageRegistries(
	c common.Client,
	link string,
) ([]*MessageRegistry, error) {
	var result []*MessageRegistry
	links, err := common.GetCollection(c, link)
	if err != nil {
		return nil, err
	}
	for _, sLink := range links.ItemLinks {
		mrf, err := GetMessageRegistryFile(c, sLink)
		if err != nil {
			return nil, err
		}
		for _, location := range mrf.Location {
			mr, err := GetMessageRegistry(c, location.URI)
			if err != nil {
				return nil, err
			}
			result = append(result, mr)
		}
	}
	return result, nil
}
func ListReferencedMessageRegistriesByLanguage(
	c common.Client,
	link string,
	language string,
) ([]*MessageRegistry, error) {
	language = strings.TrimSpace(language)
	if language == "" {
		return nil, fmt.Errorf("received empty language")
	}
	var result []*MessageRegistry
	links, err := common.GetCollection(c, link)
	if err != nil {
		return nil, err
	}
	for _, sLink := range links.ItemLinks {
		mrf, err := GetMessageRegistryFile(c, sLink)
		if err != nil {
			return nil, err
		}
		for _, location := range mrf.Location {
			if location.Language == language {
				mr, err := GetMessageRegistry(c, location.URI)
				if err != nil {
					return nil, err
				}
				result = append(result, mr)
			}
		}
	}
	return result, nil
}