32
src/webui/serveApiGetTranslations.go
Normal file
32
src/webui/serveApiGetTranslations.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package webui
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type tlRaw struct {
|
||||
webdav_uploader map[string]string `json:"webdav_uploader"`
|
||||
}
|
||||
|
||||
//go:embed translation-json/webdav-uploader/de/webdav_uploader.json
|
||||
var rawTlsDe string
|
||||
//go:embed translation-json/webdav-uploader/en/webdav_uploader.json
|
||||
var rawTlsEn string
|
||||
|
||||
// Retrieves translation variables in the given language.
|
||||
func serveApiGetTranslations(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
var rawTls string
|
||||
if r.URL.Query().Get("lang") == "de" {
|
||||
rawTls = rawTlsDe
|
||||
} else {
|
||||
rawTls = rawTlsEn
|
||||
}
|
||||
|
||||
setHeadersForJson(w)
|
||||
|
||||
fmt.Fprint(w, rawTls)
|
||||
|
||||
}
|
Reference in New Issue
Block a user