作者 xiaoqiu

添加多语言翻译

1 # API地址 1 # API地址
2 -NUXT_API_URL="http://htai.toolsai.cc"  
  2 +NUXT_API_URL="/dev-api"
@@ -13,6 +13,7 @@ const webSite = useState<webSiteType>("webSite"); @@ -13,6 +13,7 @@ const webSite = useState<webSiteType>("webSite");
13 const sortList = useState<classifyType[]>("sortTree"); 13 const sortList = useState<classifyType[]>("sortTree");
14 14
15 webSite.value = await getWebSite(); 15 webSite.value = await getWebSite();
  16 +console.log(webSite.value);
16 sortList.value = await getClassifyList(); 17 sortList.value = await getClassifyList();
17 useHead({ 18 useHead({
18 title: webSite.value.webname, 19 title: webSite.value.webname,
@@ -33,4 +34,8 @@ useHead({ @@ -33,4 +34,8 @@ useHead({
33 .scroll-container::-webkit-scrollbar { 34 .scroll-container::-webkit-scrollbar {
34 display: none; /* Chrome/Safari/Opera */ 35 display: none; /* Chrome/Safari/Opera */
35 } 36 }
  37 +
  38 +#translate {
  39 + display: none;
  40 +}
36 </style> 41 </style>
1 @font-face { 1 @font-face {
2 font-family: "iconfont"; /* Project id 5094593 */ 2 font-family: "iconfont"; /* Project id 5094593 */
3 - src: url('iconfont.woff2?t=1766651481158') format('woff2'),  
4 - url('iconfont.woff?t=1766651481158') format('woff'),  
5 - url('iconfont.ttf?t=1766651481158') format('truetype'); 3 + src: url('iconfont.woff2?t=1770621719751') format('woff2'),
  4 + url('iconfont.woff?t=1770621719751') format('woff'),
  5 + url('iconfont.ttf?t=1770621719751') format('truetype');
6 } 6 }
7 7
8 .iconfont { 8 .iconfont {
@@ -13,6 +13,30 @@ @@ -13,6 +13,30 @@
13 -moz-osx-font-smoothing: grayscale; 13 -moz-osx-font-smoothing: grayscale;
14 } 14 }
15 15
  16 +.icon-international:before {
  17 + content: "\e638";
  18 +}
  19 +
  20 +.icon-delete:before {
  21 + content: "\e668";
  22 +}
  23 +
  24 +.icon-home:before {
  25 + content: "\e7c6";
  26 +}
  27 +
  28 +.icon-left-btn:before {
  29 + content: "\e83d";
  30 +}
  31 +
  32 +.icon-nav-menu:before {
  33 + content: "\e636";
  34 +}
  35 +
  36 +.icon-nav-search:before {
  37 + content: "\e637";
  38 +}
  39 +
16 .icon-tag:before { 40 .icon-tag:before {
17 content: "\e6af"; 41 content: "\e6af";
18 } 42 }
@@ -249,10 +273,6 @@ @@ -249,10 +273,6 @@
249 content: "\e612"; 273 content: "\e612";
250 } 274 }
251 275
252 -.icon-international:before {  
253 - content: "\e613";  
254 -}  
255 -  
256 .icon-link:before { 276 .icon-link:before {
257 content: "\e614"; 277 content: "\e614";
258 } 278 }
@@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
13 13
14 <div class="flex items-center gap-2"> 14 <div class="flex items-center gap-2">
15 <MySearch /> 15 <MySearch />
  16 + <MyI18n />
16 <MyMenu /> 17 <MyMenu />
17 </div> 18 </div>
18 </div> 19 </div>
@@ -21,18 +21,9 @@ @@ -21,18 +21,9 @@
21 role="tablist" 21 role="tablist"
22 > 22 >
23 <li 23 <li
24 - class="anchor md:w-[120.891px] w-[107.3px] cursor-pointer rounded-[100px] bg-[#5961f9]"  
25 - style="  
26 - position: absolute;  
27 - height: 28px;  
28 - opacity: 1;  
29 - transition: 0.35s;  
30 - "  
31 - :style="{ left: `${left}px` }"  
32 - ></li>  
33 - <li  
34 v-for="(child, index) in childData.children" 24 v-for="(child, index) in childData.children"
35 - class="h-auto w-auto cursor-pointer" 25 + class="h-auto w-auto cursor-pointer rounded-[100px] transition-all duration-350"
  26 + :class="[index === currentFilter ? 'bg-[#5961f9]' : '']"
36 > 27 >
37 <a 28 <a
38 :id="`#term-${childData.id}-${child.id}`" 29 :id="`#term-${childData.id}-${child.id}`"
@@ -159,14 +150,11 @@ function onConfirm(id: number) { @@ -159,14 +150,11 @@ function onConfirm(id: number) {
159 } 150 }
160 // 导航样式内容 151 // 导航样式内容
161 const currentFilter = ref(0); 152 const currentFilter = ref(0);
162 -const left = ref(0);  
163 153
164 // 切换分类内容 154 // 切换分类内容
165 function onClick(event: any, alias: string, index: number) { 155 function onClick(event: any, alias: string, index: number) {
166 - let moveWidth = window.innerWidth > 768 ? 120.891 : 107.3;  
167 event?.preventDefault(); 156 event?.preventDefault();
168 childAlias.value = alias; 157 childAlias.value = alias;
169 currentFilter.value = index; 158 currentFilter.value = index;
170 - left.value = index * moveWidth;  
171 } 159 }
172 </script> 160 </script>
  1 +<template>
  2 + <div>
  3 + <el-dropdown trigger="click">
  4 + <span class="el-dropdown-link">
  5 + <i class="iconfont icon-international text-[#5961f9] language"></i>
  6 + </span>
  7 + <template #dropdown>
  8 + <el-dropdown-menu>
  9 + <el-dropdown-item>
  10 + <a
  11 + class="ignore"
  12 + href="javascript:translate.changeLanguage('english');"
  13 + >English</a
  14 + >
  15 + </el-dropdown-item>
  16 + <el-dropdown-item>
  17 + <a
  18 + class="ignore"
  19 + href="javascript:translate.changeLanguage('chinese_simplified');"
  20 + >简体中文</a
  21 + >
  22 + </el-dropdown-item>
  23 + <el-dropdown-item>
  24 + <a
  25 + class="ignore"
  26 + href="javascript:translate.changeLanguage('vietnamese');"
  27 + >Tiếng Việt</a
  28 + >
  29 + </el-dropdown-item>
  30 + <el-dropdown-item>
  31 + <a
  32 + class="ignore"
  33 + href="javascript:translate.changeLanguage('thai');"
  34 + >คนไทย</a
  35 + >
  36 + </el-dropdown-item>
  37 + <el-dropdown-item>
  38 + <a
  39 + class="ignore"
  40 + href="javascript:translate.changeLanguage('malay');"
  41 + >Malay</a
  42 + >
  43 + </el-dropdown-item>
  44 + <el-dropdown-item>
  45 + <a
  46 + class="ignore"
  47 + href="javascript:translate.changeLanguage('singapore');"
  48 + >සිංගාපුර්</a
  49 + >
  50 + </el-dropdown-item>
  51 + <el-dropdown-item>
  52 + <a class="ignore" href="javascript:translate.changeLanguage('lao');"
  53 + >ກະຣຸນາ</a
  54 + >
  55 + </el-dropdown-item>
  56 + <el-dropdown-item>
  57 + <a
  58 + class="ignore"
  59 + href="javascript:translate.changeLanguage('khmer');"
  60 + >ភាសា​ខ្មែរName</a
  61 + >
  62 + </el-dropdown-item>
  63 + <el-dropdown-item>
  64 + <a
  65 + class="ignore"
  66 + href="javascript:translate.changeLanguage('filipino');"
  67 + >Pilipino</a
  68 + >
  69 + </el-dropdown-item>
  70 + <el-dropdown-item>
  71 + <a
  72 + class="ignore"
  73 + href="javascript:translate.changeLanguage('burmese');"
  74 + >ဗာရမ်</a
  75 + >
  76 + </el-dropdown-item>
  77 + <el-dropdown-item>
  78 + <a
  79 + class="ignore"
  80 + href="javascript:translate.changeLanguage('indonesian');"
  81 + >IndonesiaName</a
  82 + >
  83 + </el-dropdown-item>
  84 + </el-dropdown-menu>
  85 + </template>
  86 + </el-dropdown>
  87 + </div>
  88 +</template>
  89 +
  90 +<script setup lang="ts"></script>
  91 +<style scoped>
  92 +.language {
  93 + font-size: 40px;
  94 +}
  95 +
  96 +@media (max-width: 768px) {
  97 + .language {
  98 + font-size: 35px;
  99 + }
  100 +}
  101 +</style>
@@ -43,14 +43,14 @@ onMounted(() => { @@ -43,14 +43,14 @@ onMounted(() => {
43 } 43 }
44 .toggle { 44 .toggle {
45 position: relative; 45 position: relative;
46 - width: 35px;  
47 - height: 35px; 46 + width: 30px;
  47 + height: 30px;
48 cursor: pointer; 48 cursor: pointer;
49 display: flex; 49 display: flex;
50 flex-direction: column; 50 flex-direction: column;
51 align-items: flex-start; 51 align-items: flex-start;
52 justify-content: center; 52 justify-content: center;
53 - gap: 10px; 53 + gap: 8px;
54 transition-duration: 0.5s; 54 transition-duration: 0.5s;
55 } 55 }
56 56
@@ -59,9 +59,8 @@ function onSearch() { @@ -59,9 +59,8 @@ function onSearch() {
59 59
60 .input { 60 .input {
61 border-style: none; 61 border-style: none;
62 - height: 50px;  
63 - width: 50px;  
64 - padding: 10px; 62 + height: 40px;
  63 + width: 40px;
65 outline: none; 64 outline: none;
66 border-radius: 50%; 65 border-radius: 50%;
67 transition: 0.5s ease-in-out; 66 transition: 0.5s ease-in-out;
@@ -89,8 +88,8 @@ function onSearch() { @@ -89,8 +88,8 @@ function onSearch() {
89 position: absolute; 88 position: absolute;
90 right: 0px; 89 right: 0px;
91 cursor: pointer; 90 cursor: pointer;
92 - width: 50px;  
93 - height: 50px; 91 + width: 40px;
  92 + height: 40px;
94 outline: none; 93 outline: none;
95 border-style: none; 94 border-style: none;
96 border-radius: 50%; 95 border-radius: 50%;
@@ -116,13 +115,13 @@ function onSearch() { @@ -116,13 +115,13 @@ function onSearch() {
116 gap: 10px; 115 gap: 10px;
117 } 116 }
118 .icon { 117 .icon {
119 - width: 40px;  
120 - height: 40px; 118 + width: 35px;
  119 + height: 35px;
121 } 120 }
122 .input { 121 .input {
123 - width: 40px;  
124 - height: 40px;  
125 - padding-right: 31px; 122 + width: 35px;
  123 + height: 35px;
  124 + padding-right: 35px;
126 } 125 }
127 .input::placeholder, 126 .input::placeholder,
128 .input { 127 .input {
@@ -133,7 +132,7 @@ function onSearch() { @@ -133,7 +132,7 @@ function onSearch() {
133 .icon:focus ~ .input, 132 .icon:focus ~ .input,
134 .input:focus { 133 .input:focus {
135 box-shadow: none; 134 box-shadow: none;
136 - width: 200px; 135 + width: 180px;
137 border-radius: 0px; 136 border-radius: 0px;
138 background-color: transparent; 137 background-color: transparent;
139 border-bottom: 1.5px solid #5961f9; 138 border-bottom: 1.5px solid #5961f9;
1 -module.exports = {  
2 - apps: [  
3 - {  
4 - name: 'linkNuxt3',  
5 - script: './.output/server/index.mjs',  
6 - port: 3666,  
7 - instances: 'max',  
8 - exec_mode: 'cluster',  
9 - autorestart: true,  
10 - args: 'start'  
11 - }  
12 - ]  
13 -}  
@@ -18,7 +18,7 @@ export default defineNuxtConfig({ @@ -18,7 +18,7 @@ export default defineNuxtConfig({
18 nitro: { 18 nitro: {
19 devProxy: { 19 devProxy: {
20 '/dev-api': { 20 '/dev-api': {
21 - target: 'http://192.168.2.220:35273/', 21 + target: 'http://192.168.2.72:35273/',
22 changeOrigin: true, 22 changeOrigin: true,
23 23
24 } 24 }
@@ -26,14 +26,14 @@ export default defineNuxtConfig({ @@ -26,14 +26,14 @@ export default defineNuxtConfig({
26 // 该配置用于服务端请求转发 26 // 该配置用于服务端请求转发
27 routeRules: { 27 routeRules: {
28 '/dev-api/**': { 28 '/dev-api/**': {
29 - proxy: 'http://192.168.2.220:35273/**' 29 + proxy: 'http://192.168.2.72:35273/**'
30 }, 30 },
31 }, 31 },
32 - // prerender: {  
33 - // routes: ['/sitemap.xml'],  
34 - // // 从预渲染中排除 sitemap.xml,让它动态生成  
35 - // ignore: ['/sitemap.xml']  
36 - // } 32 + prerender: {
  33 + routes: ['/sitemap.xml'],
  34 + // 从预渲染中排除 sitemap.xml,让它动态生成
  35 + ignore: ['/sitemap.xml']
  36 + }
37 }, 37 },
38 css: [ 38 css: [
39 '~/assets/iconfonts/iconfont.css', 39 '~/assets/iconfonts/iconfont.css',
@@ -56,6 +56,11 @@ export default defineNuxtConfig({ @@ -56,6 +56,11 @@ export default defineNuxtConfig({
56 ], 56 ],
57 link: [ 57 link: [
58 { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' } 58 { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
  59 + ],
  60 + script: [
  61 + {
  62 + src: "/js/translate.js",
  63 + },
59 ] 64 ]
60 } 65 }
61 }, 66 },
此 diff 太大无法显示。
@@ -68,13 +68,4 @@ Disallow: / @@ -68,13 +68,4 @@ Disallow: /
68 68
69 User-agent: * 69 User-agent: *
70 Disallow: /wp-admin/ 70 Disallow: /wp-admin/
71 -Disallow: /wp-log/  
72 -Disallow: /wp-includes/  
73 -Disallow: /bookmark/  
74 -Disallow: /go/  
75 -Disallow: /user  
76 -Disallow: /hotnews  
77 -Disallow: /?s=*  
78 -Disallow: /search/  
79 -Disallow: /search?q=  
80 -Sitemap: https://www.toolsai.cc/sitemap.xml  
  71 +Sitemap: https://www.aiboxgo.com/sitemap.xml
1 -<?xml version="1.0" encoding="UTF-8"?>  
2 -<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">  
3 - <url>  
4 - <loc>https://www.toolsai.cc</loc>  
5 - <changefreq>daily</changefreq>  
6 - <priority>1.0</priority>  
7 - </url>  
8 - <url>  
9 - <loc>https://www.toolsai.cc/category/ai-writing-tools</loc>  
10 - <changefreq>daily</changefreq>  
11 - <priority>0.8</priority>  
12 - </url>  
13 - <url>  
14 - <loc>https://www.toolsai.cc/category/ai-image-generators</loc>  
15 - <changefreq>daily</changefreq>  
16 - <priority>0.8</priority>  
17 - </url>  
18 - <url>  
19 - <loc>https://www.toolsai.cc/category/ai-image-background-removers</loc>  
20 - <changefreq>daily</changefreq>  
21 - <priority>0.8</priority>  
22 - </url>  
23 - <url>  
24 - <loc>https://www.toolsai.cc/category/ai-image-big</loc>  
25 - <changefreq>daily</changefreq>  
26 - <priority>0.8</priority>  
27 - </url>  
28 - <url>  
29 - <loc>https://www.toolsai.cc/category/ai-image-repair</loc>  
30 - <changefreq>daily</changefreq>  
31 - <priority>0.8</priority>  
32 - </url>  
33 - <url>  
34 - <loc>https://www.toolsai.cc/category/ai-video-tools</loc>  
35 - <changefreq>daily</changefreq>  
36 - <priority>0.8</priority>  
37 - </url>  
38 - <url>  
39 - <loc>https://www.toolsai.cc/category/ai-agent</loc>  
40 - <changefreq>daily</changefreq>  
41 - <priority>0.8</priority>  
42 - </url>  
43 - <url>  
44 - <loc>https://www.toolsai.cc/category/ai-chatbots</loc>  
45 - <changefreq>daily</changefreq>  
46 - <priority>0.8</priority>  
47 - </url>  
48 - <url>  
49 - <loc>https://www.toolsai.cc/category/ai-programming-tools</loc>  
50 - <changefreq>daily</changefreq>  
51 - <priority>0.8</priority>  
52 - </url>  
53 - <url>  
54 - <loc>https://www.toolsai.cc/category/ai-design-tools</loc>  
55 - <changefreq>daily</changefreq>  
56 - <priority>0.8</priority>  
57 - </url>  
58 - <url>  
59 - <loc>https://www.toolsai.cc/category/ai-audio-tools</loc>  
60 - <changefreq>daily</changefreq>  
61 - <priority>0.8</priority>  
62 - </url>  
63 - <url>  
64 - <loc>https://www.toolsai.cc/category/ai-search-engines</loc>  
65 - <changefreq>daily</changefreq>  
66 - <priority>0.8</priority>  
67 - </url>  
68 - <url>  
69 - <loc>https://www.toolsai.cc/category/ai-frameworks</loc>  
70 - <changefreq>daily</changefreq>  
71 - <priority>0.8</priority>  
72 - </url>  
73 - <url>  
74 - <loc>https://www.toolsai.cc/category/ai-study</loc>  
75 - <changefreq>daily</changefreq>  
76 - <priority>0.8</priority>  
77 - </url>  
78 - <url>  
79 - <loc>https://www.toolsai.cc/category/ai-models</loc>  
80 - <changefreq>daily</changefreq>  
81 - <priority>0.8</priority>  
82 - </url>  
83 - <url>  
84 - <loc>https://www.toolsai.cc/category/ai-model-evaluation</loc>  
85 - <changefreq>daily</changefreq>  
86 - <priority>0.8</priority>  
87 - </url>  
88 - <url>  
89 - <loc>https://www.toolsai.cc/category/ai-content</loc>  
90 - <changefreq>daily</changefreq>  
91 - <priority>0.8</priority>  
92 - </url>  
93 - <url>  
94 - <loc>https://www.toolsai.cc/category/ai-directive</loc>  
95 - <changefreq>daily</changefreq>  
96 - <priority>0.8</priority>  
97 - </url>  
98 - <url>  
99 - <loc>https://www.toolsai.cc/details/16</loc>  
100 - <changefreq>daily</changefreq>  
101 - <priority>0.7</priority>  
102 - </url>  
103 - <url>  
104 - <loc>https://www.toolsai.cc/details/24</loc>  
105 - <changefreq>daily</changefreq>  
106 - <priority>0.7</priority>  
107 - </url>  
108 - <url>  
109 - <loc>https://www.toolsai.cc/details/23</loc>  
110 - <changefreq>daily</changefreq>  
111 - <priority>0.7</priority>  
112 - </url>  
113 - <url>  
114 - <loc>https://www.toolsai.cc/details/22</loc>  
115 - <changefreq>daily</changefreq>  
116 - <priority>0.7</priority>  
117 - </url>  
118 - <url>  
119 - <loc>https://www.toolsai.cc/details/21</loc>  
120 - <changefreq>daily</changefreq>  
121 - <priority>0.7</priority>  
122 - </url>  
123 - <url>  
124 - <loc>https://www.toolsai.cc/details/20</loc>  
125 - <changefreq>daily</changefreq>  
126 - <priority>0.7</priority>  
127 - </url>  
128 - <url>  
129 - <loc>https://www.toolsai.cc/details/19</loc>  
130 - <changefreq>daily</changefreq>  
131 - <priority>0.7</priority>  
132 - </url>  
133 - <url>  
134 - <loc>https://www.toolsai.cc/details/18</loc>  
135 - <changefreq>daily</changefreq>  
136 - <priority>0.7</priority>  
137 - </url>  
138 - <url>  
139 - <loc>https://www.toolsai.cc/details/17</loc>  
140 - <changefreq>daily</changefreq>  
141 - <priority>0.7</priority>  
142 - </url>  
143 - <url>  
144 - <loc>https://www.toolsai.cc/details/8</loc>  
145 - <changefreq>daily</changefreq>  
146 - <priority>0.7</priority>  
147 - </url>  
148 - <url>  
149 - <loc>https://www.toolsai.cc/details/15</loc>  
150 - <changefreq>daily</changefreq>  
151 - <priority>0.7</priority>  
152 - </url>  
153 - <url>  
154 - <loc>https://www.toolsai.cc/details/14</loc>  
155 - <changefreq>daily</changefreq>  
156 - <priority>0.7</priority>  
157 - </url>  
158 - <url>  
159 - <loc>https://www.toolsai.cc/details/13</loc>  
160 - <changefreq>daily</changefreq>  
161 - <priority>0.7</priority>  
162 - </url>  
163 - <url>  
164 - <loc>https://www.toolsai.cc/details/12</loc>  
165 - <changefreq>daily</changefreq>  
166 - <priority>0.7</priority>  
167 - </url>  
168 - <url>  
169 - <loc>https://www.toolsai.cc/details/11</loc>  
170 - <changefreq>daily</changefreq>  
171 - <priority>0.7</priority>  
172 - </url>  
173 - <url>  
174 - <loc>https://www.toolsai.cc/details/10</loc>  
175 - <changefreq>daily</changefreq>  
176 - <priority>0.7</priority>  
177 - </url>  
178 - <url>  
179 - <loc>https://www.toolsai.cc/details/9</loc>  
180 - <changefreq>daily</changefreq>  
181 - <priority>0.7</priority>  
182 - </url>  
183 -</urlset>  
  1 +export default defineEventHandler(async (event) => {
  2 +
  3 + const res = await $fetch('http://htai.toolsai.cc/sitemap.xml', {
  4 + method: 'get'
  5 + })
  6 +
  7 + console.log("后台数据", res)
  8 + event.node.res.setHeader('content-type', 'text/xml')
  9 + return res
  10 +})