@dune2/swc-plugin

0.4.0 • Public • Published

i18n-swc-plugin

features

转换t/Trans调用

const name = "dune";

// 启用 `@dune2/swc-plugin` 可以使用以下方式
t`hello ${name}`; // hello dune
// 编译成,也可以直接写成下面的代码
t("hello {name}", { name }); // hello dune
<Trans>Attachment {name} saved.</Trans>
// 编译成
<Trans id='Attachment {name} saved.' values={{name}}></Trans>
<Trans>Attachment {props.name ?? defaultName} saved.</Trans>;
// 编译成
<Trans
  id="Attachment {0} saved."
  values={{ 0: props.name ?? defaultName }}
></Trans>;
<Trans>
  Read the <a href="/docs">docs</a>.
</Trans>;
// 编译成
<Trans id="Read the <0>docs</0>." components={{ 0: <a href="/docs" /> }} />;

develop

环境变量 可选值 说明
RUST_LOG info、debug.. log 开关 tracing
UPDATE 1 是否更新 output testing

next.js 版本兼容

next.js 插件版本
<=13.3.1 0.2.x
>=13.3.1 0.3.0
>=13.4.3 0.3.1
>= 13.4.9 >=0.3.5
>= 14.2.1 >=0.4.0

@swc/core 版本兼容

@swc/core
1.3.55 >=0.3.0
1.3.58 >=0.3.3
1.4.13 >=0.4.0

Readme

Keywords

Package Sidebar

Install

npm i @dune2/swc-plugin

Weekly Downloads

19

Version

0.4.0

License

ISC

Unpacked Size

2.27 MB

Total Files

3

Last publish

Collaborators

  • mazaoyong
  • vilyl