mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-12 10:55:51 +02:00
compile pofile in backend
This commit is contained in:
parent
35d144c678
commit
9940c0ad36
18 changed files with 99 additions and 183 deletions
|
@ -1,6 +1,26 @@
|
|||
package frontend
|
||||
|
||||
import "embed"
|
||||
import (
|
||||
"embed"
|
||||
"github.com/0xJacky/pofile"
|
||||
"log"
|
||||
"path"
|
||||
)
|
||||
|
||||
//go:embed dist
|
||||
var DistFS embed.FS
|
||||
|
||||
var Translations pofile.Dict
|
||||
|
||||
func InitTranslations() {
|
||||
lang := []string{"zh_CN", "zh_TW", "en"}
|
||||
Translations = make(pofile.Dict)
|
||||
for _, v := range lang {
|
||||
p, err := pofile.Parse(path.Join("frontend", "src", "locale", v, "LC_MESSAGES", "app.po"))
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
Translations[p.Header.Language] = make(pofile.Dict)
|
||||
Translations[p.Header.Language] = p.ToDict()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue