allow instance owner to configure default source/target lang (closes #14)
All checks were successful
mozhi pipeline / Push Docker image to Codeberg docker registry (push) Successful in 16m22s
mozhi pipeline / Build and publish artifacts (push) Successful in 29m21s

This commit is contained in:
2023-10-20 15:49:51 +05:30
parent 86e5c4eeea
commit 9ab37afc1a
7 changed files with 55 additions and 44 deletions

View File

@@ -122,6 +122,15 @@ func HandleIndex(c *fiber.Ctx) error {
} else {
translationExists = false
}
defaultLang := os.Getenv("MOZHI_DEFAULT_SOURCE_LANG")
defaultLangTarget := os.Getenv("MOZHI_DEFAULT_TARGET_LANG")
if defaultLang == "" {
defaultLang = "auto"
}
if defaultLangTarget == "" {
defaultLangTarget = "en"
}
return c.Render("index", fiber.Map{
"Engine": engine,
"enginesNames": engines,
@@ -135,6 +144,7 @@ func HandleIndex(c *fiber.Ctx) error {
"To": to,
"TtsFrom": ttsFrom,
"TtsTo": ttsTo,
"defaultLang": "en",
"defaultLang": defaultLang,
"defaultLangTarget": defaultLangTarget,
})
}