mirror of
https://codeberg.org/aryak/mozhi
synced 2024-11-08 20:52:23 +05:30
fix default source lang (closes #41)
This commit is contained in:
parent
16813c4db5
commit
197949150d
@ -95,7 +95,7 @@ func HandleIndex(c *fiber.Ctx) error {
|
||||
defaultLang := os.Getenv("MOZHI_DEFAULT_SOURCE_LANG")
|
||||
preferAutoDetect := os.Getenv("MOZHI_DEFAULT_PREFER_AUTODETECT")
|
||||
defaultLangTarget := os.Getenv("MOZHI_DEFAULT_TARGET_LANG")
|
||||
if defaultLang == "" || preferAutoDetect == "true" {
|
||||
if defaultLang == "" || (preferAutoDetect == "true" && sourceLanguages[0].Id == "auto") {
|
||||
defaultLang = "auto"
|
||||
}
|
||||
if defaultLangTarget == "" {
|
||||
|
@ -21,11 +21,11 @@
|
||||
<div class="language">
|
||||
<select name="from" aria-label="Source language" id="sourceLanguage">
|
||||
{{ range $key, $value := .SourceLanguages }} {{ if eq $.From "" }}
|
||||
<option value="{{ .Id }}" {{ if eq $.From .Id }}selected{{ end }}>
|
||||
<option value="{{ .Id }}" {{ if eq .Id $.defaultLang }}selected{{ end }}>
|
||||
{{ .Name }}
|
||||
</option>
|
||||
{{ else }}
|
||||
<option value="{{ .Id }}" {{ if eq .Id $.defaultLang }}selected{{ end }}>
|
||||
<option value="{{ .Id }}" {{ if eq $.From .Id }}selected{{ end }}>
|
||||
{{ .Name }}
|
||||
</option>
|
||||
{{ end }} {{ end }}
|
||||
|
Loading…
Reference in New Issue
Block a user