mirror of
https://codeberg.org/aryak/mozhi
synced 2024-11-08 21:32: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")
|
defaultLang := os.Getenv("MOZHI_DEFAULT_SOURCE_LANG")
|
||||||
preferAutoDetect := os.Getenv("MOZHI_DEFAULT_PREFER_AUTODETECT")
|
preferAutoDetect := os.Getenv("MOZHI_DEFAULT_PREFER_AUTODETECT")
|
||||||
defaultLangTarget := os.Getenv("MOZHI_DEFAULT_TARGET_LANG")
|
defaultLangTarget := os.Getenv("MOZHI_DEFAULT_TARGET_LANG")
|
||||||
if defaultLang == "" || preferAutoDetect == "true" {
|
if defaultLang == "" || (preferAutoDetect == "true" && sourceLanguages[0].Id == "auto") {
|
||||||
defaultLang = "auto"
|
defaultLang = "auto"
|
||||||
}
|
}
|
||||||
if defaultLangTarget == "" {
|
if defaultLangTarget == "" {
|
||||||
|
@ -21,11 +21,11 @@
|
|||||||
<div class="language">
|
<div class="language">
|
||||||
<select name="from" aria-label="Source language" id="sourceLanguage">
|
<select name="from" aria-label="Source language" id="sourceLanguage">
|
||||||
{{ range $key, $value := .SourceLanguages }} {{ if eq $.From "" }}
|
{{ 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 }}
|
{{ .Name }}
|
||||||
</option>
|
</option>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<option value="{{ .Id }}" {{ if eq .Id $.defaultLang }}selected{{ end }}>
|
<option value="{{ .Id }}" {{ if eq $.From .Id }}selected{{ end }}>
|
||||||
{{ .Name }}
|
{{ .Name }}
|
||||||
</option>
|
</option>
|
||||||
{{ end }} {{ end }}
|
{{ end }} {{ end }}
|
||||||
|
Loading…
Reference in New Issue
Block a user