Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
yArna committed Apr 13, 2023
2 parents a1a3739 + 09418c3 commit 4f45cca
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
15 changes: 10 additions & 5 deletions server/translate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ export async function translate(input: {
}): Promise<string | undefined> {
if (input.text == "") return ""
let re
if (input?.server === "google") {
// todo
} else if (input?.server === "tencent") {
re = await tencentTranslate({ text: input.text, from: input?.from, to: input?.to })
console.log("[translate]", input.text.length + "words.", { input, re })

try {
if (input?.server === "google") {
// todo
} else if (input?.server === "tencent") {
re = await tencentTranslate({ text: input.text, from: input?.from, to: input?.to })
console.log("[translate]", input.text.length + "words.", { input, re })
}
} catch (e) {
console.log('[translate] translate failed.', input, e)
}
return re
}
10 changes: 7 additions & 3 deletions src/Compoents/PromptDict/PromptDict.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@
</div>

<div class="active-dir" v-if="activeDir">
<div class="sub-dir" v-for="subDir in activeSubDirs">
<div class="name" v-if="subDir.name != activeDir.name">{{ subDir.name }}</div>
<details class="sub-dir" v-for="subDir in activeSubDirs" open :key="subDir.name">
<summary class="name" v-show="subDir.name != activeDir.name">{{ subDir.name }}</summary>
<div class="list">
<div class="item" v-for="word in subDir.words">
<PromptItem :item="word" @click="doApplyWord(word)" class="dict-word" />
</div>
</div>
</div>
</details>
</div>
</div>
</template>
Expand Down Expand Up @@ -106,6 +106,10 @@
font-weight: bold;
color: #7e7e7e;
text-shadow: 0 1px rgba(255, 255, 255, 0.4901960784);

&::marker {
color: rgba(126, 126, 126, 0.5);
}
}
.list {
display: flex;
Expand Down

0 comments on commit 4f45cca

Please sign in to comment.