IFreeOvO / i18n-cli

支持将vue、react项目里的中文替换成 i18n 国际化标记,并支持自动翻译的命令行工具
MIT License
119 stars 36 forks source link

【bug反馈】img的alt属性等等替换出错,如图 #48

Closed seayao closed 1 year ago

seayao commented 1 year ago

场景1: image

场景2: image

场景3: image

场景4:(不只是alt属性) image

有的情况也能正确替换,可能和alt属性的位置有关系。

seayao commented 1 year ago

如果img的属性是空字符串就会出现问题(大概率),规律还没发现。

Pasoul commented 1 year ago

这个问题很严重:

<template>
   <div>
     <el-button readonly disabled>我是按钮</el-button>
     <el-button readonly disabled />
     <el-button readonly/>
   </div>
</template>

编译出来的效果:

<template>
  <div>
    <el-button readonlydisabled>{{ $t('我是按钮') }}</el-button>
    <el-button readonlydisable />
    <el-button readonl />
  </div>
</template>

其中第一个el-button的属性readonlydisabled会被合在一起,第二个el-button的readonlydisable单词少了一个d,第三个el-button少了一个单词y

demo: https://github.com/Pasoul/vue2-tsx-app/blob/master/src/views/attrs/index.vue

Pasoul commented 1 year ago

目前有很多文件已经替换好了,才发现的这个问题,项目已经不能回退了,能不能出个命令给我们校对一下,我们拉一个新的分支,执行你这个命令之后,能够把连续两个为空的属性的文件找到,我们人工再去修复

IFreeOvO commented 1 year ago

目前有很多文件已经替换好了,才发现的这个问题,项目已经不能回退了,能不能出个命令给我们校对一下,我们拉一个新的分支,执行你这个命令之后,能够把连续两个为空的属性的文件找到,我们人工再去修复

有的,it --exportExcel 生成excel进行翻译校对,或者--output 输出到指定文件,这种不会覆盖原始文件,可以对比转换前后差异。真的不好意思。

seayao commented 1 year ago

目前有很多文件已经替换好了,才发现的这个问题,项目已经不能回退了,能不能出个命令给我们校对一下,我们拉一个新的分支,执行你这个命令之后,能够把连续两个为空的属性的文件找到,我们人工再去修复

有的,it --exportExcel 生成excel进行翻译校对,或者--output 输出到指定文件,这种不会覆盖原始可以,可以对比转换前后差异。真的不好意思。

我理解的应该不是校对翻译,而是校对源码,因为源码可能已经存在错误了(属性错误,属性丢失等)。 image

IFreeOvO commented 1 year ago

目前有很多文件已经替换好了,才发现的这个问题,项目已经不能回退了,能不能出个命令给我们校对一下,我们拉一个新的分支,执行你这个命令之后,能够把连续两个为空的属性的文件找到,我们人工再去修复

有的,it --exportExcel 生成excel进行翻译校对,或者--output 输出到指定文件,这种不会覆盖原始可以,可以对比转换前后差异。真的不好意思。

我理解的应该不是校对翻译,而是校对源码,因为源码可能已经存在错误了(属性错误,属性丢失等)。 image

这个不可实现吧。例如在标签

,从语法上说aa属性是正确,而从业务角度说这个aa是否正确,又根据实际场景来,没有规律可循

seayao commented 1 year ago

看了下源码大概是这个函数:

onclosetag(tagName, isImplied) {
        shouldIgnore = false
        // 如果是自闭合标签
        if (isImplied) {
          htmlString = htmlString.slice(0, htmlString.length - 2) + '/>'
          return
        }
        htmlString += `</${tagName}>`
      },

函数里面写了注释说只有自闭合标签才会处理,但是实际情况不是自闭合的标签也会处理错误(可能有别的函数)源码没有都看。 就是如果能走到这个函数里面的,期望可以列出文件名。

IFreeOvO commented 1 year ago

@Pasoul @seayao

是我对alt=''这种空值属性没有分隔导致的。你们试着通过正则搜索文件里有关disabled ,readonly这类布尔类型属性,它们会受到这个Bug影响

Pasoul commented 1 year ago

@IFreeOvO

<Hello title="" v-else></Hello>

组件如果这么写,编译后的title变成了这样:

<Hello title v-else></Hello>

看了下好像是htmlparser2无法区分两者,attributes 都是{'title': '', 'v-else': ''}。这对我们代码会有影响吗。我担心子组件会拿title这么判断: if (this.title === '') {}

IFreeOvO commented 1 year ago

@IFreeOvO

<Hello title="" v-else></Hello>

组件如果这么写,编译后的title变成了这样:

<Hello title v-else></Hello>

看了下好像是htmlparser2无法区分两者,attributes 都是{'title': '', 'v-else': ''}。这对我们代码会有影响吗。我担心子组件会拿title这么判断: if (this.title === '') {}

这个能修。我晚上改下。htmlparser2它文档没更新,我昨天翻issues也才注意到,其实htmlparser2可以识别出来title 和title=''。它文档用法没写全

IFreeOvO commented 1 year ago

@Pasoul @seayao 已修复

IFreeOvO commented 1 year ago

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。

IFreeOvO commented 1 year ago

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。

IFreeOvO commented 1 year ago

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。

IFreeOvO commented 1 year ago

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。

IFreeOvO commented 1 year ago

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。

IFreeOvO commented 11 months ago

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。

IFreeOvO commented 11 months ago

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。

IFreeOvO commented 10 months ago

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。

IFreeOvO commented 10 months ago

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。

IFreeOvO commented 9 months ago

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。

IFreeOvO commented 9 months ago

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。

IFreeOvO commented 8 months ago

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。

IFreeOvO commented 8 months ago

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。

IFreeOvO commented 7 months ago

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。

IFreeOvO commented 7 months ago

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。

IFreeOvO commented 6 months ago

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。

IFreeOvO commented 6 months ago

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。

IFreeOvO commented 5 months ago

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。

IFreeOvO commented 5 months ago

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。

IFreeOvO commented 4 months ago

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。

IFreeOvO commented 4 months ago

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。

IFreeOvO commented 3 months ago

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。

IFreeOvO commented 3 months ago

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。

IFreeOvO commented 2 months ago

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。

IFreeOvO commented 2 months ago

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。

IFreeOvO commented 1 month ago

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。

IFreeOvO commented 1 month ago

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。

IFreeOvO commented 1 month ago

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。

IFreeOvO commented 2 weeks ago

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。

IFreeOvO commented 1 day ago

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。