Files
cool-admin-java-docs/.vitepress/dist/assets/src_guide_i18n.md.D4ikqxxm.js
T
2025-04-13 10:47:33 +08:00

5 lines
4.9 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{_ as i,a as l,o as a,aj as e}from"./chunks/framework.BjhQB2K5.js";const _=JSON.parse('{"title":"国际化多语言(v8.0新增)","description":"","frontmatter":{},"headers":[],"relativePath":"src/guide/i18n.md","filePath":"src/guide/i18n.md","lastUpdated":1744512308000}'),s={name:"src/guide/i18n.md"},t=e(`<h1 id="国际化多语言-v8-0新增" tabindex="-1">国际化多语言(v8.0新增) <a class="header-anchor" href="#国际化多语言-v8-0新增" aria-label="Permalink to &quot;国际化多语言(v8.0新增)&quot;">​</a></h1><p>i18n(Internationalization 的缩写,首末字符 i 和 n 之间有 18 个字母)是软件国际化的标准缩写。它是指让软件支持多种语言和地区的功能,使得同一个软件可以面向不同语言地区的用户,显示相应的语言界面。</p><p>随着互联网的发展,越来越多的企业开始走向国际化,多语言的支持已经成为了一个必备的功能。Cool Admin 也对此做了支持。</p><h1 id="实现" tabindex="-1">实现 <a class="header-anchor" href="#实现" aria-label="Permalink to &quot;实现&quot;">​</a></h1><p>多语言是需要前后端共同支持的,前端请前往<a href="https://vue.cool-admin.com/src/guide/plugins/i18n.html" target="_blank" rel="noreferrer">前端文档查看</a></p><p>与其它实现方案不同的是,Cool Admin前后端的多语言都是基于大模型翻译的(比传统机翻更加准确),无需手动配置,只要开启就能自动翻译,而且不需要改变任何原有代码。</p><p>以前该怎么写还是怎么写!!!</p><h1 id="使用" tabindex="-1">使用 <a class="header-anchor" href="#使用" aria-label="Permalink to &quot;使用&quot;">​</a></h1><p>1、引入插件 在官网下载并安装<a href="https://cool-js.com/plugin/create?id=177" target="_blank" rel="noreferrer">国际化多语言插件</a></p><p>安装后,框架就会自动扫描并翻译成对应的语言。</p><p>当你在控制台看到这样的输出,则代表成功</p><div class="language-console vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">console</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">// 翻译中</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">/ i18n translate...</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">// 翻译成功</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">✅国际化 翻译 成功!!!</span></span></code></pre></div><p>2、实现原理 只要开启并配置了国际化,在开发环境下重启,框架就会自动扫描菜单、字典、异常消息(CoolPreconditions.check...),并调用大模型对其进行翻译</p><p>翻译完成之后会默认在路径assets/i18n下生成对应种类的语言文件,如果这个文件存在</p><p>则该种类的国际化将不会进行翻译,也就是后续你有新增相关的内容,要让其再次翻译,得对应地删除相应的文件。</p><p>3、语言配置对照表</p><ul><li>简体中文(zh-cn)</li><li>美国英语(en)</li><li>阿塞拜疆语(az)</li><li>德语(de)</li><li>葡萄牙语(pt)</li><li>西班牙语(es)</li><li>丹麦语(da)</li><li>法语(fr)</li><li>挪威语(nb-NO)</li><li>繁体中文(zh-tw)</li><li>意大利语(it)</li><li>韩语(ko)</li><li>日语(ja)</li><li>荷兰语(nl)</li><li>越南语(vi)</li><li>俄语(ru)</li><li>土耳其语(tr)</li><li>巴西葡萄牙语(pt-br)</li><li>波斯语(fa)</li><li>泰语(th)</li><li>印度尼西亚语(id)</li><li>保加利亚语(bg)</li><li>普什图语(pa)</li><li>波兰语(pl)</li><li>芬兰语(fi)</li><li>瑞典语(sv)</li><li>希腊语(el)</li><li>斯洛伐克语(sk)</li><li>加泰罗尼亚语(ca)</li><li>捷克语(cs)</li><li>乌克兰语(uk)</li><li>土库曼语(tk)</li><li>泰米尔语(ta)</li><li>拉脱维亚语(lv)</li><li>南非荷兰语(af)</li><li>爱沙尼亚语(et)</li><li>斯洛文尼亚语(sl)</li><li>阿拉伯语(ar)</li><li>希伯来语(he)</li><li>立陶宛语(lt)</li><li>蒙古语(mn)</li><li>哈萨克语(kk)</li><li>匈牙利语(hu)</li><li>罗马尼亚语(ro)</li><li>库尔德语(ku)</li><li>库尔德语 (ckb)</li><li>维吾尔语 (ug-cn)</li><li>高棉语 (km)</li><li>塞尔维亚语 (sr)</li><li>巴斯克语 (eu)</li><li>吉尔吉斯语 (ky)</li><li>亚美尼亚语 (hy-am)</li><li>克罗地亚语(hr)</li><li>世界语 (eo)</li><li>孟加拉语 (bn)</li><li>马来语 (ms)</li></ul>`,17),n=[t];function r(p,o,c,h,d,k){return a(),l("div",null,n)}const m=i(s,[["render",r]]);export{_ as __pageData,m as default};