Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

add template language

aichy1261860f3ecef43
diff --git a/internal/controller/template_controller.go b/internal/controller/template_controller.go
index 0d4bd3f0..3a2bd095 100644
--- a/internal/controller/template_controller.go
+++ b/internal/controller/template_controller.go
@@ -470,6 +470,8 @@ func (tc *TemplateController) html(ctx *gin.Context, code int, tpl string, siteI
data["description"] = siteInfo.Description
data["language"] = handler.GetLang(ctx)
data["timezone"] = siteInfo.Interface.TimeZone
+ language := strings.Replace(siteInfo.Interface.Language, "_", "-", -1)
+ data["lang"] = language
data["HeadCode"] = siteInfo.CustomCssHtml.CustomHead
data["HeaderCode"] = siteInfo.CustomCssHtml.CustomHeader
data["FooterCode"] = siteInfo.CustomCssHtml.CustomFooter
diff --git a/ui/template/header.html b/ui/template/header.html
index f43213ad..52e40765 100644
--- a/ui/template/header.html
+++ b/ui/template/header.html
@@ -1,6 +1,6 @@
{{define "header"}}
<!DOCTYPE html>
-<html>
+<html lang="{{.lang}}">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />