mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-02 23:08:49 +01:00
🎨 Title localization when creating a document https://github.com/siyuan-note/siyuan/issues/10719
This commit is contained in:
parent
f5043a8c46
commit
2a8809bc7e
25 changed files with 72 additions and 61 deletions
|
|
@ -1738,7 +1738,7 @@ func getAvNames(avIDs string) (ret string) {
|
|||
continue
|
||||
}
|
||||
if "" == nodeAvName {
|
||||
nodeAvName = "Untitled"
|
||||
nodeAvName = Conf.language(105)
|
||||
}
|
||||
|
||||
tpl := strings.ReplaceAll(attrAvNameTpl, "${avID}", nodeAvID)
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ func GetDocInfo(blockID string) (ret *BlockInfo) {
|
|||
}
|
||||
|
||||
if "" == avName {
|
||||
avName = "Untitled"
|
||||
avName = Conf.language(105)
|
||||
}
|
||||
|
||||
attrView := &AttrView{ID: avID, Name: avName}
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ func ExportAv2CSV(avID, blockID string) (zipPath string, err error) {
|
|||
|
||||
name := util.FilterFileName(attrView.Name)
|
||||
if "" == name {
|
||||
name = "Untitled"
|
||||
name = Conf.language(105)
|
||||
}
|
||||
|
||||
table, err := renderAttributeViewTable(attrView, view, "")
|
||||
|
|
@ -1375,7 +1375,7 @@ func BatchExportMarkdown(boxID, folderPath string) (zipPath string) {
|
|||
baseFolderName = path.Base(block.HPath)
|
||||
}
|
||||
if "" == baseFolderName {
|
||||
baseFolderName = "Untitled"
|
||||
baseFolderName = Conf.language(105)
|
||||
}
|
||||
|
||||
docFiles := box.ListFiles(folderPath)
|
||||
|
|
|
|||
|
|
@ -1568,7 +1568,7 @@ func RenameDoc(boxID, p, title string) (err error) {
|
|||
return
|
||||
}
|
||||
if "" == title {
|
||||
title = "Untitled"
|
||||
title = Conf.language(105)
|
||||
}
|
||||
title = strings.ReplaceAll(title, "/", "")
|
||||
|
||||
|
|
@ -1604,6 +1604,10 @@ func createDoc(boxID, p, title, dom string) (tree *parse.Tree, err error) {
|
|||
return
|
||||
}
|
||||
title = strings.ReplaceAll(title, "/", "")
|
||||
title = strings.TrimSpace(title)
|
||||
if "" == title {
|
||||
title = Conf.Language(105)
|
||||
}
|
||||
|
||||
baseName := strings.TrimSpace(path.Base(p))
|
||||
if "" == strings.TrimSuffix(baseName, ".sy") {
|
||||
|
|
|
|||
|
|
@ -687,7 +687,7 @@ func indexHistoryDir(name string, luteEngine *lute.Lute) {
|
|||
|
||||
title := tree.Root.IALAttr("title")
|
||||
if "" == title {
|
||||
title = "Untitled"
|
||||
title = Conf.language(105)
|
||||
}
|
||||
content := tree.Root.Content()
|
||||
p := strings.TrimPrefix(doc, util.HistoryDir)
|
||||
|
|
|
|||
|
|
@ -40,6 +40,9 @@ func CreateBox(name string) (id string, err error) {
|
|||
err = errors.New(Conf.Language(106))
|
||||
return
|
||||
}
|
||||
if "" == name {
|
||||
name = Conf.language(105)
|
||||
}
|
||||
|
||||
WaitForWritingFiles()
|
||||
|
||||
|
|
@ -67,6 +70,16 @@ func RenameBox(boxID, name string) (err error) {
|
|||
return errors.New(Conf.Language(0))
|
||||
}
|
||||
|
||||
if 512 < utf8.RuneCountInString(name) {
|
||||
// 限制笔记本名和文档名最大长度为 `512`
|
||||
err = errors.New(Conf.Language(106))
|
||||
return
|
||||
}
|
||||
|
||||
if "" == name {
|
||||
name = Conf.language(105)
|
||||
}
|
||||
|
||||
boxConf := box.GetConf()
|
||||
boxConf.Name = name
|
||||
box.Name = name
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue