fix
This commit is contained in:
parent
b768ec10bd
commit
6bde2bcfd3
@ -3,8 +3,8 @@ package actions
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/fthvgb1/wp-go/helper"
|
"github.com/fthvgb1/wp-go/helper"
|
||||||
|
"github.com/fthvgb1/wp-go/internal/phpass"
|
||||||
"github.com/fthvgb1/wp-go/internal/wpconfig"
|
"github.com/fthvgb1/wp-go/internal/wpconfig"
|
||||||
"github.com/fthvgb1/wp-go/phpass"
|
|
||||||
"github.com/gin-contrib/sessions"
|
"github.com/gin-contrib/sessions"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -16,6 +16,7 @@ var funcs = template.FuncMap{
|
|||||||
"getOption": func(k string) string {
|
"getOption": func(k string) string {
|
||||||
return wpconfig.Options.Value(k)
|
return wpconfig.Options.Value(k)
|
||||||
},
|
},
|
||||||
|
"getLang": wpconfig.GetLang,
|
||||||
}
|
}
|
||||||
|
|
||||||
func FuncMap() template.FuncMap {
|
func FuncMap() template.FuncMap {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{{ define "layout/base"}}
|
{{ define "layout/base"}}
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="{{"WPLANG"| getOption}}" class="no-js">
|
<html lang="{{getLang}}" class="no-js">
|
||||||
<head>
|
<head>
|
||||||
{{template "layout/head" .}}
|
{{template "layout/head" .}}
|
||||||
{{block "head" .}}
|
{{block "head" .}}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{{ define "layout/base"}}
|
{{ define "layout/base"}}
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="{{"WPLANG"| getOption}}" class="no-js no-svg">
|
<html lang="{{getLang}}" class="no-js no-svg">
|
||||||
<head>
|
<head>
|
||||||
{{template "layout/head" .}}
|
{{template "layout/head" .}}
|
||||||
{{block "head" .}}
|
{{block "head" .}}
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"github.com/fthvgb1/wp-go/internal/pkg/models"
|
"github.com/fthvgb1/wp-go/internal/pkg/models"
|
||||||
"github.com/fthvgb1/wp-go/model"
|
"github.com/fthvgb1/wp-go/model"
|
||||||
"github.com/fthvgb1/wp-go/safety"
|
"github.com/fthvgb1/wp-go/safety"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Options safety.Map[string, string]
|
var Options safety.Map[string, string]
|
||||||
@ -26,3 +27,11 @@ func InitOptions() error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetLang() string {
|
||||||
|
s, ok := Options.Load("WPLANG")
|
||||||
|
if !ok {
|
||||||
|
s = "zh-CN"
|
||||||
|
}
|
||||||
|
return strings.Replace(s, "_", "-", 1)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user