🏗️ Updated Language domain usage in main

This commit is contained in:
Maxim Lebedev 2023-11-13 05:19:53 +06:00
parent 2c23c74118
commit c9db0f0ce0
Signed by: toby3d
GPG Key ID: 1F14E25B7C119FC5
1 changed files with 3 additions and 4 deletions

View File

@ -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, ", "))