mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-23 01:20:11 +00:00
Fix email language selection, add finished french emails
This commit is contained in:
parent
bc99dc34ee
commit
3d5bea003a
27
api.go
27
api.go
@ -1087,7 +1087,7 @@ func (app *appContext) GetConfig(gc *gin.Context) {
|
|||||||
// Load language options
|
// Load language options
|
||||||
loadLangs := func(langs *map[string]map[string]interface{}, settingsKey string) (string, []string) {
|
loadLangs := func(langs *map[string]map[string]interface{}, settingsKey string) (string, []string) {
|
||||||
langOptions := make([]string, len(*langs))
|
langOptions := make([]string, len(*langs))
|
||||||
chosenLang := app.config.Section("ui").Key("language-" + settingsKey).MustString("en-us")
|
chosenLang := app.config.Section("ui").Key("language" + settingsKey).MustString("en-us")
|
||||||
chosenLangName := (*langs)[chosenLang]["meta"].(map[string]interface{})["name"].(string)
|
chosenLangName := (*langs)[chosenLang]["meta"].(map[string]interface{})["name"].(string)
|
||||||
i := 0
|
i := 0
|
||||||
for _, lang := range *langs {
|
for _, lang := range *langs {
|
||||||
@ -1096,14 +1096,25 @@ func (app *appContext) GetConfig(gc *gin.Context) {
|
|||||||
}
|
}
|
||||||
return chosenLangName, langOptions
|
return chosenLangName, langOptions
|
||||||
}
|
}
|
||||||
formChosen, formOptions := loadLangs(&app.storage.lang.Form, "form")
|
formChosen, formOptions := loadLangs(&app.storage.lang.Form, "-form")
|
||||||
fl := resp.Sections["ui"].Settings["language-form"]
|
fl := resp.Sections["ui"].Settings["language-form"]
|
||||||
fl.Options = formOptions
|
fl.Options = formOptions
|
||||||
fl.Value = formChosen
|
fl.Value = formChosen
|
||||||
adminChosen, adminOptions := loadLangs(&app.storage.lang.Admin, "admin")
|
adminChosen, adminOptions := loadLangs(&app.storage.lang.Admin, "-admin")
|
||||||
al := resp.Sections["ui"].Settings["language-admin"]
|
al := resp.Sections["ui"].Settings["language-admin"]
|
||||||
al.Options = adminOptions
|
al.Options = adminOptions
|
||||||
al.Value = adminChosen
|
al.Value = adminChosen
|
||||||
|
emailOptions := make([]string, len(app.storage.lang.Email))
|
||||||
|
chosenLang := app.config.Section("email").Key("language").MustString("en-us")
|
||||||
|
emailChosen := app.storage.lang.Email.get(chosenLang, "meta", "name")
|
||||||
|
i := 0
|
||||||
|
for langName := range app.storage.lang.Email {
|
||||||
|
emailOptions[i] = app.storage.lang.Email.get(langName, "meta", "name")
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
el := resp.Sections["email"].Settings["language"]
|
||||||
|
el.Options = emailOptions
|
||||||
|
el.Value = emailChosen
|
||||||
for sectName, section := range resp.Sections {
|
for sectName, section := range resp.Sections {
|
||||||
for settingName, setting := range section.Settings {
|
for settingName, setting := range section.Settings {
|
||||||
val := app.config.Section(sectName).Key(settingName)
|
val := app.config.Section(sectName).Key(settingName)
|
||||||
@ -1121,10 +1132,11 @@ func (app *appContext) GetConfig(gc *gin.Context) {
|
|||||||
}
|
}
|
||||||
resp.Sections["ui"].Settings["language-form"] = fl
|
resp.Sections["ui"].Settings["language-form"] = fl
|
||||||
resp.Sections["ui"].Settings["language-admin"] = al
|
resp.Sections["ui"].Settings["language-admin"] = al
|
||||||
|
resp.Sections["email"].Settings["language"] = el
|
||||||
|
|
||||||
t := resp.Sections["jellyfin"].Settings["type"]
|
t := resp.Sections["jellyfin"].Settings["type"]
|
||||||
opts := make([]string, len(serverTypes))
|
opts := make([]string, len(serverTypes))
|
||||||
i := 0
|
i = 0
|
||||||
for _, v := range serverTypes {
|
for _, v := range serverTypes {
|
||||||
opts[i] = v
|
opts[i] = v
|
||||||
i++
|
i++
|
||||||
@ -1169,6 +1181,13 @@ func (app *appContext) ModifyConfig(gc *gin.Context) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if section == "email" && setting == "language" {
|
||||||
|
for key := range app.storage.lang.Email {
|
||||||
|
if app.storage.lang.Email.get(key, "meta", "name") == value.(string) {
|
||||||
|
tempConfig.Section("email").Key("language").SetValue(key)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if section == "jellyfin" && setting == "type" {
|
} else if section == "jellyfin" && setting == "type" {
|
||||||
for k, v := range serverTypes {
|
for k, v := range serverTypes {
|
||||||
if v == value.(string) {
|
if v == value.(string) {
|
||||||
|
@ -4,13 +4,21 @@
|
|||||||
"author": "https://github.com/Cornichon420"
|
"author": "https://github.com/Cornichon420"
|
||||||
},
|
},
|
||||||
"userCreated": {
|
"userCreated": {
|
||||||
|
"title": "Notification : Utilisateur créé",
|
||||||
"aUserWasCreated": "Un utilisateur a été créé avec ce code {n}",
|
"aUserWasCreated": "Un utilisateur a été créé avec ce code {n}",
|
||||||
"name": "Nom",
|
"name": "Nom",
|
||||||
"emailAddress": "Adresse",
|
"emailAddress": "Adresse",
|
||||||
"time": "Date",
|
"time": "Date",
|
||||||
"notificationNotice": ""
|
"notificationNotice": ""
|
||||||
},
|
},
|
||||||
|
"inviteExpiry": {
|
||||||
|
"title": "Notification : Invitation expirée",
|
||||||
|
"inviteExpired": "Invitation expirée.",
|
||||||
|
"expiredAt": "Le code {n} a expiré à {n}.",
|
||||||
|
"notificationNotice": ""
|
||||||
|
},
|
||||||
"passwordReset": {
|
"passwordReset": {
|
||||||
|
"title": "Réinitialisation de mot de passe demandée - Jellyfin",
|
||||||
"helloUser": "Salut {n},",
|
"helloUser": "Salut {n},",
|
||||||
"someoneHasRequestedReset": "Quelqu'un vient de demander une réinitialisation du mot de passe via Jellyfin.",
|
"someoneHasRequestedReset": "Quelqu'un vient de demander une réinitialisation du mot de passe via Jellyfin.",
|
||||||
"ifItWasYou": "Si c'était bien toi, renseigne le code PIN en dessous.",
|
"ifItWasYou": "Si c'était bien toi, renseigne le code PIN en dessous.",
|
||||||
@ -19,10 +27,12 @@
|
|||||||
"pin": "PIN"
|
"pin": "PIN"
|
||||||
},
|
},
|
||||||
"userDeleted": {
|
"userDeleted": {
|
||||||
|
"title": "Ton compte a été désactivé - Jellyfin",
|
||||||
"yourAccountWasDeleted": "Ton compte Jellyfin a été supprimé.",
|
"yourAccountWasDeleted": "Ton compte Jellyfin a été supprimé.",
|
||||||
"reason": "Motif"
|
"reason": "Motif"
|
||||||
},
|
},
|
||||||
"inviteEmail": {
|
"inviteEmail": {
|
||||||
|
"title": "Invitation - Jellyfin",
|
||||||
"hello": "Salut",
|
"hello": "Salut",
|
||||||
"youHaveBeenInvited": "Tu a été invité à rejoindre Jellyfin.",
|
"youHaveBeenInvited": "Tu a été invité à rejoindre Jellyfin.",
|
||||||
"toJoin": "Pour continuer, suis le lien en dessous.",
|
"toJoin": "Pour continuer, suis le lien en dessous.",
|
||||||
|
Loading…
Reference in New Issue
Block a user