From 4b97c383d61dbf76c31d16a41cc3422686194408 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Wed, 10 Jan 2024 15:17:02 -0300 Subject: [PATCH] Translate How I made https://superuser.com/questions/983441/visual-studio-search-through-code-for-chinese-text#983455 And used the plugin: https://marketplace.visualstudio.com/items?itemName=funkyremi.vscode-google-translate Signed-off-by: Vitor Mattos --- examples/App.vue | 4 +-- examples/main.js | 4 +-- packages/index.js | 17 ++++++----- packages/vue-pdf-editor/index.js | 6 ++-- packages/vue-pdf-editor/src/DrawingCanvas.vue | 4 +-- packages/vue-pdf-editor/src/PDFPage.vue | 2 +- packages/vue-pdf-editor/src/TextItem.vue | 8 ++--- packages/vue-pdf-editor/src/VuePdfEditor.vue | 30 +++++++++---------- packages/vue-pdf-editor/utils/PDF.js | 2 +- .../vue-pdf-editor/utils/prepareAssets.js | 12 ++++---- 10 files changed, 45 insertions(+), 44 deletions(-) diff --git a/examples/App.vue b/examples/App.vue index 96e28a8..c69a6bb 100644 --- a/examples/App.vue +++ b/examples/App.vue @@ -35,9 +35,9 @@ export default { name: 'App', data(){ return { - initFileName: '测试.pdf', + initFileName: 'test.pdf', initFile :'', - textFields: ['初始文本'], + textFields: ['initial text'], imageUrls: [], } }, diff --git a/examples/main.js b/examples/main.js index bb20331..dab09b8 100644 --- a/examples/main.js +++ b/examples/main.js @@ -1,9 +1,9 @@ import Vue from 'vue' import App from './App.vue' -// 导入组件库 +// Import component library import VuePdfEditor from './../packages/index' -// 注册组件库 +// Registered component library Vue.use(VuePdfEditor) Vue.config.productionTip = false diff --git a/packages/index.js b/packages/index.js index 405b62b..3efdac6 100644 --- a/packages/index.js +++ b/packages/index.js @@ -1,27 +1,28 @@ -// 导入颜色选择器组件 +// Import color picker component import VuePdfEditor from './vue-pdf-editor' -// 存储组件列表 +// Store component list const components = [ VuePdfEditor ] -// 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册 +// Define the install method, receiving Vue as a parameter. If you use use +// to register a plugin, all components will be registered const install = function (Vue) { - // 判断是否安装 + // Determine whether to install if (install.installed) return - // 遍历注册全局组件 + // Traverse registered global components components.map(component => Vue.component(component.name, component)) } -// 判断是否是直接引入文件 +// Determine whether the file is imported directly if (typeof window !== 'undefined' && window.Vue) { install(window.Vue) } export default { - // 导出的对象必须具有 install,才能被 Vue.use() 方法安装 + // Exported objects must have install before they can be installed by the Vue.use() method install, - // 以下是具体的组件列表 + // The following is a specific list of components VuePdfEditor } diff --git a/packages/vue-pdf-editor/index.js b/packages/vue-pdf-editor/index.js index d87e6c4..631b14d 100644 --- a/packages/vue-pdf-editor/index.js +++ b/packages/vue-pdf-editor/index.js @@ -1,12 +1,12 @@ -// 导入组件,组件必须声明 name +// To import components, components must declare name import VuePdfEditor from './src/VuePdfEditor.vue' import './style/main.css' -// 为组件提供 install 安装方法,供按需引入 +// Provide an INSTALL installation method for the component to introduce it on demand VuePdfEditor.install = function (Vue) { Vue.component(VuePdfEditor.name, VuePdfEditor) } -// 默认导出组件 +// Default export component export default VuePdfEditor diff --git a/packages/vue-pdf-editor/src/DrawingCanvas.vue b/packages/vue-pdf-editor/src/DrawingCanvas.vue index dfe7dcb..a66f04e 100644 --- a/packages/vue-pdf-editor/src/DrawingCanvas.vue +++ b/packages/vue-pdf-editor/src/DrawingCanvas.vue @@ -32,7 +32,7 @@ " @click="onClose" > - 取消 + Cancel diff --git a/packages/vue-pdf-editor/src/PDFPage.vue b/packages/vue-pdf-editor/src/PDFPage.vue index dcebd64..577f024 100644 --- a/packages/vue-pdf-editor/src/PDFPage.vue +++ b/packages/vue-pdf-editor/src/PDFPage.vue @@ -28,7 +28,7 @@ export default { }, watch: { scale(newScale) { - this.dynamicScale = newScale; // 监听scale属性的变化,并更新动态缩放 + this.dynamicScale = newScale; // Monitor changes in the scale attribute and update dynamic scaling this.render(); }, }, diff --git a/packages/vue-pdf-editor/src/TextItem.vue b/packages/vue-pdf-editor/src/TextItem.vue index a946edd..ec07a39 100644 --- a/packages/vue-pdf-editor/src/TextItem.vue +++ b/packages/vue-pdf-editor/src/TextItem.vue @@ -22,7 +22,7 @@ @tapout="onBlurTool" >
- Line height + Line height
- Font size + Font size
- Font family + Font family
@@ -65,7 +65,7 @@ class="w-20 bg-blue-500 hover:bg-blue-700 text-white font-bold py-1 px-3 md:px-4 mr-3 md:mr-4 rounded" :class="[(pages.length === 0 || saving || !pdfFile) ?'cursor-not-allowed bg-blue-700':'']"> - {{ saving ? '保存中' : '保存' }} + {{ saving ? 'saving' : 'keep' }}
@@ -82,8 +82,8 @@
a pen, edit pdf name - @@ -91,7 +91,7 @@
- +
- +
@@ -315,7 +315,7 @@ export default { pages: [], pagesScale: [], allObjects: [], - currentFont: "宋体", + currentFont: "Song style", focusId: null, selectedPageIndex: -1, saving: false, @@ -408,7 +408,7 @@ export default { this.selectedPageIndex = i; let y = 0; if (this.initImageUrls !== null && this.initImageUrls.length !== 0) { - // 需要初始化图片 + // Need to initialize pictures for (let j = 0; j < this.initImageUrls.length; j++) { if (this.initTextFields.length === 0) { y = j * 100 @@ -419,7 +419,7 @@ export default { } } if (this.sealImageShow) { - // 展示印章示例 + // Example of display seal const res = await fetch(this.sealImageUrl); await this.addImage(await res.blob(), 0, (y+1)*100 ,0.4,true); } @@ -554,7 +554,7 @@ export default { } }, - addTextField(text = "请在此输入", x = 0, y = 0, currentPage = this.selectedPageIndex) { + addTextField(text = "Please enter here", x = 0, y = 0, currentPage = this.selectedPageIndex) { const id = this.genID(); fetchFont(this.currentFont); const object = { diff --git a/packages/vue-pdf-editor/utils/PDF.js b/packages/vue-pdf-editor/utils/PDF.js index f899b4f..814eda1 100644 --- a/packages/vue-pdf-editor/utils/PDF.js +++ b/packages/vue-pdf-editor/utils/PDF.js @@ -96,7 +96,7 @@ export async function save(pdfFile, objects, name, isUpload=false,callback) { try { const pdfBytes = await pdfDoc.save(); if (isUpload) { - // 上传 + // Upload callback(pdfBytes); return } diff --git a/packages/vue-pdf-editor/utils/prepareAssets.js b/packages/vue-pdf-editor/utils/prepareAssets.js index 89b12f8..c9c5120 100644 --- a/packages/vue-pdf-editor/utils/prepareAssets.js +++ b/packages/vue-pdf-editor/utils/prepareAssets.js @@ -55,37 +55,37 @@ const fonts = { // Available fonts export const Fonts = { ...fonts, - '宋体': { + 'Song style': { correction(size, lineHeight) { return (size * lineHeight - size) / 2 + size / 7; }, src: 'vue-pdf-editor/fonts/SongTi.ttf', }, - '微软雅黑': { + 'Microsoft Yahei': { correction(size, lineHeight) { return (size * lineHeight - size) / 2 + size / 7; }, src: 'vue-pdf-editor/fonts/WeiRuanYaHei.ttf', }, - '方正小标宋简': { + 'Fang Zheng Xiaoziao Song Jian': { correction(size, lineHeight) { return (size * lineHeight - size) / 2 + size / 7; }, src: 'vue-pdf-editor/fonts/FangZhengXiaoBiaoSongJian.ttf', }, - '楷体': { + 'Regular': { correction(size, lineHeight) { return (size * lineHeight - size) / 2 + size / 7; }, src: 'vue-pdf-editor/fonts/KaiTi.ttf', }, - '等线': { + 'Equal line': { correction(size, lineHeight) { return (size * lineHeight - size) / 2 + size / 7; }, src: 'vue-pdf-editor/fonts/DengXian.ttf', }, - '黑体': { + 'Black body': { correction(size, lineHeight) { return (size * lineHeight - size) / 2 + size / 7; },