mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2025-12-08 09:28:10 +00:00
Translate more error messages
Featuring own fork of go-localize! It's not in dependencies though.
This commit is contained in:
committed by
Umar Getagazov
parent
8091638181
commit
0354945502
38
l18n/l18n.go
38
l18n/l18n.go
@@ -1,6 +1,4 @@
|
||||
// Code generated by go-localize; DO NOT EDIT.
|
||||
// This file was generated by robots at
|
||||
// 2021-10-01 01:05:27.197649651 -0400 EDT m=+0.002749572
|
||||
|
||||
package l18n
|
||||
|
||||
@@ -125,6 +123,18 @@ var localizations = map[string]string{
|
||||
"en.ui.about_title": "About {{.name}}",
|
||||
"en.ui.about_usercount": "User count:",
|
||||
"en.ui.about_version": "{{.pre}}Mycorrhiza Wiki{{.post}} version:",
|
||||
"en.ui.act_noattachment": "No attachment",
|
||||
"en.ui.act_noattachment_tip": "Cannot unattach this hypha because it has no attachment",
|
||||
"en.ui.act_norights": "Not enough rights",
|
||||
"en.ui.act_norights_attach": "You must be an editor to attach a hypha",
|
||||
"en.ui.act_norights_delete": "Not enough rights to delete, you must be a moderator",
|
||||
"en.ui.act_norights_edit": "You must be an editor to edit a hypha",
|
||||
"en.ui.act_norights_rename": "Not enough rights to rename, you must be a trusted editor",
|
||||
"en.ui.act_norights_unattach": "Not enough rights to unattach, you must be a trusted editor",
|
||||
"en.ui.act_notexist": "Does not exist",
|
||||
"en.ui.act_notexist_delete": "Cannot delete this hypha because it does not exist",
|
||||
"en.ui.act_notexist_rename": "Cannot rename this hypha because it does not exist",
|
||||
"en.ui.act_notexist_unattach": "Cannot unattach this hypha because it does not exist",
|
||||
"en.ui.admin_panel": "Admin panel",
|
||||
"en.ui.ask_delete": "Delete %s?",
|
||||
"en.ui.ask_delete_tip": "In this version of Mycorrhiza Wiki you cannot undelete a deleted hypha but the history can still be accessed.",
|
||||
@@ -207,8 +217,14 @@ var localizations = map[string]string{
|
||||
"en.ui.recent_title+other": "s",
|
||||
"en.ui.register": "Register",
|
||||
"en.ui.reindex_no_rights": "You must be an admin to reindex hyphae.",
|
||||
"en.ui.rename_badname": "Invalid name",
|
||||
"en.ui.rename_badname_tip": "Invalid new name. Names cannot contain characters {{.chars}}.",
|
||||
"en.ui.rename_link": "Rename",
|
||||
"en.ui.rename_noname": "No name given",
|
||||
"en.ui.rename_noname_tip": "No new name is given",
|
||||
"en.ui.rename_recurse": "Rename subhyphae too",
|
||||
"en.ui.rename_taken": "Name taken",
|
||||
"en.ui.rename_taken_tip": "Hypha named {{.name}} already exists, cannot rename",
|
||||
"en.ui.rename_tip": "If you rename this hypha, all incoming links and all relative outcoming links will break. You will also lose all history for the new name. Rename carefully.",
|
||||
"en.ui.rename_to": "New name",
|
||||
"en.ui.revision_link": "Get Mycomarkup source of this revision",
|
||||
@@ -340,6 +356,18 @@ var localizations = map[string]string{
|
||||
"ru.ui.about_title": "О вики «{{.name}}»",
|
||||
"ru.ui.about_usercount": "Число пользователей:",
|
||||
"ru.ui.about_version": "Версия {{.pre}}Микоризы{{.post}}:",
|
||||
"ru.ui.act_noattachment": "Нет вложения",
|
||||
"ru.ui.act_noattachment_tip": "Не могу открепить гифу, потому что в ней нет вложения",
|
||||
"ru.ui.act_norights": "Недостаточно прав",
|
||||
"ru.ui.act_norights_attach": "Вы должны быть редактором, чтобы прикреплять гифы",
|
||||
"ru.ui.act_norights_delete": "Недостаточно прав для удаления, вы должны быть модератором",
|
||||
"ru.ui.act_norights_edit": "Вы должны быть редактором, чтобы редактировать гифы",
|
||||
"ru.ui.act_norights_rename": "Недостаточно прав для переименования, вы должны быть доверенным редактором",
|
||||
"ru.ui.act_norights_unattach": "Недостаточно прав для открепления, вы должны быть доверенным редактором",
|
||||
"ru.ui.act_notexist": "Не существует",
|
||||
"ru.ui.act_notexist_delete": "Нельзя удалить эту гифу, потому что она не существует",
|
||||
"ru.ui.act_notexist_rename": "Нельзя переименовать эту гифу, потому что она не существует",
|
||||
"ru.ui.act_notexist_unattach": "Нельзя открепить эту гифу, потому что она не существует",
|
||||
"ru.ui.admin_panel": "Администрирование",
|
||||
"ru.ui.ask_delete": "Удалить «%s»?",
|
||||
"ru.ui.ask_delete_tip": "В этой версии Микоризы нельзя отменить удаление гифы, но её история останется доступной.",
|
||||
@@ -426,8 +454,14 @@ var localizations = map[string]string{
|
||||
"ru.ui.recent_title+one": "недавнее изменение",
|
||||
"ru.ui.register": "Регистрация",
|
||||
"ru.ui.reindex_no_rights": "Вы должны быть администратором, чтобы переиндексировать гифы.",
|
||||
"ru.ui.rename_badname": "Некорректное название",
|
||||
"ru.ui.rename_badname_tip": "Новое название некорректно. Названия не могут содержать символы {{.chars}}.",
|
||||
"ru.ui.rename_link": "Переименовать",
|
||||
"ru.ui.rename_noname": "Нет названия",
|
||||
"ru.ui.rename_noname_tip": "Не задано новое название",
|
||||
"ru.ui.rename_recurse": "Также переименовать подгифы",
|
||||
"ru.ui.rename_taken": "Название занято",
|
||||
"ru.ui.rename_taken_tip": "Гифа {{.name}} уже существует, не могу переименовать",
|
||||
"ru.ui.rename_tip": "Если вы переименуете эту гифу, сломаются все ссылки, ведущие на неё, а также исходящие относительные ссылки. Также вы потеряете всю текущую историю для нового названия. Переименовывайте аккуратно.",
|
||||
"ru.ui.rename_to": "Новое название",
|
||||
"ru.ui.revision_link": "Посмотреть код микоразметки для этой ревизии",
|
||||
|
||||
@@ -43,6 +43,25 @@
|
||||
"rename_to": "New name",
|
||||
"rename_recurse": "Rename subhyphae too",
|
||||
"rename_tip": "If you rename this hypha, all incoming links and all relative outcoming links will break. You will also lose all history for the new name. Rename carefully.",
|
||||
"rename_taken": "Name taken",
|
||||
"rename_taken_tip": "Hypha named {{.name}} already exists, cannot rename",
|
||||
"rename_noname": "No name given",
|
||||
"rename_noname_tip": "No new name is given",
|
||||
"rename_badname": "Invalid name",
|
||||
"rename_badname_tip": "Invalid new name. Names cannot contain characters {{.chars}}.",
|
||||
|
||||
"act_noattachment": "No attachment",
|
||||
"act_noattachment_tip": "Cannot unattach this hypha because it has no attachment",
|
||||
"act_norights": "Not enough rights",
|
||||
"act_notexist": "Does not exist",
|
||||
"act_norights_delete": "Not enough rights to delete, you must be a moderator",
|
||||
"act_notexist_delete": "Cannot delete this hypha because it does not exist",
|
||||
"act_norights_rename": "Not enough rights to rename, you must be a trusted editor",
|
||||
"act_notexist_rename": "Cannot rename this hypha because it does not exist",
|
||||
"act_norights_unattach": "Not enough rights to unattach, you must be a trusted editor",
|
||||
"act_notexist_unattach": "Cannot unattach this hypha because it does not exist",
|
||||
"act_norights_edit": "You must be an editor to edit a hypha",
|
||||
"act_norights_attach": "You must be an editor to attach a hypha",
|
||||
|
||||
"ask_delete": "Delete %s?",
|
||||
"ask_delete_tip": "In this version of Mycorrhiza Wiki you cannot undelete a deleted hypha but the history can still be accessed.",
|
||||
|
||||
@@ -45,6 +45,25 @@
|
||||
"rename_to": "Новое название",
|
||||
"rename_recurse": "Также переименовать подгифы",
|
||||
"rename_tip": "Если вы переименуете эту гифу, сломаются все ссылки, ведущие на неё, а также исходящие относительные ссылки. Также вы потеряете всю текущую историю для нового названия. Переименовывайте аккуратно.",
|
||||
"rename_taken": "Название занято",
|
||||
"rename_taken_tip": "Гифа {{.name}} уже существует, не могу переименовать",
|
||||
"rename_noname": "Нет названия",
|
||||
"rename_noname_tip": "Не задано новое название",
|
||||
"rename_badname": "Некорректное название",
|
||||
"rename_badname_tip": "Новое название некорректно. Названия не могут содержать символы {{.chars}}.",
|
||||
|
||||
"act_noattachment": "Нет вложения",
|
||||
"act_noattachment_tip": "Не могу открепить гифу, потому что в ней нет вложения",
|
||||
"act_norights": "Недостаточно прав",
|
||||
"act_notexist": "Не существует",
|
||||
"act_norights_delete": "Недостаточно прав для удаления, вы должны быть модератором",
|
||||
"act_norights_rename": "Недостаточно прав для переименования, вы должны быть доверенным редактором",
|
||||
"act_norights_unattach": "Недостаточно прав для открепления, вы должны быть доверенным редактором",
|
||||
"act_norights_edit": "Вы должны быть редактором, чтобы редактировать гифы",
|
||||
"act_norights_attach": "Вы должны быть редактором, чтобы прикреплять гифы",
|
||||
"act_notexist_delete": "Нельзя удалить эту гифу, потому что она не существует",
|
||||
"act_notexist_rename": "Нельзя переименовать эту гифу, потому что она не существует",
|
||||
"act_notexist_unattach": "Нельзя открепить эту гифу, потому что она не существует",
|
||||
|
||||
"ask_delete": "Удалить «%s»?",
|
||||
"ask_delete_tip": "В этой версии Микоризы нельзя отменить удаление гифы, но её история останется доступной.",
|
||||
|
||||
@@ -4,32 +4,33 @@ import (
|
||||
"errors"
|
||||
|
||||
"github.com/bouncepaw/mycorrhiza/hyphae"
|
||||
"github.com/bouncepaw/mycorrhiza/l18n"
|
||||
"github.com/bouncepaw/mycorrhiza/user"
|
||||
)
|
||||
|
||||
func canFactory(
|
||||
rejectLogger func(*hyphae.Hypha, *user.User, string),
|
||||
action string,
|
||||
dispatcher func(*hyphae.Hypha, *user.User) (string, string),
|
||||
dispatcher func(*hyphae.Hypha, *user.User, *l18n.Localizer) (string, string),
|
||||
noRightsMsg string,
|
||||
notExistsMsg string,
|
||||
careAboutExistence bool,
|
||||
) func(*user.User, *hyphae.Hypha) (string, error) {
|
||||
return func(u *user.User, h *hyphae.Hypha) (string, error) {
|
||||
) func(*user.User, *hyphae.Hypha, *l18n.Localizer) (string, error) {
|
||||
return func(u *user.User, h *hyphae.Hypha, lc *l18n.Localizer) (string, error) {
|
||||
if !u.CanProceed(action) {
|
||||
rejectLogger(h, u, "no rights")
|
||||
return "Not enough rights", errors.New(noRightsMsg)
|
||||
return lc.Get("ui.act_no_rights"), errors.New(lc.Get(noRightsMsg))
|
||||
}
|
||||
|
||||
if careAboutExistence && !h.Exists {
|
||||
rejectLogger(h, u, "does not exist")
|
||||
return "Does not exist", errors.New(notExistsMsg)
|
||||
return lc.Get("ui.act_notexist"), errors.New(lc.Get(notExistsMsg))
|
||||
}
|
||||
|
||||
if dispatcher == nil {
|
||||
return "", nil
|
||||
}
|
||||
errmsg, errtitle := dispatcher(h, u)
|
||||
errmsg, errtitle := dispatcher(h, u, lc)
|
||||
if errtitle == "" {
|
||||
return "", nil
|
||||
}
|
||||
@@ -43,8 +44,8 @@ var (
|
||||
rejectDeleteLog,
|
||||
"delete-confirm",
|
||||
nil,
|
||||
"Not enough rights to delete, you must be a moderator",
|
||||
"Cannot delete this hypha because it does not exist",
|
||||
"ui.act_norights_delete",
|
||||
"ui.act_notexist_delete",
|
||||
true,
|
||||
)
|
||||
|
||||
@@ -52,24 +53,24 @@ var (
|
||||
rejectRenameLog,
|
||||
"rename-confirm",
|
||||
nil,
|
||||
"Not enough rights to rename, you must be a trusted editor",
|
||||
"Cannot rename this hypha because it does not exist",
|
||||
"ui.act_norights_rename",
|
||||
"ui.act_notexist_rename",
|
||||
true,
|
||||
)
|
||||
|
||||
CanUnattach = canFactory(
|
||||
rejectUnattachLog,
|
||||
"unattach-confirm",
|
||||
func(h *hyphae.Hypha, u *user.User) (errmsg, errtitle string) {
|
||||
func(h *hyphae.Hypha, u *user.User, lc *l18n.Localizer) (errmsg, errtitle string) {
|
||||
if h.BinaryPath == "" {
|
||||
rejectUnattachLog(h, u, "no amnt")
|
||||
return "Cannot unattach this hypha because it has no attachment", "No attachment"
|
||||
return lc.Get("ui.act_noattachment_tip"), lc.Get("ui.act_noattachment")
|
||||
}
|
||||
|
||||
return "", ""
|
||||
},
|
||||
"Not enough rights to unattach, you must be a trusted editor",
|
||||
"Cannot unattach this hypha because it does not exist",
|
||||
"ui.act_norights_unattach",
|
||||
"ui.act_notexist_unattach",
|
||||
true,
|
||||
)
|
||||
|
||||
@@ -77,7 +78,7 @@ var (
|
||||
rejectEditLog,
|
||||
"upload-text",
|
||||
nil,
|
||||
"You must be an editor to edit a hypha",
|
||||
"ui.act_norights_edit",
|
||||
"You cannot edit a hypha that does not exist",
|
||||
false,
|
||||
)
|
||||
@@ -86,8 +87,10 @@ var (
|
||||
rejectAttachLog,
|
||||
"upload-binary",
|
||||
nil,
|
||||
"You must be an editor to attach a hypha",
|
||||
"ui.act_norights_attach",
|
||||
"You cannot attach a hypha that does not exist",
|
||||
false,
|
||||
)
|
||||
)
|
||||
|
||||
/* I've left 'not exists' messages for edit and attach out of translation as they are not used -- chekoopa */
|
||||
|
||||
@@ -5,14 +5,15 @@ import (
|
||||
|
||||
"github.com/bouncepaw/mycorrhiza/history"
|
||||
"github.com/bouncepaw/mycorrhiza/hyphae"
|
||||
"github.com/bouncepaw/mycorrhiza/l18n"
|
||||
"github.com/bouncepaw/mycorrhiza/user"
|
||||
)
|
||||
|
||||
// DeleteHypha deletes hypha and makes a history record about that.
|
||||
func DeleteHypha(u *user.User, h *hyphae.Hypha) (hop *history.Op, errtitle string) {
|
||||
func DeleteHypha(u *user.User, h *hyphae.Hypha, lc *l18n.Localizer) (hop *history.Op, errtitle string) {
|
||||
hop = history.Operation(history.TypeDeleteHypha)
|
||||
|
||||
if errtitle, err := CanDelete(u, h); errtitle != "" {
|
||||
if errtitle, err := CanDelete(u, h, lc); errtitle != "" {
|
||||
hop.WithErrAbort(err)
|
||||
return hop, errtitle
|
||||
}
|
||||
|
||||
@@ -7,40 +7,41 @@ import (
|
||||
|
||||
"github.com/bouncepaw/mycorrhiza/history"
|
||||
"github.com/bouncepaw/mycorrhiza/hyphae"
|
||||
"github.com/bouncepaw/mycorrhiza/l18n"
|
||||
"github.com/bouncepaw/mycorrhiza/user"
|
||||
"github.com/bouncepaw/mycorrhiza/util"
|
||||
)
|
||||
|
||||
func canRenameThisToThat(oh *hyphae.Hypha, nh *hyphae.Hypha, u *user.User) (errtitle string, err error) {
|
||||
func canRenameThisToThat(oh *hyphae.Hypha, nh *hyphae.Hypha, u *user.User, lc *l18n.Localizer) (errtitle string, err error) {
|
||||
if nh.Exists {
|
||||
rejectRenameLog(oh, u, fmt.Sprintf("name ‘%s’ taken already", nh.Name))
|
||||
return "Name taken", fmt.Errorf("Hypha named <a href='/hypha/%[1]s'>%[1]s</a> already exists, cannot rename", nh.Name)
|
||||
return lc.Get("ui.rename_taken"), fmt.Errorf(lc.Get("ui.rename_taken_tip", &l18n.Replacements{"name": "<a href='/hypha/%[1]s'>%[1]s</a>"}), nh.Name)
|
||||
}
|
||||
|
||||
if nh.Name == "" {
|
||||
rejectRenameLog(oh, u, "no new name given")
|
||||
return "No name given", errors.New("No new name is given")
|
||||
return lc.Get("ui.rename_noname"), errors.New(lc.Get("ui.rename_noname_tip"))
|
||||
}
|
||||
|
||||
if !hyphae.HyphaPattern.MatchString(nh.Name) {
|
||||
rejectRenameLog(oh, u, fmt.Sprintf("new name ‘%s’ invalid", nh.Name))
|
||||
return "Invalid name", errors.New("Invalid new name. Names cannot contain characters <code>^?!:#@><*|\"\\'&%</code>")
|
||||
return lc.Get("ui.rename_badname"), errors.New(lc.Get("ui.rename_badname_tip", &l18n.Replacements{"chars": "<code>^?!:#@><*|\"\\'&%</code>"}))
|
||||
}
|
||||
|
||||
return "", nil
|
||||
}
|
||||
|
||||
// RenameHypha renames hypha from old name `hyphaName` to `newName` and makes a history record about that. If `recursive` is `true`, its subhyphae will be renamed the same way.
|
||||
func RenameHypha(h *hyphae.Hypha, newHypha *hyphae.Hypha, recursive bool, u *user.User) (hop *history.Op, errtitle string) {
|
||||
func RenameHypha(h *hyphae.Hypha, newHypha *hyphae.Hypha, recursive bool, u *user.User, lc *l18n.Localizer) (hop *history.Op, errtitle string) {
|
||||
newHypha.Lock()
|
||||
defer newHypha.Unlock()
|
||||
hop = history.Operation(history.TypeRenameHypha)
|
||||
|
||||
if errtitle, err := CanRename(u, h); errtitle != "" {
|
||||
if errtitle, err := CanRename(u, h, lc); errtitle != "" {
|
||||
hop.WithErrAbort(err)
|
||||
return hop, errtitle
|
||||
}
|
||||
if errtitle, err := canRenameThisToThat(h, newHypha, u); errtitle != "" {
|
||||
if errtitle, err := canRenameThisToThat(h, newHypha, u, lc); errtitle != "" {
|
||||
hop.WithErrAbort(err)
|
||||
return hop, errtitle
|
||||
}
|
||||
|
||||
@@ -5,14 +5,15 @@ import (
|
||||
|
||||
"github.com/bouncepaw/mycorrhiza/history"
|
||||
"github.com/bouncepaw/mycorrhiza/hyphae"
|
||||
"github.com/bouncepaw/mycorrhiza/l18n"
|
||||
"github.com/bouncepaw/mycorrhiza/user"
|
||||
)
|
||||
|
||||
// UnattachHypha unattaches hypha and makes a history record about that.
|
||||
func UnattachHypha(u *user.User, h *hyphae.Hypha) (hop *history.Op, errtitle string) {
|
||||
func UnattachHypha(u *user.User, h *hyphae.Hypha, lc *l18n.Localizer) (hop *history.Op, errtitle string) {
|
||||
hop = history.Operation(history.TypeUnattachHypha)
|
||||
|
||||
if errtitle, err := CanUnattach(u, h); errtitle != "" {
|
||||
if errtitle, err := CanUnattach(u, h, lc); errtitle != "" {
|
||||
hop.WithErrAbort(err)
|
||||
return hop, errtitle
|
||||
}
|
||||
|
||||
@@ -14,12 +14,13 @@ import (
|
||||
"github.com/bouncepaw/mycorrhiza/files"
|
||||
"github.com/bouncepaw/mycorrhiza/history"
|
||||
"github.com/bouncepaw/mycorrhiza/hyphae"
|
||||
"github.com/bouncepaw/mycorrhiza/l18n"
|
||||
"github.com/bouncepaw/mycorrhiza/mimetype"
|
||||
"github.com/bouncepaw/mycorrhiza/user"
|
||||
)
|
||||
|
||||
// UploadText edits a hypha' text part and makes a history record about that.
|
||||
func UploadText(h *hyphae.Hypha, data []byte, message string, u *user.User) (hop *history.Op, errtitle string) {
|
||||
func UploadText(h *hyphae.Hypha, data []byte, message string, u *user.User, lc *l18n.Localizer) (hop *history.Op, errtitle string) {
|
||||
hop = history.Operation(history.TypeEditText)
|
||||
var action string
|
||||
if h.Exists {
|
||||
@@ -34,7 +35,7 @@ func UploadText(h *hyphae.Hypha, data []byte, message string, u *user.User) (hop
|
||||
hop.WithMsg(fmt.Sprintf("%s ‘%s’: %s", action, h.Name, message))
|
||||
}
|
||||
|
||||
if errtitle, err := CanEdit(u, h); err != nil {
|
||||
if errtitle, err := CanEdit(u, h, lc); err != nil {
|
||||
return hop.WithErrAbort(err), errtitle
|
||||
}
|
||||
if len(bytes.TrimSpace(data)) == 0 && h.BinaryPath == "" {
|
||||
@@ -45,7 +46,7 @@ func UploadText(h *hyphae.Hypha, data []byte, message string, u *user.User) (hop
|
||||
}
|
||||
|
||||
// UploadBinary edits a hypha' attachment and makes a history record about that.
|
||||
func UploadBinary(h *hyphae.Hypha, mime string, file multipart.File, u *user.User) (*history.Op, string) {
|
||||
func UploadBinary(h *hyphae.Hypha, mime string, file multipart.File, u *user.User, lc *l18n.Localizer) (*history.Op, string) {
|
||||
var (
|
||||
hop = history.Operation(history.TypeEditBinary).WithMsg(fmt.Sprintf("Upload attachment for ‘%s’ with type ‘%s’", h.Name, mime))
|
||||
data, err = io.ReadAll(file)
|
||||
@@ -54,7 +55,7 @@ func UploadBinary(h *hyphae.Hypha, mime string, file multipart.File, u *user.Use
|
||||
if err != nil {
|
||||
return hop.WithErrAbort(err), err.Error()
|
||||
}
|
||||
if errtitle, err := CanAttach(u, h); err != nil {
|
||||
if errtitle, err := CanAttach(u, h, lc); err != nil {
|
||||
return hop.WithErrAbort(err), errtitle
|
||||
}
|
||||
if len(data) == 0 {
|
||||
|
||||
@@ -35,7 +35,7 @@ func initMutators(r *mux.Router) {
|
||||
|
||||
func factoryHandlerAsker(
|
||||
actionPath string,
|
||||
asker func(*user.User, *hyphae.Hypha) (string, error),
|
||||
asker func(*user.User, *hyphae.Hypha, *l18n.Localizer) (string, error),
|
||||
succTitleKey string,
|
||||
succPageTemplate func(*http.Request, string, bool) string,
|
||||
) func(http.ResponseWriter, *http.Request) {
|
||||
@@ -47,7 +47,7 @@ func factoryHandlerAsker(
|
||||
u = user.FromRequest(rq)
|
||||
lc = l18n.FromRequest(rq)
|
||||
)
|
||||
if errtitle, err := asker(u, h); err != nil {
|
||||
if errtitle, err := asker(u, h, lc); err != nil {
|
||||
httpErr(
|
||||
w,
|
||||
lc,
|
||||
@@ -112,15 +112,15 @@ func factoryHandlerConfirmer(
|
||||
|
||||
var handlerUnattachConfirm = factoryHandlerConfirmer(
|
||||
"unattach-confirm",
|
||||
func(h *hyphae.Hypha, u *user.User, _ *http.Request) (*history.Op, string) {
|
||||
return shroom.UnattachHypha(u, h)
|
||||
func(h *hyphae.Hypha, u *user.User, rq *http.Request) (*history.Op, string) {
|
||||
return shroom.UnattachHypha(u, h, l18n.FromRequest(rq))
|
||||
},
|
||||
)
|
||||
|
||||
var handlerDeleteConfirm = factoryHandlerConfirmer(
|
||||
"delete-confirm",
|
||||
func(h *hyphae.Hypha, u *user.User, _ *http.Request) (*history.Op, string) {
|
||||
return shroom.DeleteHypha(u, h)
|
||||
func(h *hyphae.Hypha, u *user.User, rq *http.Request) (*history.Op, string) {
|
||||
return shroom.DeleteHypha(u, h, l18n.FromRequest(rq))
|
||||
},
|
||||
)
|
||||
|
||||
@@ -136,7 +136,7 @@ func handlerRenameConfirm(w http.ResponseWriter, rq *http.Request) {
|
||||
newHypha = hyphae.ByName(newName)
|
||||
recursive = rq.PostFormValue("recursive") == "true"
|
||||
)
|
||||
hop, errtitle := shroom.RenameHypha(oldHypha, newHypha, recursive, u)
|
||||
hop, errtitle := shroom.RenameHypha(oldHypha, newHypha, recursive, u, lc)
|
||||
if hop.HasErrors() {
|
||||
httpErr(w, lc, http.StatusInternalServerError, hyphaName,
|
||||
errtitle,
|
||||
@@ -158,7 +158,7 @@ func handlerEdit(w http.ResponseWriter, rq *http.Request) {
|
||||
u = user.FromRequest(rq)
|
||||
lc = l18n.FromRequest(rq)
|
||||
)
|
||||
if errtitle, err := shroom.CanEdit(u, h); err != nil {
|
||||
if errtitle, err := shroom.CanEdit(u, h, lc); err != nil {
|
||||
httpErr(w, lc, http.StatusInternalServerError, hyphaName,
|
||||
errtitle,
|
||||
err.Error())
|
||||
@@ -201,7 +201,7 @@ func handlerUploadText(w http.ResponseWriter, rq *http.Request) {
|
||||
)
|
||||
|
||||
if action != "Preview" {
|
||||
hop, errtitle = shroom.UploadText(h, []byte(textData), message, u)
|
||||
hop, errtitle = shroom.UploadText(h, []byte(textData), message, u, lc)
|
||||
if hop.HasErrors() {
|
||||
httpErr(w, lc, http.StatusForbidden, hyphaName,
|
||||
errtitle,
|
||||
@@ -247,7 +247,7 @@ func handlerUploadBinary(w http.ResponseWriter, rq *http.Request) {
|
||||
lc.Get("ui.error"),
|
||||
err.Error())
|
||||
}
|
||||
if errtitle, err := shroom.CanAttach(u, h); err != nil {
|
||||
if errtitle, err := shroom.CanAttach(u, h, lc); err != nil {
|
||||
httpErr(w, lc, http.StatusInternalServerError, hyphaName,
|
||||
errtitle,
|
||||
err.Error())
|
||||
@@ -264,7 +264,7 @@ func handlerUploadBinary(w http.ResponseWriter, rq *http.Request) {
|
||||
}
|
||||
var (
|
||||
mime = handler.Header.Get("Content-Type")
|
||||
hop, errtitle = shroom.UploadBinary(h, mime, file, u)
|
||||
hop, errtitle = shroom.UploadBinary(h, mime, file, u, lc)
|
||||
)
|
||||
|
||||
if hop.HasErrors() {
|
||||
|
||||
Reference in New Issue
Block a user