如何在VSCode中搜索文本而不翻译?

huangapple go评论71阅读模式
英文:

How to seach text not translate in VSCode?

问题

<Button>{t('Save')}</Button>

<ContentWrapper title="Connection" headerAction={<Button size="small">{t('Add')}</Button>}>
  <div>{t('Connection')}</div>
</ContentWrapper>
英文:

I'm added i18next React for old project. So many text not can be translate. How can I search all of them in VSCode?

Some case:

<Button className="w-full" onClick={onClick}>
  Save
<Button>

<Button
  type="primary"
  onClick={onCLick}
  className="ml-2"
>
  Save
</Button>

<Button>Save</Button>

<ContentWrapper title="Connection" headerAction={<Button size="small">Add</Button>}>
  <div>{`Connection`}</div>
</ContentWrapper>

<p className="mt-2 text-center">
  Drag and drop files here or <span className="text-blue-500">{t('browse')}</span>
</p>

<div>
  {mediaRecorder?.state === 'recording' ? (
    <Button onClick={handleStop}>{t('Stop')}</Button>
  ) : (
    <Button onClick={handleStart}>Start</Button>
  )}
</div>

Translated:

<Button>{t('Save')}</Button>

<ContentWrapper title="Connection" headerAction={<Button size="small">{t('Add')}</Button>}>
      <div>{t('Connection')}</div>
    </ContentWrapper>

答案1

得分: 1

以下是您要求的翻译结果:

Find:

(<Button[\s\S\n]*?>[\n\s]*)(\w+)([\n\s]*</Button>)

Replace:

$1{t('$2')}$3
英文:

Find:

(<Button[\s\S\n]*?>[\n\s]*)(\w+)([\n\s]*</Button>)

Replace:

$1{t('$2')}$3

huangapple
  • 本文由 发表于 2023年6月2日 13:13:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/76387293.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定