🏗️ Updated Language domain usage in main
This commit is contained in:
parent
2c23c74118
commit
c9db0f0ce0
7
main.go
7
main.go
|
@ -98,8 +98,8 @@ func NewApp(ctx context.Context, config *domain.Config) (*App, error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
lang, err := language.Parse(head)
|
lang := domain.NewLanguage(head)
|
||||||
if err != nil || lang == language.Und {
|
if lang == domain.LanguageUnd {
|
||||||
res, err := staticer.Do(r.Context(), r.URL.Path)
|
res, err := staticer.Do(r.Context(), r.URL.Path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, fs.ErrNotExist) {
|
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))
|
contentLanguage := make([]string, len(p.Translations))
|
||||||
for i := range p.Translations {
|
for i := range p.Translations {
|
||||||
base, _ := p.Translations[i].Language.Base()
|
contentLanguage[i] = p.Translations[i].Language.Code()
|
||||||
contentLanguage[i] = base.String()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
w.Header().Set(common.HeaderContentLanguage, strings.Join(contentLanguage, ", "))
|
w.Header().Set(common.HeaderContentLanguage, strings.Join(contentLanguage, ", "))
|
||||||
|
|
Loading…
Reference in New Issue