Closed zuohuaiyu closed 1 year ago
本地没复现出来。
本地执行下it -V
看下工具是不是3.0.4
版本
如果你用了定制化配置,需要把配置发一下,我看看是不是受配置影响
如果你用了定制化配置,需要把配置发一下,我看看是不是受配置影响
我前面的描述错了,刚用源码试了下,复现方式: vue-demo :
// App.vue 内
<template>
<div>
<a href="https://vitejs.dev" target="_blank">
<img src="/vite.svg" class="logo" alt="Vite logo" />
</a>
<a href="https://vuejs.org/" target="_blank">
<img src="./assets/vue.svg" class="logo vue" alt="Vue logo" />
</a>
</div>
<HelloWorld msg="传入的内容" />
<div>({{ variable }}件)</div>
</template>
<script setup lang="ts">
import HelloWorld from './components/HelloWorld.vue'
import {ref} from 'vue';
const variable = ref('test')
</script>
结果:
<HelloWorld :msg="$t(`传入的内容`)" />
<div>({{ variable }}{{ $t('件)') }}</div>
vue-demo 根目录下 i18n.config.cjs
module.exports = {
input: 'src',
output: '',
exclude: ['**/node_modules/**/*', '**/src/locales/**'],
localePath: './src/locales/zh-CN.json',
localeFileType: 'json',
rules: {
js: {
caller: '',
functionName: 'i18n.global.t',
customizeKey: function (key, currentFilePath) {
return key
},
importDeclaration: "import { i18n } from '@/locales'",
forceImport: true
},
ts: {
caller: '',
functionName: 'i18n.global.t',
customizeKey: function (key, currentFilePath) {
return key
},
importDeclaration: "import { i18n } from '@/locales'",
forceImport: true
},
vue: {
caller: '',
functionNameInScript: 'i18n.global.t',
customizeKey: function (key, currentFilePath) {
return key
},
importDeclaration: "import { i18n } from '@/locales'"
}
},
globalRule: {
ignoreMethods: [ 'trackFn']
},
prettier: {
semi: false,
singleQuote: true,
printWidth: 100,
trailingComma: 'none'
},
// 是否跳过抽取中文
skipExtract: false,
// 是否跳过自动翻译
skipTranslate: true,
// 需要翻译的语言包。例如['en', 'zh-CHT'],会自动翻译英文和繁体
locales: ['en', 'th'],
// 是否导出 excel
exportExcel: true,
// excel 地址
excelPath: './src/locales/locales.xlsx',
}
我本地用项目跑了一下。转换跟你一样的,翻译可以正常使用。
<HelloWorld :msg="$t(`传入的内容`)" />
<div>({{ variable }}{{ $t('件)') }}</div>
转换前: 转换后
你那边运行有js报错么,可以截个图
我本地用项目跑了一下。转换跟你一样的,翻译可以正常使用。
<HelloWorld :msg="$t(`传入的内容`)" /> <div>({{ variable }}{{ $t('件)') }}</div>
转换前: 转换后
emmmm,倒是没报错,翻译是可以正常使用的,只是说 左括号按道理应该和 '件)' 一起也被提取出来。
我本地用项目跑了一下。转换跟你一样的,翻译可以正常使用。
<HelloWorld :msg="$t(`传入的内容`)" /> <div>({{ variable }}{{ $t('件)') }}</div>
转换前: 转换后
emmmm,倒是没报错,翻译是可以正常使用的,只是说 左括号按道理应该和 '件)' 一起也被提取出来。
目前我的正则表达式水平还做不到这个-_-||
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。
例如:
会转换为: