feat: Added Baidu Translate

This commit is contained in:
2025-12-05 14:27:02 +08:00
parent 05a43d8d14
commit ffd9b0690d

View File

@@ -5,6 +5,7 @@
let text = $state("");
let urlMaps = $state({
sougou: `https://fanyi.sogou.com`,
baidu: `https://fanyi.baidu.com`,
youdao: `https://fanyi.youdao.com`,
});
@@ -25,7 +26,8 @@
});
$effect(() => {
urlMaps.sougou = `https://fanyi.sogou.com/text?keyword=${text}%0A&transfrom=auto&transto=zh-CHS&model=general`;
urlMaps.sougou = `https://fanyi.sogou.com/text?keyword=${encodeURIComponent(text)}&transfrom=auto&transto=zh-CHS&model=general`;
urlMaps.baidu = `https://fanyi.baidu.com/mtpe-individual/transText?query=${encodeURIComponent(text)}&lang=auto2zh`;
// 有道翻译不支持通过URL参数自动填入文本因此只能打开翻译页面
urlMaps.youdao = `https://fanyi.youdao.com/#/TextTranslate`;
});
@@ -55,6 +57,42 @@
></iframe>
</div>
<label class="tab">
<input type="radio" name="my_tabs_4" />
<svg
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
width="20"
height="20"
><path
d="M215.94 283.22c4.06 0.04 8.04 1.08 11.4 3.44 11.6 7.52 22.14 16.56 33.4 24.56 31.58 23.76 66.4 42.78 101.82 60.12 34.2 16.78 68.74 33.68 99.02 57.04 20.1 16.32 37.9 39 39.42 65.78 0.14 137.06-0.16 274.12 0.16 411.18-4.9 2.6-11.02 3.8-14.72-1.4 0.4-126.64-0.02-253.3 0.22-379.94-0.02-12.24 1.16-25.06-3.68-36.64-5.96-14.9-17.42-26.66-29.12-37.26-19.9-17.68-44.78-27.98-68.24-39.9-36.68-16.9-74.98-29.94-111.9-46.22-19.5-8.94-38.24-19.44-57.78-28.26-2.68-3.92-1.04-9.22-1.5-13.72 0.62-12.92-1.34-26.04 1.5-38.78z"
fill="#AC0000"
></path><path
d="M722.74 486.54c23.6-12.86 45.4-28.86 69-41.74-0.14 11.58 2.26 23.28 0.78 34.76-38.14 24.32-76.8 47.84-115.12 71.9-19.02 11.58-37.62 23.88-56.9 35.02 0.12-11.42-1.72-22.8-1.22-34.22 21.92-15.5 45.72-28.38 68.06-43.3 3.86-7.04-3.96-18.46 5.2-22.5 9.78-5.86 19.24-12.26 29.28-17.68 0.34 5.92 0.6 11.84 0.92 17.76zM299.52 460.06c13.38 6.42 28.12 13.42 35.4 27.14 5.74 10.76 8.24 22.86 10.8 34.68 16.5 83.46 33.16 166.88 49.66 250.36-8.62-4.64-17.42-9.08-25.4-14.74-5.82-22.7-9.64-45.96-14.62-68.9-29.64-17.24-59.34-34.4-89.26-51.16-5.84 16.78-11.74 33.54-17.34 50.4-8.88-4.18-17.06-9.64-25.7-14.24 25.1-71.3 51.38-142.22 76.46-213.54m-21.92 145.52c23.16 13 45.9 26.76 69.24 39.4-7.82-41.32-16.34-82.48-24.32-123.76-1.16-6.24-2.82-12.9-8.1-16.98-12.44 33.72-24.74 67.5-36.82 101.34zM753.78 509.76c10.54-6.44 20.76-13.48 31.74-19.16-15.84 41.48-33.68 82.18-50.26 123.38 13.96 11.74 28.82 22.34 42.76 34.08 9.64-4.52 17.88-11.38 27.2-16.5 0.08 10.68 1.14 21.34 1.2 32.04-12.96 7.9-25.76 16.08-38.68 24.04-3.84 1.92-8.86 5.14-12.96 2.18-13.64-9.7-26.36-20.62-40.16-30.06-9.8 21.86-19.7 43.68-29.14 65.7-4.62 9.9-9.44 20.86-19.28 26.6-11.24 6.56-22.02 13.84-33.32 20.28 0.34-10.66-1.3-21.28-1-31.94 8.06-8.84 22.84-10.88 27.74-22.92 11.14-24.46 21.84-49.12 33.12-73.52-19.18-16.7-39.16-32.54-58.96-48.54 10.32-7 21.12-13.26 31.58-20.02 2.7-1.42 5.2-3.74 8.36-3.94 13.58 8.2 25.42 19.22 39.38 26.76 9.7-24.92 20.92-49.22 31.08-73.94 2.36-5.3 3.96-11.7 9.6-14.52z"
fill="#F5F5F6"
></path><path
d="M441.88 129.86c16.06-9.4 33.64-16.96 52.32-18.84 24.18-2.58 48.32 4.2 69.7 15.14 37.46 19.48 75.06 38.72 112.4 58.4 10.34-7.08 19.2-16.2 29.84-22.84 4.38 0 5 4.82 4.84 8.2-0.12 21.36 0.16 42.74-0.18 64.1 0.44 4.88-4.6 7.76-8.92 7.3-29.26 0.1-58.52-0.1-87.78-0.02-3.98 0.58-7.24-1.84-9.28-5.04 9.4-7.36 19.34-14.02 29.22-20.72-31.14-16.88-62.74-32.96-94.06-49.52-14.82-7.12-32.3-12.64-48.48-6.82-17.4 6.08-32.44 17.22-49.18 24.78-7.14 2.5-14.86 2.38-22.34 2.52-13.34-0.08-26.66-0.04-40 0.06-5.86 0.2-11.66-0.8-17.26-2.5 0.34-6.8 6.72-10.24 11.6-13.8 21.84-14.56 44.76-27.4 67.56-40.4zM151.1 305.16c4.04-1.58 8.38 0.12 12.12 1.74 18.12 8.58 34.38 20.68 52.72 28.82 19.54 8.82 38.28 19.32 57.78 28.26 36.92 16.28 75.22 29.32 111.9 46.22 23.46 11.92 48.34 22.22 68.24 39.9 11.7 10.6 23.16 22.36 29.12 37.26 4.84 11.58 3.66 24.4 3.68 36.64-0.24 126.64 0.18 253.3-0.22 379.94-0.6 3.94 1.56 9.82-3.3 11.64-6.26 3.14-12.12-2.34-16.6-6.1-40.84-34.8-89.58-58.5-138.64-79.3-37.6-16.12-75.76-31.58-110.36-53.66-25.86-16.22-49.5-38.14-61.6-66.68-4-9.5-6.86-19.6-7.4-29.92 0.04-121.3 0-242.62 0-363.94 0.24-3.66-0.16-7.92 2.56-10.82m148.42 154.9c-25.08 71.32-51.36 142.24-76.46 213.54 8.64 4.6 16.82 10.06 25.7 14.24 5.6-16.86 11.5-33.62 17.34-50.4 29.92 16.76 59.62 33.92 89.26 51.16 4.98 22.94 8.8 46.2 14.62 68.9 7.98 5.66 16.78 10.1 25.4 14.74-16.5-83.48-33.16-166.9-49.66-250.36-2.56-11.82-5.06-23.92-10.8-34.68-7.28-13.72-22.02-20.72-35.4-27.14z"
fill="#E21308"
></path><path
d="M277.6 605.58c12.08-33.84 24.38-67.62 36.82-101.34 5.28 4.08 6.94 10.74 8.1 16.98 7.98 41.28 16.5 82.44 24.32 123.76-23.34-12.64-46.08-26.4-69.24-39.4z"
fill="#E21308"
></path><path
d="M331.92 220c-0.38-5.4 5.48-7.9 10.06-7.4 29.3 0.14 58.6-0.12 87.88 0.18 3.56-0.38 5.82 2.64 8.3 4.62-9.02 8.12-20.12 13.54-29.06 21.76 32.06 16.4 63.8 33.42 95.78 49.94 13.76 6.1 29.54 11.28 44.48 6.36 16.14-5.28 30.28-15.04 45.32-22.7 12.5-7.22 27.54-4.62 41.32-4.92 14.66 0.84 29.94-2.64 44.1 2.46-0.74 6.72-7.24 10.12-12.12 13.72-23.94 15.82-48.92 30-73.98 43.98-19.9 11.04-42.8 17.6-65.68 15.2-17.56-1.6-34.42-7.66-50.04-15.6-37.42-19.34-74.74-38.82-112.18-58.1-8.08 6.12-15.8 12.7-23.74 19-2.72 1.82-5.88 5.38-9.22 2.62-2.04-4.02-1.24-8.72-1.46-13.06 0.34-19.36-0.26-38.72 0.24-58.06zM866.26 306.24c3.82-1.58 9.72-3.4 12.02 1.42 1.74 5.22 0.9 10.9 1.1 16.32-0.1 118.02 0.12 236.04 0.1 354.06-2.38 33.3-23.36 62.32-48.58 82.84-29.34 23.28-63.58 39.3-97.64 54.38-51.46 22.2-104.24 43.04-149.94 76.14-10.18 7.02-19.5 15.18-29.2 22.8-3.18 3-7.6 2-11.4 1.2-0.7-3.78-0.92-7.62-1.08-11.44-0.8-35.98-0.12-71.98-0.34-107.96-0.04-91.34 0.04-182.66-0.06-274 0.12-12.76-1.68-26.38 4.26-38.22 4.92-9.94 11.78-18.86 19.58-26.72 16.14-16.24 36.92-26.54 56.72-37.54 30.68-14.98 62.38-27.72 94.32-39.72 32.94-12.68 64.42-28.64 96.06-44.18 18.48-8.94 35.32-21 54.08-29.38m-143.52 180.3c-0.32-5.92-0.58-11.84-0.92-17.76-10.04 5.42-19.5 11.82-29.28 17.68-9.16 4.04-1.34 15.46-5.2 22.5-22.34 14.92-46.14 27.8-68.06 43.3-0.5 11.42 1.34 22.8 1.22 34.22 19.28-11.14 37.88-23.44 56.9-35.02 38.32-24.06 76.98-47.58 115.12-71.9 1.48-11.48-0.92-23.18-0.78-34.76-23.6 12.88-45.4 28.88-69 41.74m31.04 23.22c-5.64 2.82-7.24 9.22-9.6 14.52-10.16 24.72-21.38 49.02-31.08 73.94-13.96-7.54-25.8-18.56-39.38-26.76-3.16 0.2-5.66 2.52-8.36 3.94-10.46 6.76-21.26 13.02-31.58 20.02 19.8 16 39.78 31.84 58.96 48.54-11.28 24.4-21.98 49.06-33.12 73.52-4.9 12.04-19.68 14.08-27.74 22.92-0.3 10.66 1.34 21.28 1 31.94 11.3-6.44 22.08-13.72 33.32-20.28 9.84-5.74 14.66-16.7 19.28-26.6 9.44-22.02 19.34-43.84 29.14-65.7 13.8 9.44 26.52 20.36 40.16 30.06 4.1 2.96 9.12-0.26 12.96-2.18 12.92-7.96 25.72-16.14 38.68-24.04-0.06-10.7-1.12-21.36-1.2-32.04-9.32 5.12-17.56 11.98-27.2 16.5-13.94-11.74-28.8-22.34-42.76-34.08 16.58-41.2 34.42-81.9 50.26-123.38-10.98 5.68-21.2 12.72-31.74 19.16z"
fill="#1F71CD"
></path><path
d="M791.1 293.12c6.24-4.28 12.48-10.32 20.62-9.64 2.48 9.32 1.28 19 1.5 28.52-0.2 7.88 0.82 15.88-1.04 23.62-31.64 15.54-63.12 31.5-96.06 44.18-31.94 12-63.64 24.74-94.32 39.72-19.8 11-40.58 21.3-56.72 37.54-7.8 7.86-14.66 16.78-19.58 26.72-5.94 11.84-4.14 25.46-4.26 38.22 0.1 91.34 0.02 182.66 0.06 274 0.22 35.98-0.46 71.98 0.34 107.96-3.94 4.9-10 4.22-15.02 1.48 0.1-133.16 0.2-266.32 0.06-399.46-0.64-24.12 10.34-47.34 26.34-64.92 12.48-13.98 28.48-24.04 44.28-33.82 37.9-23.2 79.36-39.74 117.72-62.1 26.9-15 51.74-33.26 76.08-52.02z"
fill="#0054B8"
></path></svg
>
<span class="ml-2"> 百度翻译 </span>
</label>
<div class="tab-content bg-base-100 border-base-300">
<iframe title="百度翻译" class="w-full h-full" src={urlMaps["baidu"]}
></iframe>
</div>
<label class="tab">
<input type="radio" name="my_tabs_4" />
<svg