diff --git a/addon/locale/en-US/addon.ftl b/addon/locale/en-US/addon.ftl index 198c8e6..d532e07 100644 --- a/addon/locale/en-US/addon.ftl +++ b/addon/locale/en-US/addon.ftl @@ -37,28 +37,6 @@ editor-previewImage-title = Preview Image tab-name = Note Workspace tab-openInWindow = Drag and drop here to open workspace in new window -export-title = Export Notes -export-options-linkMode = Linked Notes Mode -export-options-MD = MarkDown(.md) -export-options-Docx = MS Word(.docx) -export-options-PDF = PDF(.pdf) -export-options-mm = Mind Map -export-options-note = Zotero Note -export-embedLink = All Embedded in One Export -export-standaloneLink = Each Converted to Standalone Exports -export-keepLink = Keep Zotero Links(zotero://note/) -export-exportMD = Export MD File(s) -export-setAutoSync = Set Auto-Sync -export-withYAMLHeader = With YAML Header -export-autoMDFileName = Auto Generate MD File Name -export-exportDocx = Export Docx File -export-exportPDF = Export PDF File -export-exportFreeMind = Export FreeMind File -export-exportNote = Export to New Zotero Note Item -export-confirm = Export -export-cancel = Close -export-target = Target - syncManager-noteName = Note Name syncManager-lastSync = Last Sync syncManager-filePath = MarkDown Path diff --git a/addon/locale/en-US/export.ftl b/addon/locale/en-US/export.ftl new file mode 100644 index 0000000..2348221 --- /dev/null +++ b/addon/locale/en-US/export.ftl @@ -0,0 +1,25 @@ +title = Export Notes +options-linkMode = Linked Notes Mode +options-MD = MarkDown(.md) +options-Docx = MS Word(.docx) +options-PDF = PDF(.pdf) +options-mm = Mind Map +options-note = Zotero Note +embedLink = All Embedded in One Export +standaloneLink = Each Converted to Standalone Exports +keepLink = Keep Zotero Links(zotero://note/) +exportMD = Export MD File(s) +setAutoSync = Set Auto-Sync + .title = Auto-Sync is available for "Each Converted to Standalone Exports" mode. +withYAMLHeader = With YAML Header +autoMDFileName = Auto Generate MD File Name +exportDocx = Export Docx File +exportPDF = Export PDF File +exportFreeMind = Export FreeMind File +exportNote = Export to New Zotero Note Item +confirm = Export +cancel = Close +target = Target: {$title}{ $left -> + [0]{ "" } + *[other] { " " }and {$left} more. + } \ No newline at end of file diff --git a/addon/locale/it-IT/addon.ftl b/addon/locale/it-IT/addon.ftl index 0497106..8fb74dc 100644 --- a/addon/locale/it-IT/addon.ftl +++ b/addon/locale/it-IT/addon.ftl @@ -33,28 +33,6 @@ templateEditor-templateName = Nome template tab-name = Spazio di lavoro della nota tab-openInWindow = Trascina qui per aprire lo spazio di lavoro in una nuova finestra -export-title = Esporta note -export-options-linkMode = Modalità note collegate -export-options-MD = MarkDown(.md) -export-options-Docx = MS Word(.docx) -export-options-PDF = PDF(.pdf) -export-options-mm = Mappa mentale -export-options-note = Nota Zotero -export-embedLink = Tutte incorporate in un'unica esportazione -export-standaloneLink = Ciascuna convertita in esportazioni indipendenti -export-keepLink = Mantieni i link Zotero (zotero://note/) -export-exportMD = Esporta file MD -export-setAutoSync = Imposta sincronizzazione automatica -export-withYAMLHeader = Con header YAML -export-autoMDFileName = Genera automaticamente il nome del file MD -export-exportDocx = Esporta file Docx -export-exportPDF = Esporta file PDF -export-exportFreeMind = Esporta file FreeMind -export-exportNote = Esporta in una nuova nota dell'elemento Zotero -export-confirm = Esporta -export-cancel = Chiudi -export-target = Oggetto - syncManager-noteName = Nome nota syncManager-lastSync = Ultima sincronizzazione syncManager-filePath = Percorso MarkDown diff --git a/addon/locale/it-IT/export.ftl b/addon/locale/it-IT/export.ftl new file mode 100644 index 0000000..2ea1c47 --- /dev/null +++ b/addon/locale/it-IT/export.ftl @@ -0,0 +1,25 @@ +title = Esporta note +options-linkMode = Modalità note collegate +options-MD = MarkDown(.md) +options-Docx = MS Word(.docx) +options-PDF = PDF(.pdf) +options-mm = Mappa mentale +options-note = Nota Zotero +embedLink = Tutte incorporate in un'unica esportazione +standaloneLink = Ciascuna convertita in esportazioni indipendenti +keepLink = Mantieni i link Zotero (zotero://note/) +exportMD = Esporta file MD +setAutoSync = Imposta sincronizzazione automatica + .title = Auto-Sync is available for "Each Converted to Standalone Exports" mode. +withYAMLHeader = Con header YAML +autoMDFileName = Genera automaticamente il nome del file MD +exportDocx = Esporta file Docx +exportPDF = Esporta file PDF +exportFreeMind = Esporta file FreeMind +exportNote = Esporta in una nuova nota dell'elemento Zotero +confirm = Esporta +cancel = Chiudi +target = Oggetto: {$title}{ $left -> + [0]{ "" } + *[other] { " " }and {$left} more + } \ No newline at end of file diff --git a/addon/locale/ru-RU/addon.ftl b/addon/locale/ru-RU/addon.ftl index abd5a07..695aab1 100644 --- a/addon/locale/ru-RU/addon.ftl +++ b/addon/locale/ru-RU/addon.ftl @@ -37,28 +37,6 @@ editor-previewImage-title = Preview Image tab-name=Рабочее пространство заметок tab-openInWindow=Перетащите сюда для открытия раб. пространства в новом окне -export-title=Экспорт Заметок -export-options-linkMode=Режим связанных заметок -export-options-MD=MarkDown(.md) -export-options-Docx=MS Word(.docx) -export-options-PDF=PDF(.pdf) -export-options-mm=Mind Map -export-options-note=Zotero Note -export-embedLink=Все внедрённые в одном экспорте -export-standaloneLink=Каждый конвертированный в отдельный экспорт -export-keepLink=Сохранять Zotero ссылки(zotero://note/) -export-exportMD=Экспорт MD файл(-ов) -export-setAutoSync=Установить Авто-синк -export-withYAMLHeader=С YAML заголовком -export-autoMDFileName = Авто-имя MD файла -export-exportDocx=Экспорт Docx файл -export-exportPDF=Экспорт PDF файл -export-exportFreeMind=Экспорт FreeMind файл -export-exportNote=Экспорт в новый пункт Zotero Note -export-confirm=Экспорт -export-cancel=Закрыть -export-target=Цель - syncManager-noteName=Имя заметки syncManager-lastSync=Последний Синк syncManager-filePath=MarkDown путь diff --git a/addon/locale/ru-RU/export.ftl b/addon/locale/ru-RU/export.ftl new file mode 100644 index 0000000..436b82a --- /dev/null +++ b/addon/locale/ru-RU/export.ftl @@ -0,0 +1,25 @@ +title=Экспорт Заметок +options-linkMode=Режим связанных заметок +options-MD=MarkDown(.md) +options-Docx=MS Word(.docx) +options-PDF=PDF(.pdf) +options-mm=Mind Map +options-note=Zotero Note +embedLink=Все внедрённые в одном экспорте +standaloneLink=Каждый конвертированный в отдельный экспорт +keepLink=Сохранять Zotero ссылки(zotero://note/) +exportMD=Экспорт MD файл(-ов) +setAutoSync=Установить Авто-синк + .title = Auto-Sync is available for "Each Converted to Standalone Exports" mode. +withYAMLHeader=С YAML заголовком +autoMDFileName = Авто-имя MD файла +exportDocx=Экспорт Docx файл +exportPDF=Экспорт PDF файл +exportFreeMind=Экспорт FreeMind файл +exportNote=Экспорт в новый пункт Zotero Note +confirm=Экспорт +cancel=Закрыть +target=Цель: {$title}{ $left -> + [0]{ "" } + *[other] { " " }and {$left} more + } \ No newline at end of file diff --git a/addon/locale/tr-TR/addon.ftl b/addon/locale/tr-TR/addon.ftl index c4abbfc..9764fa2 100644 --- a/addon/locale/tr-TR/addon.ftl +++ b/addon/locale/tr-TR/addon.ftl @@ -37,28 +37,6 @@ editor-previewImage-title = Resmi Önizle tab-name = Not Çalışma Alanı tab-openInWindow = Çalışma alanını yeni bir pencerede açmak için buraya sürükleyip bırakın -export-title = Notları Dışa Aktar -export-options-linkMode = Bağlantılı Notlar Modu -export-options-MD = MarkDown(.md) -export-options-Docx = MS Word(.docx) -export-options-PDF = PDF(.pdf) -export-options-mm = Zihin Haritası -export-options-note = Zotero Notu -export-embedLink = Hepsi Tek Bir Dışarı Aktarma İçerisinde -export-standaloneLink = Her Biri Bağımsız Olarak Dışa Aktarıldı -export-keepLink = Zotero Linkleri Kalsın (zotero://note/) -export-exportMD = MD Dosya(lar)sını Dışa Aktar -export-setAutoSync = Oto-Senkronizasyonu Belirle -export-withYAMLHeader = YAML Başlığı İle -export-autoMDFileName = MD Dosya Adını Otomatik Oluştur -export-exportDocx = Docx Dosyasını Dışa Aktar -export-exportPDF = PDF Dosyasını Dışa Aktar -export-exportFreeMind = FreeMind Dosyasını Dışa Aktar -export-exportNote = Yeni Zotero Not Ögesine Aktar -export-confirm = Dışa Aktar -export-cancel = Kapat -export-target = Hedef - syncManager-noteName = Not Adı syncManager-lastSync = Son Senkronizasyon syncManager-filePath = MarkDown Yolu diff --git a/addon/locale/tr-TR/export.ftl b/addon/locale/tr-TR/export.ftl new file mode 100644 index 0000000..d6098be --- /dev/null +++ b/addon/locale/tr-TR/export.ftl @@ -0,0 +1,25 @@ +title = Notları Dışa Aktar +options-linkMode = Bağlantılı Notlar Modu +options-MD = MarkDown(.md) +options-Docx = MS Word(.docx) +options-PDF = PDF(.pdf) +options-mm = Zihin Haritası +options-note = Zotero Notu +embedLink = Hepsi Tek Bir Dışarı Aktarma İçerisinde +standaloneLink = Her Biri Bağımsız Olarak Dışa Aktarıldı +keepLink = Zotero Linkleri Kalsın (zotero://note/) +exportMD = MD Dosya(lar)sını Dışa Aktar +setAutoSync = Oto-Senkronizasyonu Belirle + .title = Auto-Sync is available for "Each Converted to Standalone Exports" mode. +withYAMLHeader = YAML Başlığı İle +autoMDFileName = MD Dosya Adını Otomatik Oluştur +exportDocx = Docx Dosyasını Dışa Aktar +exportPDF = PDF Dosyasını Dışa Aktar +exportFreeMind = FreeMind Dosyasını Dışa Aktar +exportNote = Yeni Zotero Not Ögesine Aktar +confirm = Dışa Aktar +cancel = Kapat +target = Hedef: {$title}{ $left -> + [0]{ "" } + *[other] { " " }and {$left} more + } \ No newline at end of file diff --git a/addon/locale/zh-CN/addon.ftl b/addon/locale/zh-CN/addon.ftl index ff4cb15..21016ef 100644 --- a/addon/locale/zh-CN/addon.ftl +++ b/addon/locale/zh-CN/addon.ftl @@ -37,28 +37,6 @@ editor-previewImage-title = 预览图片 tab-name=笔记工作区 tab-openInWindow=拖放到此处以在新窗口打开 -export-title=导出笔记 -export-options-linkMode=链接笔记模式 -export-options-MD=MarkDown(.md) -export-options-Docx=MS Word(.docx) -export-options-PDF=PDF(.pdf) -export-options-mm=思维导图 -export-options-note=Zotero笔记 -export-embedLink=全部嵌入为一个导出 -export-standaloneLink=分别单独导出 -export-keepLink=保留Zotero链接(zotero://note/) -export-exportMD=导出MD文件 -export-setAutoSync=设置自动同步 -export-withYAMLHeader=带有YAML头 -export-autoMDFileName=自动生成MD文件名 -export-exportDocx=导出Word文件 -export-exportPDF=导出PDF文件 -export-exportFreeMind=导出FreeMind文件 -export-exportNote=导出为Zotero笔记条目 -export-confirm=导出 -export-cancel=关闭 -export-target=目标 - syncManager-noteName=笔记名称 syncManager-lastSync=最近同步 syncManager-filePath=MarkDown路径 diff --git a/addon/locale/zh-CN/export.ftl b/addon/locale/zh-CN/export.ftl new file mode 100644 index 0000000..4205890 --- /dev/null +++ b/addon/locale/zh-CN/export.ftl @@ -0,0 +1,25 @@ +title=导出笔记 +options-linkMode=链接笔记模式 +options-MD=MarkDown(.md) +options-Docx=MS Word(.docx) +options-PDF=PDF(.pdf) +options-mm=思维导图 +options-note=Zotero笔记 +embedLink=全部嵌入为一个导出 +standaloneLink=分别单独导出 +keepLink=保留Zotero链接(zotero://note/) +exportMD=导出MD文件 +setAutoSync=设置自动同步 + .title=自动同步仅能在"分别单独导出模式"使用 +withYAMLHeader=带有YAML头 +autoMDFileName=自动生成MD文件名 +exportDocx=导出Word文件 +exportPDF=导出PDF文件 +exportFreeMind=导出FreeMind文件 +exportNote=导出为Zotero笔记条目 +confirm=导出 +cancel=关闭 +target=目标: {$title}{ $left -> + [0]{ "" } + *[other] { " " }和其他{$left}个 + } \ No newline at end of file diff --git a/package.json b/package.json index 8fe8e1e..63930a1 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "unist-util-visit": "^5.0.0", "unist-util-visit-parents": "^6.0.1", "yamljs": "^0.3.0", - "zotero-plugin-toolkit": "^2.3.9" + "zotero-plugin-toolkit": "^2.3.12" }, "devDependencies": { "@esbuild-plugins/node-globals-polyfill": "^0.2.3", diff --git a/src/modules/export/exportWindow.ts b/src/modules/export/exportWindow.ts index 7d5a38f..e6da423 100644 --- a/src/modules/export/exportWindow.ts +++ b/src/modules/export/exportWindow.ts @@ -1,4 +1,4 @@ -import { getString } from "../../utils/locale"; +import { config } from "../../../package.json"; import { getPref, setPref } from "../../utils/prefs"; import { fill, slice } from "../../utils/str"; @@ -64,6 +64,8 @@ export async function showExportNoteOptions( updateSyncCheckbox(); }; + data.l10nFiles = `${config.addonRef}-export.ftl`; + const dialog = new ztoolkit.Dialog(18, 1) .setDialogData(data) .addCell(0, 0, { @@ -77,40 +79,40 @@ export async function showExportNoteOptions( children: [ { tag: "label", - properties: { - innerHTML: `${getString("export.target")}: ${fill( - slice(noteItems[0].getNoteTitle(), 40), - 40, - )}${ - noteItems.length > 1 ? ` and ${noteItems.length - 1} more` : "" - }`, + attributes: { + "data-l10n-id": `${config.addonRef}-target`, + "data-l10n-args": JSON.stringify({ + left: noteItems.length - 1, + title: fill(slice(noteItems[0].getNoteTitle(), 40), 40), + }), }, }, ], }) - .addCell(1, 0, makeHeadingLine(getString("export.options.linkMode"))) + .addCell(1, 0, makeHeadingLine("options-linkMode")) .addCell(2, 0, makeRadioLine("embedLink", "linkMode")) .addCell(3, 0, makeRadioLine("standaloneLink", "linkMode")) .addCell(4, 0, makeRadioLine("keepLink", "linkMode")) - .addCell(5, 0, makeHeadingLine(getString("export.options.MD"))) + .addCell(5, 0, makeHeadingLine("options-MD")) .addCell(6, 0, makeCheckboxLine("exportMD")) .addCell(7, 0, makeCheckboxLine("setAutoSync")) .addCell(8, 0, makeCheckboxLine("withYAMLHeader")) .addCell(9, 0, makeCheckboxLine("autoMDFileName")) - .addCell(10, 0, makeHeadingLine(getString("export.options.Docx"))) + .addCell(10, 0, makeHeadingLine("options-Docx")) .addCell(11, 0, makeCheckboxLine("exportDocx")) - .addCell(12, 0, makeHeadingLine(getString("export.options.PDF"))) + .addCell(12, 0, makeHeadingLine("options-PDF")) .addCell(13, 0, makeCheckboxLine("exportPDF")) - .addCell(14, 0, makeHeadingLine(getString("export.options.mm"))) + .addCell(14, 0, makeHeadingLine("options-mm")) .addCell(15, 0, makeCheckboxLine("exportFreeMind")) - .addCell(16, 0, makeHeadingLine(getString("export.options.note"))) + .addCell(16, 0, makeHeadingLine("options-note")) .addCell(17, 0, makeCheckboxLine("exportNote")) - .addButton(getString("export.confirm"), "confirm") - .addButton(getString("export.cancel"), "cancel") - .open(getString("export.title"), { + .addButton(`${config.addonRef}-confirm`, "confirm") + .addButton(`${config.addonRef}-cancel`, "cancel") + .open(`${config.addonRef}-title`, { resizable: true, centerscreen: true, - fitContent: true, + width: 350, + height: 600, noDialogMode: true, }); @@ -126,7 +128,7 @@ export async function showExportNoteOptions( } } -function makeHeadingLine(text: string) { +function makeHeadingLine(l10nID: string) { return { tag: "div", styles: { @@ -138,8 +140,8 @@ function makeHeadingLine(text: string) { children: [ { tag: "h3", - properties: { - innerHTML: text, + attributes: { + "data-l10n-id": `${config.addonRef}-${l10nID}`, }, }, ], @@ -160,9 +162,7 @@ function makeCheckboxLine(dataKey: string, callback?: (ev: Event) => void) { tag: "label", attributes: { for: dataKey, - }, - properties: { - innerHTML: getString(`export.${dataKey}`), + "data-l10n-id": `${config.addonRef}-${dataKey}`, }, }, { @@ -206,9 +206,7 @@ function makeRadioLine( tag: "label", attributes: { for: dataKey, - }, - properties: { - innerHTML: getString(`export.${dataKey}`), + "data-l10n-id": `${config.addonRef}-${dataKey}`, }, }, {