Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【需求】支持 react-intl Message Syntax - 支持简单的自定义参数 #4

Closed
Styx11 opened this issue Sep 24, 2021 · 0 comments
Labels
待验证 请验证该 issue 是否得到解决 需求 这是一个产品需求

Comments

@Styx11
Copy link
Owner

Styx11 commented Sep 24, 2021

描述

Message Syntax 语法链接: Link

在一些场景下我们会需要给单一的国际化配置传入不同的参数,这样我们就能只维护一个 id 对应的配置

目前需要实现简单的参数配置👉Simple Argument

期望

我们希望能够通过特殊的字符串表示含有参数的文本,以让 react-intl-linter 插件能够识别,例子🌰:

// 目标特殊文本
const message = 'react-intl=你好,{name: 约翰}'
// 👇
// 替换后的 react-intl 代码
const intl = intl.formatMessage({ id: "HELLO_NAME" }, {name: "约翰"})

// 拿去翻译的结果,真正的内容由参数传递
const transTarget = '你好,{name}'

// 处理后供选择的 intlId
const intlId = 'HELLO_NAME'
// 翻译后的中文结果
const transZHResult = '你好,{name}'
// 翻译后的英文结果
const transENResult = 'Hello, {name}'
@Styx11 Styx11 added the 需求 这是一个产品需求 label Sep 24, 2021
@Styx11 Styx11 added this to the react-intl-linter 1.0.0 milestone Sep 26, 2021
@Styx11 Styx11 added the 待验证 请验证该 issue 是否得到解决 label Oct 12, 2021
@Styx11 Styx11 closed this as completed Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
待验证 请验证该 issue 是否得到解决 需求 这是一个产品需求
Projects
None yet
Development

No branches or pull requests

1 participant