From c9db0f0ce0a1649f123bc6e464876efa7a163b0a Mon Sep 17 00:00:00 2001 From: Maxim Lebedev Date: Mon, 13 Nov 2023 05:19:53 +0600 Subject: [PATCH] :building_construction: Updated Language domain usage in main --- main.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 9b2333c..2d3446f 100644 --- a/main.go +++ b/main.go @@ -98,8 +98,8 @@ func NewApp(ctx context.Context, config *domain.Config) (*App, error) { return } - lang, err := language.Parse(head) - if err != nil || lang == language.Und { + lang := domain.NewLanguage(head) + if lang == domain.LanguageUnd { res, err := staticer.Do(r.Context(), r.URL.Path) if err != nil { if errors.Is(err, fs.ErrNotExist) { @@ -155,8 +155,7 @@ func NewApp(ctx context.Context, config *domain.Config) (*App, error) { contentLanguage := make([]string, len(p.Translations)) for i := range p.Translations { - base, _ := p.Translations[i].Language.Base() - contentLanguage[i] = base.String() + contentLanguage[i] = p.Translations[i].Language.Code() } w.Header().Set(common.HeaderContentLanguage, strings.Join(contentLanguage, ", "))