浏览代码

:art: Title localization when creating a document https://github.com/siyuan-note/siyuan/issues/10719

Daniel 1 年之前
父节点
当前提交
2a8809bc7e

+ 1 - 1
app/appearance/langs/en_US.json

@@ -1317,7 +1317,7 @@
     "102": "Processing completed",
     "102": "Processing completed",
     "103": "The update installation package has been automatically downloaded in the background. When exiting, you will be asked whether to install the new version",
     "103": "The update installation package has been automatically downloaded in the background. When exiting, you will be asked whether to install the new version",
     "104": "The update installation package failed to download, please check the network connection",
     "104": "The update installation package failed to download, please check the network connection",
-    "105": "TODO",
+    "105": "Untitled",
     "106": "Maximum length is limited to 512 characters",
     "106": "Maximum length is limited to 512 characters",
     "107": "Moved document [%s]",
     "107": "Moved document [%s]",
     "108": "Data sync found conflicts, you can view the generated conflict content in [Data History]",
     "108": "Data sync found conflicts, you can view the generated conflict content in [Data History]",

+ 1 - 1
app/appearance/langs/es_ES.json

@@ -1317,7 +1317,7 @@
     "102": "Procesamiento completado",
     "102": "Procesamiento completado",
     "103": "El paquete de instalación de la actualización se ha descargado automáticamente en segundo plano. Al salir, se le preguntará si desea instalar la nueva versión",
     "103": "El paquete de instalación de la actualización se ha descargado automáticamente en segundo plano. Al salir, se le preguntará si desea instalar la nueva versión",
     "104": "El paquete de instalación de la actualización no se pudo descargar, verifique la conexión de red",
     "104": "El paquete de instalación de la actualización no se pudo descargar, verifique la conexión de red",
-    "105": "TODO",
+    "105": "Sin título",
     "106": "La longitud máxima está limitada a 512 caracteres",
     "106": "La longitud máxima está limitada a 512 caracteres",
     "107": "Documento movido [%s]",
     "107": "Documento movido [%s]",
     "108": "La sincronizaci\u00f3n de datos encontr\u00f3 en conflictos, puede ver el contenido del conflicto generado en [Historial de datos]",
     "108": "La sincronizaci\u00f3n de datos encontr\u00f3 en conflictos, puede ver el contenido del conflicto generado en [Historial de datos]",

+ 1 - 1
app/appearance/langs/fr_FR.json

@@ -1317,7 +1317,7 @@
     "102": "Traitement terminé",
     "102": "Traitement terminé",
     "103": "Le package d'installation de la mise à jour a été automatiquement téléchargé en arrière-plan. En quittant, il vous sera demandé si vous souhaitez installer la nouvelle version",
     "103": "Le package d'installation de la mise à jour a été automatiquement téléchargé en arrière-plan. En quittant, il vous sera demandé si vous souhaitez installer la nouvelle version",
     "104": "Le package d'installation de la mise à jour n'a pas pu être téléchargé, veuillez vérifier la connexion réseau",
     "104": "Le package d'installation de la mise à jour n'a pas pu être téléchargé, veuillez vérifier la connexion réseau",
-    "105": "TODO",
+    "105": "Sans titre",
     "106": "La longueur maximale est limitée à 512 caractères",
     "106": "La longueur maximale est limitée à 512 caractères",
     "107": "Document déplacé [%s]",
     "107": "Document déplacé [%s]",
     "108": "La synchronisation des données a trouvé des conflits, vous pouvez afficher le contenu du conflit généré dans [Historique des données]",
     "108": "La synchronisation des données a trouvé des conflits, vous pouvez afficher le contenu du conflit généré dans [Historique des données]",

+ 2 - 2
app/appearance/langs/zh_CHT.json

@@ -648,7 +648,7 @@
   "changeIcon": "修改圖示",
   "changeIcon": "修改圖示",
   "randomIcon": "隨機圖標",
   "randomIcon": "隨機圖標",
   "includeSubFile": "\n包含 x 個子文檔",
   "includeSubFile": "\n包含 x 個子文檔",
-  "untitled": "新文檔",
+  "untitled": "未命名",
   "lockScreen": "鎖定畫面",
   "lockScreen": "鎖定畫面",
   "cloudIntro1": "端到端加密資料同步",
   "cloudIntro1": "端到端加密資料同步",
   "cloudIntro2": "加密和解密過程完全在本地設備上進行",
   "cloudIntro2": "加密和解密過程完全在本地設備上進行",
@@ -1317,7 +1317,7 @@
     "102": "處理完畢",
     "102": "處理完畢",
     "103": "已經在後台開始自動下載更新安裝檔,退出時將詢問是否安裝新版本",
     "103": "已經在後台開始自動下載更新安裝檔,退出時將詢問是否安裝新版本",
     "104": "更新安裝檔下載失敗,請檢查網絡連接",
     "104": "更新安裝檔下載失敗,請檢查網絡連接",
-    "105": "TODO",
+    "105": "未命名",
     "106": "最大長度限制為 512 字元",
     "106": "最大長度限制為 512 字元",
     "107": "已經移動文檔 [%s]",
     "107": "已經移動文檔 [%s]",
     "108": "資料同步發現衝突,可在 [資料歷史] 中查看生成的衝突內容",
     "108": "資料同步發現衝突,可在 [資料歷史] 中查看生成的衝突內容",

+ 2 - 2
app/appearance/langs/zh_CN.json

@@ -648,7 +648,7 @@
   "changeIcon": "修改图标",
   "changeIcon": "修改图标",
   "randomIcon": "随机图标",
   "randomIcon": "随机图标",
   "includeSubFile": "\n包含 x 个子文档",
   "includeSubFile": "\n包含 x 个子文档",
-  "untitled": "新文档",
+  "untitled": "未命名",
   "lockScreen": "锁屏",
   "lockScreen": "锁屏",
   "cloudIntro1": "端到端加密数据同步",
   "cloudIntro1": "端到端加密数据同步",
   "cloudIntro2": "加密和解密过程完全在本地设备上进行",
   "cloudIntro2": "加密和解密过程完全在本地设备上进行",
@@ -1317,7 +1317,7 @@
     "102": "处理完毕",
     "102": "处理完毕",
     "103": "已经在后台开始自动下载更新安装包,退出时将询问是否安装新版本",
     "103": "已经在后台开始自动下载更新安装包,退出时将询问是否安装新版本",
     "104": "更新安装包下载失败,请检查网络连接",
     "104": "更新安装包下载失败,请检查网络连接",
-    "105": "TODO",
+    "105": "未命名",
     "106": "最大长度限制为 512 字符",
     "106": "最大长度限制为 512 字符",
     "107": "已经移动文档 [%s]",
     "107": "已经移动文档 [%s]",
     "108": "数据同步发现冲突,可在 [数据历史] 中查看生成的冲突内容",
     "108": "数据同步发现冲突,可在 [数据历史] 中查看生成的冲突内容",

+ 4 - 5
app/src/boot/globalEvent/keydown.ts

@@ -18,8 +18,7 @@ import {newFile} from "../../util/newFile";
 import {Constants} from "../../constants";
 import {Constants} from "../../constants";
 import {openSetting} from "../../config";
 import {openSetting} from "../../config";
 import {getInstanceById} from "../../layout/util";
 import {getInstanceById} from "../../layout/util";
-import {closeTabByType, copyTab, getDockByType, resizeTabs, switchTabByIndex} from "../../layout/tabUtil";
-import {getActiveTab} from "../../layout/tabUtil";
+import {closeTabByType, copyTab, getActiveTab, getDockByType, resizeTabs, switchTabByIndex} from "../../layout/tabUtil";
 import {Tab} from "../../layout/Tab";
 import {Tab} from "../../layout/Tab";
 import {Editor} from "../../editor";
 import {Editor} from "../../editor";
 import {setEditMode} from "../../protyle/util/setEditMode";
 import {setEditMode} from "../../protyle/util/setEditMode";
@@ -369,7 +368,7 @@ const editKeydown = (app: App, event: KeyboardEvent) => {
     }
     }
     if (!isFileFocus && matchHotKey(window.siyuan.config.keymap.editor.general.spaceRepetition.custom, event)) {
     if (!isFileFocus && matchHotKey(window.siyuan.config.keymap.editor.general.spaceRepetition.custom, event)) {
         fetchPost("/api/riff/getTreeRiffDueCards", {rootID: protyle.block.rootID}, (response) => {
         fetchPost("/api/riff/getTreeRiffDueCards", {rootID: protyle.block.rootID}, (response) => {
-            openCardByData(app, response.data, "doc", protyle.block.rootID, protyle.title.editElement.textContent || "Untitled");
+            openCardByData(app, response.data, "doc", protyle.block.rootID, protyle.title.editElement.textContent || window.siyuan.languages.untitled);
         });
         });
         event.preventDefault();
         event.preventDefault();
         return true;
         return true;
@@ -428,7 +427,7 @@ const editKeydown = (app: App, event: KeyboardEvent) => {
             blockId: protyle.block.id,
             blockId: protyle.block.id,
             rootId: protyle.block.rootID,
             rootId: protyle.block.rootID,
             useBlockId: protyle.block.showAll,
             useBlockId: protyle.block.showAll,
-            title: protyle.title ? (protyle.title.editElement.textContent || "Untitled") : null,
+            title: protyle.title ? (protyle.title.editElement.textContent || window.siyuan.languages.untitled) : null,
         });
         });
         return true;
         return true;
     }
     }
@@ -449,7 +448,7 @@ const editKeydown = (app: App, event: KeyboardEvent) => {
             blockId: protyle.block.id,
             blockId: protyle.block.id,
             rootId: protyle.block.rootID,
             rootId: protyle.block.rootID,
             useBlockId: protyle.block.showAll,
             useBlockId: protyle.block.showAll,
-            title: protyle.title ? (protyle.title.editElement.textContent || "Untitled") : null,
+            title: protyle.title ? (protyle.title.editElement.textContent || window.siyuan.languages.untitled) : null,
         });
         });
         return true;
         return true;
     }
     }

+ 2 - 2
app/src/dialog/processSystem.ts

@@ -54,7 +54,7 @@ export const reloadSync = (app: App, data: { upsertRootIDs: string[], removeRoot
                 id: window.siyuan.mobile.editor.protyle.block.rootID
                 id: window.siyuan.mobile.editor.protyle.block.rootID
             }, (response) => {
             }, (response) => {
                 setTitle(response.data.name);
                 setTitle(response.data.name);
-                (document.getElementById("toolbarName") as HTMLInputElement).value = response.data.name === "Untitled" ? "" : response.data.name;
+                (document.getElementById("toolbarName") as HTMLInputElement).value = response.data.name === window.siyuan.languages.untitled ? "" : response.data.name;
             });
             });
         }
         }
     }
     }
@@ -389,7 +389,7 @@ export const setTitle = (title: string) => {
             dragElement.setAttribute("title", versionTitle);
             dragElement.setAttribute("title", versionTitle);
         }
         }
     } else {
     } else {
-        title = title || "Untitled";
+        title = title || window.siyuan.languages.untitled;
         document.title = `${title} - ${workspaceName} - ${window.siyuan.languages.siyuanNote} v${Constants.SIYUAN_VERSION}`;
         document.title = `${title} - ${workspaceName} - ${window.siyuan.languages.siyuanNote} v${Constants.SIYUAN_VERSION}`;
         if (!dragElement) {
         if (!dragElement) {
             return;
             return;

+ 1 - 1
app/src/editor/rename.ts

@@ -82,7 +82,7 @@ export const rename = (options: {
             return false;
             return false;
         }
         }
         if (inputElement.value.trim() === "") {
         if (inputElement.value.trim() === "") {
-            inputElement.value = "Untitled";
+            inputElement.value = window.siyuan.languages.untitled;
         } else {
         } else {
             inputElement.value = replaceFileName(inputElement.value);
             inputElement.value = replaceFileName(inputElement.value);
         }
         }

+ 6 - 6
app/src/layout/dock/util.ts

@@ -40,13 +40,13 @@ export const openBacklink = async (options: {
         }
         }
         options.rootId = response.data.rootID;
         options.rootId = response.data.rootID;
         options.useBlockId = response.data.rootID !== response.data.id;
         options.useBlockId = response.data.rootID !== response.data.id;
-        options.title = response.data.name || "Untitled";
+        options.title = response.data.name || window.siyuan.languages.untitled;
     } else if (!options.title) {
     } else if (!options.title) {
         const response = await fetchSyncPost("api/block/getDocInfo", {id: options.blockId});
         const response = await fetchSyncPost("api/block/getDocInfo", {id: options.blockId});
         if (response.code === -1) {
         if (response.code === -1) {
             return;
             return;
         }
         }
-        options.title = response.data.name || "Untitled";
+        options.title = response.data.name || window.siyuan.languages.untitled;
     }
     }
     const newWnd = wnd.split("lr");
     const newWnd = wnd.split("lr");
     newWnd.addTab(new Tab({
     newWnd.addTab(new Tab({
@@ -96,13 +96,13 @@ export const openGraph = async (options: {
         }
         }
         options.rootId = response.data.rootID;
         options.rootId = response.data.rootID;
         options.useBlockId = response.data.rootID !== response.data.id;
         options.useBlockId = response.data.rootID !== response.data.id;
-        options.title = response.data.name || "Untitled";
+        options.title = response.data.name || window.siyuan.languages.untitled;
     } else if (!options.title) {
     } else if (!options.title) {
         const response = await fetchSyncPost("api/block/getDocInfo", {id: options.blockId});
         const response = await fetchSyncPost("api/block/getDocInfo", {id: options.blockId});
         if (response.code === -1) {
         if (response.code === -1) {
             return;
             return;
         }
         }
-        options.title = response.data.name || "Untitled";
+        options.title = response.data.name || window.siyuan.languages.untitled;
     }
     }
     const newWnd = wnd.split("lr");
     const newWnd = wnd.split("lr");
     newWnd.addTab(new Tab({
     newWnd.addTab(new Tab({
@@ -142,9 +142,9 @@ export const openOutline = async (protyle: IProtyle) => {
     let title = "";
     let title = "";
     if (!protyle.title) {
     if (!protyle.title) {
         const response = await fetchSyncPost("api/block/getDocInfo", {id: protyle.block.rootID});
         const response = await fetchSyncPost("api/block/getDocInfo", {id: protyle.block.rootID});
-        title = response.data.name || "Untitled";
+        title = response.data.name || window.siyuan.languages.untitled;
     } else {
     } else {
-        title = protyle.title.editElement.textContent || "Untitled";
+        title = protyle.title.editElement.textContent || window.siyuan.languages.untitled;
     }
     }
     newWnd.addTab(new Tab({
     newWnd.addTab(new Tab({
         icon: "iconAlignCenter",
         icon: "iconAlignCenter",

+ 1 - 1
app/src/menus/commonMenuItem.ts

@@ -476,7 +476,7 @@ export const exportMd = (id: string) => {
                 });
                 });
                 btnsElement[1].addEventListener("click", () => {
                 btnsElement[1].addEventListener("click", () => {
                     if (inputElement.value.trim() === "") {
                     if (inputElement.value.trim() === "") {
-                        inputElement.value = "Untitled";
+                        inputElement.value = window.siyuan.languages.untitled;
                     } else {
                     } else {
                         inputElement.value = replaceFileName(inputElement.value);
                         inputElement.value = replaceFileName(inputElement.value);
                     }
                     }

+ 1 - 1
app/src/mobile/editor.ts

@@ -91,7 +91,7 @@ export const openMobileFileById = (app: App, id: string, action = [Constants.CB_
         } else {
         } else {
             window.siyuan.mobile.editor = new Protyle(app, document.getElementById("editor"), protyleOptions);
             window.siyuan.mobile.editor = new Protyle(app, document.getElementById("editor"), protyleOptions);
         }
         }
-        (document.getElementById("toolbarName") as HTMLInputElement).value = data.data.rootTitle === "Untitled" ? "" : data.data.rootTitle;
+        (document.getElementById("toolbarName") as HTMLInputElement).value = data.data.rootTitle === window.siyuan.languages.untitled ? "" : data.data.rootTitle;
         setEditor();
         setEditor();
         closePanel();
         closePanel();
     });
     });

+ 1 - 1
app/src/mobile/util/MobileBackFoward.ts

@@ -44,7 +44,7 @@ const focusStack = (backStack: IBackStack) => {
             id: backStack.id,
             id: backStack.id,
         }, (response) => {
         }, (response) => {
             setTitle(response.data.name);
             setTitle(response.data.name);
-            (document.getElementById("toolbarName") as HTMLInputElement).value = response.data.name === "Untitled" ? "" : response.data.name;
+            (document.getElementById("toolbarName") as HTMLInputElement).value = response.data.name === window.siyuan.languages.untitled ? "" : response.data.name;
             protyle.background.render(response.data.ial, protyle.block.rootID);
             protyle.background.render(response.data.ial, protyle.block.rootID);
             protyle.wysiwyg.renderCustom(response.data.ial);
             protyle.wysiwyg.renderCustom(response.data.ial);
         });
         });

+ 8 - 7
app/src/protyle/header/Title.ts

@@ -1,14 +1,15 @@
 import {
 import {
-    focusBlock, focusByOffset,
-    focusByRange, focusByWbr,
-    getEditorRange, getSelectionOffset,
+    focusBlock,
+    focusByOffset,
+    focusByRange,
+    focusByWbr,
+    getEditorRange,
+    getSelectionOffset,
 } from "../util/selection";
 } from "../util/selection";
 import {fetchPost} from "../../util/fetch";
 import {fetchPost} from "../../util/fetch";
 import {replaceFileName, validateName} from "../../editor/rename";
 import {replaceFileName, validateName} from "../../editor/rename";
 import {MenuItem} from "../../menus/Menu";
 import {MenuItem} from "../../menus/Menu";
-import {
-    openFileAttr,
-} from "../../menus/commonMenuItem";
+import {openFileAttr,} from "../../menus/commonMenuItem";
 import {Constants} from "../../constants";
 import {Constants} from "../../constants";
 import {matchHotKey} from "../util/hotKey";
 import {matchHotKey} from "../util/hotKey";
 import {isMac, readText, writeText} from "../util/compatibility";
 import {isMac, readText, writeText} from "../util/compatibility";
@@ -264,7 +265,7 @@ export class Title {
 
 
     public setTitle(title: string) {
     public setTitle(title: string) {
         if (code160to32(title) !== code160to32(this.editElement.textContent)) {
         if (code160to32(title) !== code160to32(this.editElement.textContent)) {
-            this.editElement.textContent = title === "Untitled" ? "" : title;
+            this.editElement.textContent = title === window.siyuan.languages.untitled ? "" : title;
         }
         }
     }
     }
 
 

+ 3 - 9
app/src/protyle/header/openTitleMenu.ts

@@ -1,12 +1,6 @@
 import {fetchPost, fetchSyncPost} from "../../util/fetch";
 import {fetchPost, fetchSyncPost} from "../../util/fetch";
 import {MenuItem} from "../../menus/Menu";
 import {MenuItem} from "../../menus/Menu";
-import {
-    copySubMenu,
-    exportMd,
-    movePathToMenu,
-    openFileAttr,
-    openFileWechatNotify,
-} from "../../menus/commonMenuItem";
+import {copySubMenu, exportMd, movePathToMenu, openFileAttr, openFileWechatNotify,} from "../../menus/commonMenuItem";
 import {deleteFile} from "../../editor/deleteFile";
 import {deleteFile} from "../../editor/deleteFile";
 import {updateHotkeyTip} from "../util/compatibility";
 import {updateHotkeyTip} from "../util/compatibility";
 /// #if !MOBILE
 /// #if !MOBILE
@@ -105,7 +99,7 @@ export const openTitleMenu = (protyle: IProtyle, position: IPosition) => {
                     blockId: protyle.block.id,
                     blockId: protyle.block.id,
                     rootId: protyle.block.rootID,
                     rootId: protyle.block.rootID,
                     useBlockId: protyle.block.showAll,
                     useBlockId: protyle.block.showAll,
-                    title: protyle.title ? (protyle.title.editElement.textContent || "Untitled") : null
+                    title: protyle.title ? (protyle.title.editElement.textContent || window.siyuan.languages.untitled) : null
                 });
                 });
             }
             }
         }).element);
         }).element);
@@ -119,7 +113,7 @@ export const openTitleMenu = (protyle: IProtyle, position: IPosition) => {
                     blockId: protyle.block.id,
                     blockId: protyle.block.id,
                     rootId: protyle.block.rootID,
                     rootId: protyle.block.rootID,
                     useBlockId: protyle.block.showAll,
                     useBlockId: protyle.block.showAll,
-                    title: protyle.title ? (protyle.title.editElement.textContent || "Untitled") : null
+                    title: protyle.title ? (protyle.title.editElement.textContent || window.siyuan.languages.untitled) : null
                 });
                 });
             }
             }
         }).element);
         }).element);

+ 1 - 1
app/src/protyle/hint/index.ts

@@ -619,7 +619,7 @@ ${genHintItemHTML(item)}
                 fetchPost("/api/filetree/createDoc", {
                 fetchPost("/api/filetree/createDoc", {
                     notebook: protyle.notebookId,
                     notebook: protyle.notebookId,
                     path: pathPosix().join(getDisplayName(protyle.path, false, true), newSubDocId + ".sy"),
                     path: pathPosix().join(getDisplayName(protyle.path, false, true), newSubDocId + ".sy"),
-                    title: "Untitled",
+                    title: window.siyuan.languages.untitled,
                     md: ""
                     md: ""
                 }, () => {
                 }, () => {
                     insertHTML(`<span data-type="block-ref" data-id="${newSubDocId}" data-subtype="d">Untitled</span>`, protyle);
                     insertHTML(`<span data-type="block-ref" data-id="${newSubDocId}" data-subtype="d">Untitled</span>`, protyle);

+ 2 - 2
app/src/protyle/render/av/blockAttr.ts

@@ -13,9 +13,9 @@ const genAVRollupHTML = (value: IAVCellValue) => {
     switch (value.type) {
     switch (value.type) {
         case "block":
         case "block":
             if (value?.isDetached) {
             if (value?.isDetached) {
-                html = `<span data-id="${value.block?.id}">${value.block?.content || "Untitled"}</span>`;
+                html = `<span data-id="${value.block?.id}">${value.block?.content || window.siyuan.languages.untitled}</span>`;
             } else {
             } else {
-                html = `<span data-type="block-ref" data-id="${value.block?.id}" data-subtype="s" class="av__celltext--ref">${value.block?.content || "Untitled"}</span>`;
+                html = `<span data-type="block-ref" data-id="${value.block?.id}" data-subtype="s" class="av__celltext--ref">${value.block?.content || window.siyuan.languages.untitled}</span>`;
             }
             }
             break;
             break;
         case "text":
         case "text":

+ 3 - 3
app/src/protyle/render/av/cell.ts

@@ -613,7 +613,7 @@ export const renderCell = (cellValue: IAVCellValue) => {
             text = `<span class="av__celltext">${cellValue.block.content || ""}</span>
             text = `<span class="av__celltext">${cellValue.block.content || ""}</span>
 <span class="b3-chip b3-chip--info b3-chip--small" data-type="block-more">${window.siyuan.languages.more}</span>`;
 <span class="b3-chip b3-chip--info b3-chip--small" data-type="block-more">${window.siyuan.languages.more}</span>`;
         } else {
         } else {
-            text = `<span data-type="block-ref" data-id="${cellValue.block.id}" data-subtype="s" class="av__celltext av__celltext--ref">${cellValue.block.content || "Untitled"}</span>
+            text = `<span data-type="block-ref" data-id="${cellValue.block.id}" data-subtype="s" class="av__celltext av__celltext--ref">${cellValue.block.content || window.siyuan.languages.untitled}</span>
 <span class="b3-chip b3-chip--info b3-chip--small" data-type="block-more">${window.siyuan.languages.update}</span>`;
 <span class="b3-chip b3-chip--info b3-chip--small" data-type="block-more">${window.siyuan.languages.update}</span>`;
         }
         }
     } else if (cellValue.type === "number") {
     } else if (cellValue.type === "number") {
@@ -691,9 +691,9 @@ const renderRollup = (cellValue: IAVCellValue) => {
         }
         }
     } else if (cellValue.type === "block") {
     } else if (cellValue.type === "block") {
         if (cellValue?.isDetached) {
         if (cellValue?.isDetached) {
-            text = `<span class="av__celltext" data-id="${cellValue.block?.id}">${cellValue.block?.content || "Untitled"}</span>`;
+            text = `<span class="av__celltext" data-id="${cellValue.block?.id}">${cellValue.block?.content || window.siyuan.languages.untitled}</span>`;
         } else {
         } else {
-            text = `<span data-type="block-ref" data-id="${cellValue.block?.id}" data-subtype="s" class="av__celltext av__celltext--ref">${cellValue.block?.content || "Untitled"}</span>`;
+            text = `<span data-type="block-ref" data-id="${cellValue.block?.id}" data-subtype="s" class="av__celltext av__celltext--ref">${cellValue.block?.content || window.siyuan.languages.untitled}</span>`;
         }
         }
     } else if (cellValue.type === "number") {
     } else if (cellValue.type === "number") {
         text = cellValue?.number.formattedContent || cellValue?.number.content.toString() || "";
         text = cellValue?.number.formattedContent || cellValue?.number.content.toString() || "";

+ 4 - 4
app/src/protyle/render/av/relation.ts

@@ -240,11 +240,11 @@ const filterItem = (menuElement: Element, cellElement: HTMLElement, keyword: str
         const hasIds: string[] = [];
         const hasIds: string[] = [];
         cellElement.querySelectorAll("span").forEach((item) => {
         cellElement.querySelectorAll("span").forEach((item) => {
             hasIds.push(item.dataset.id);
             hasIds.push(item.dataset.id);
-            selectHTML += `<button data-id="${item.dataset.id}" data-type="setRelationCell" class="b3-menu__item${item.textContent.indexOf(keyword) > -1 ? "" : " fn__none"}" draggable="true">${genSelectItemHTML("selected", item.dataset.id, !item.classList.contains("av__celltext--ref"), item.textContent || "Untitled")}</button>`;
+            selectHTML += `<button data-id="${item.dataset.id}" data-type="setRelationCell" class="b3-menu__item${item.textContent.indexOf(keyword) > -1 ? "" : " fn__none"}" draggable="true">${genSelectItemHTML("selected", item.dataset.id, !item.classList.contains("av__celltext--ref"), item.textContent || window.siyuan.languages.untitled)}</button>`;
         });
         });
         cells.forEach((item) => {
         cells.forEach((item) => {
             if (!hasIds.includes(item.block.id)) {
             if (!hasIds.includes(item.block.id)) {
-                html += genSelectItemHTML("unselect", item.block.id, item.isDetached, item.block.content || "Untitled");
+                html += genSelectItemHTML("unselect", item.block.id, item.isDetached, item.block.content || window.siyuan.languages.untitled);
             }
             }
         });
         });
         menuElement.querySelector(".b3-menu__items").innerHTML = `${selectHTML || genSelectItemHTML("empty")}
         menuElement.querySelector(".b3-menu__items").innerHTML = `${selectHTML || genSelectItemHTML("empty")}
@@ -270,11 +270,11 @@ export const bindRelationEvent = (options: {
         const hasIds: string[] = [];
         const hasIds: string[] = [];
         options.cellElements[0].querySelectorAll("span").forEach((item) => {
         options.cellElements[0].querySelectorAll("span").forEach((item) => {
             hasIds.push(item.dataset.id);
             hasIds.push(item.dataset.id);
-            selectHTML += `<button data-id="${item.dataset.id}" data-type="setRelationCell" class="b3-menu__item" draggable="true">${genSelectItemHTML("selected", item.dataset.id, !item.classList.contains("av__celltext--ref"), item.textContent || "Untitled")}</button>`;
+            selectHTML += `<button data-id="${item.dataset.id}" data-type="setRelationCell" class="b3-menu__item" draggable="true">${genSelectItemHTML("selected", item.dataset.id, !item.classList.contains("av__celltext--ref"), item.textContent || window.siyuan.languages.untitled)}</button>`;
         });
         });
         cells.forEach((item) => {
         cells.forEach((item) => {
             if (!hasIds.includes(item.block.id)) {
             if (!hasIds.includes(item.block.id)) {
-                html += genSelectItemHTML("unselect", item.block.id, item.isDetached, item.block.content || "Untitled");
+                html += genSelectItemHTML("unselect", item.block.id, item.isDetached, item.block.content || window.siyuan.languages.untitled);
             }
             }
         });
         });
         options.menuElement.querySelector(".b3-menu__label").innerHTML = response.data.name;
         options.menuElement.querySelector(".b3-menu__label").innerHTML = response.data.name;

+ 5 - 5
app/src/util/newFile.ts

@@ -96,7 +96,7 @@ export const newFile = (optios: {
             if (data.data.path.startsWith("/") || optios.currentPath === "/") {
             if (data.data.path.startsWith("/") || optios.currentPath === "/") {
                 fetchPost("/api/filetree/createDocWithMd", {
                 fetchPost("/api/filetree/createDocWithMd", {
                     notebook: optios.notebookId,
                     notebook: optios.notebookId,
-                    path: pathPosix().join(data.data.path, optios.name || (data.data.path.endsWith("/") ? "Untitled" : "")),
+                    path: pathPosix().join(data.data.path, optios.name || (data.data.path.endsWith("/") ? window.siyuan.languages.untitled : "")),
                     // 根目录时无法确定 parentID
                     // 根目录时无法确定 parentID
                     markdown: ""
                     markdown: ""
                 }, response => {
                 }, response => {
@@ -117,7 +117,7 @@ export const newFile = (optios: {
                 }, (responseHPath) => {
                 }, (responseHPath) => {
                     fetchPost("/api/filetree/createDocWithMd", {
                     fetchPost("/api/filetree/createDocWithMd", {
                         notebook: optios.notebookId,
                         notebook: optios.notebookId,
-                        path: pathPosix().join(responseHPath.data, data.data.path, optios.name || (data.data.path.endsWith("/") ? "Untitled" : "")),
+                        path: pathPosix().join(responseHPath.data, data.data.path, optios.name || (data.data.path.endsWith("/") ? window.siyuan.languages.untitled : "")),
                         parentID: getDisplayName(optios.currentPath, true, true),
                         parentID: getDisplayName(optios.currentPath, true, true),
                         markdown: ""
                         markdown: ""
                     }, response => {
                     }, response => {
@@ -134,7 +134,7 @@ export const newFile = (optios: {
                 });
                 });
             }
             }
         } else {
         } else {
-            const title = pathPosix().basename(data.data.path || "Untitled");
+            const title = pathPosix().basename(data.data.path || window.siyuan.languages.untitled);
             if (!validateName(title)) {
             if (!validateName(title)) {
                 return;
                 return;
             }
             }
@@ -191,12 +191,12 @@ export const newFileByName = (app: App, value: string) => {
     newFile({
     newFile({
         app,
         app,
         useSavePath: true,
         useSavePath: true,
-        name: replaceFileName(value.trim()) || "Untitled"
+        name: replaceFileName(value.trim()) || window.siyuan.languages.untitled
     });
     });
 };
 };
 
 
 export const newFileBySelect = (protyle: IProtyle, selectText: string, nodeElement: HTMLElement, pathDir: string) => {
 export const newFileBySelect = (protyle: IProtyle, selectText: string, nodeElement: HTMLElement, pathDir: string) => {
-    const newFileName = replaceFileName(selectText.trim() ? selectText.trim() : protyle.lute.BlockDOM2Content(nodeElement.outerHTML).replace(/\n/g, "")) || "Untitled";
+    const newFileName = replaceFileName(selectText.trim() ? selectText.trim() : protyle.lute.BlockDOM2Content(nodeElement.outerHTML).replace(/\n/g, "")) || window.siyuan.languages.untitled;
     const hPath = pathPosix().join(pathDir, newFileName);
     const hPath = pathPosix().join(pathDir, newFileName);
     fetchPost("/api/filetree/getIDsByHPath", {
     fetchPost("/api/filetree/getIDsByHPath", {
         path: hPath,
         path: hPath,

+ 1 - 1
kernel/model/attribute_view.go

@@ -1738,7 +1738,7 @@ func getAvNames(avIDs string) (ret string) {
 			continue
 			continue
 		}
 		}
 		if "" == nodeAvName {
 		if "" == nodeAvName {
-			nodeAvName = "Untitled"
+			nodeAvName = Conf.language(105)
 		}
 		}
 
 
 		tpl := strings.ReplaceAll(attrAvNameTpl, "${avID}", nodeAvID)
 		tpl := strings.ReplaceAll(attrAvNameTpl, "${avID}", nodeAvID)

+ 1 - 1
kernel/model/blockinfo.go

@@ -101,7 +101,7 @@ func GetDocInfo(blockID string) (ret *BlockInfo) {
 		}
 		}
 
 
 		if "" == avName {
 		if "" == avName {
-			avName = "Untitled"
+			avName = Conf.language(105)
 		}
 		}
 
 
 		attrView := &AttrView{ID: avID, Name: avName}
 		attrView := &AttrView{ID: avID, Name: avName}

+ 2 - 2
kernel/model/export.go

@@ -76,7 +76,7 @@ func ExportAv2CSV(avID, blockID string) (zipPath string, err error) {
 
 
 	name := util.FilterFileName(attrView.Name)
 	name := util.FilterFileName(attrView.Name)
 	if "" == name {
 	if "" == name {
-		name = "Untitled"
+		name = Conf.language(105)
 	}
 	}
 
 
 	table, err := renderAttributeViewTable(attrView, view, "")
 	table, err := renderAttributeViewTable(attrView, view, "")
@@ -1375,7 +1375,7 @@ func BatchExportMarkdown(boxID, folderPath string) (zipPath string) {
 		baseFolderName = path.Base(block.HPath)
 		baseFolderName = path.Base(block.HPath)
 	}
 	}
 	if "" == baseFolderName {
 	if "" == baseFolderName {
-		baseFolderName = "Untitled"
+		baseFolderName = Conf.language(105)
 	}
 	}
 
 
 	docFiles := box.ListFiles(folderPath)
 	docFiles := box.ListFiles(folderPath)

+ 5 - 1
kernel/model/file.go

@@ -1568,7 +1568,7 @@ func RenameDoc(boxID, p, title string) (err error) {
 		return
 		return
 	}
 	}
 	if "" == title {
 	if "" == title {
-		title = "Untitled"
+		title = Conf.language(105)
 	}
 	}
 	title = strings.ReplaceAll(title, "/", "")
 	title = strings.ReplaceAll(title, "/", "")
 
 
@@ -1604,6 +1604,10 @@ func createDoc(boxID, p, title, dom string) (tree *parse.Tree, err error) {
 		return
 		return
 	}
 	}
 	title = strings.ReplaceAll(title, "/", "")
 	title = strings.ReplaceAll(title, "/", "")
+	title = strings.TrimSpace(title)
+	if "" == title {
+		title = Conf.Language(105)
+	}
 
 
 	baseName := strings.TrimSpace(path.Base(p))
 	baseName := strings.TrimSpace(path.Base(p))
 	if "" == strings.TrimSuffix(baseName, ".sy") {
 	if "" == strings.TrimSuffix(baseName, ".sy") {

+ 1 - 1
kernel/model/history.go

@@ -687,7 +687,7 @@ func indexHistoryDir(name string, luteEngine *lute.Lute) {
 
 
 		title := tree.Root.IALAttr("title")
 		title := tree.Root.IALAttr("title")
 		if "" == title {
 		if "" == title {
-			title = "Untitled"
+			title = Conf.language(105)
 		}
 		}
 		content := tree.Root.Content()
 		content := tree.Root.Content()
 		p := strings.TrimPrefix(doc, util.HistoryDir)
 		p := strings.TrimPrefix(doc, util.HistoryDir)

+ 13 - 0
kernel/model/mount.go

@@ -40,6 +40,9 @@ func CreateBox(name string) (id string, err error) {
 		err = errors.New(Conf.Language(106))
 		err = errors.New(Conf.Language(106))
 		return
 		return
 	}
 	}
+	if "" == name {
+		name = Conf.language(105)
+	}
 
 
 	WaitForWritingFiles()
 	WaitForWritingFiles()
 
 
@@ -67,6 +70,16 @@ func RenameBox(boxID, name string) (err error) {
 		return errors.New(Conf.Language(0))
 		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 := box.GetConf()
 	boxConf.Name = name
 	boxConf.Name = name
 	box.Name = name
 	box.Name = name