Closed hongdeyuan closed 2 years ago
const DETECT_REGEXP = /(intl|IntlUtils)\s*\.\s*(get\s*\(\s*["'
]([\w.-]+)["'][\s\S]*?\)\s*\.\s*(defaultMessage|d)\s*\(\s*[
"']([\s\S]+?)["']|getHTML*\s*\(\s*["'
]([\w.-]+)["'][\s\S]*?\)\s*\.\s*(defaultMessage|d)\s*\(\s*(["'
<][\s\S]+?["'>]))[\s*,]*\)/gm;
Replace : src/util/constant.js for support Chinese keys
const DETECT_REGEXP = /(intl|IntlUtils)\s*\.\s*(get\s*\(\s*["'
]([\s\S]+?)["'][\s\S]*?\)\s*\.\s*(defaultMessage|d)\s*\(\s*[
"']([\s\S]+?)["']|getHTML*\s*\(\s*["'
]([\s\S]+?)["'][\s\S]*?\)\s*\.\s*(defaultMessage|d)\s*\(\s*(["'
<][\s\S]+?["'>]))[\s*,]*\)/gm;
@cwtuan : PR: https://github.com/alibaba/react-intl-universal/pull/166
Yes, Chinese key isn't supported and not recommended.
Thank you for your answer, but why not recommended?
The json key is better to be English.
//package.json "intl:extract": "react-intl-universal-extract --cmd extract --source-path ./ --output-path ./lang/locales/zhCN.json --verbose",
In the zhCN.json file, the content cannot be extracted:
intl.get('没有找到该资源').defaultMessage('404 - 没有找到该资源')
so, I suspect react-intl-universal-extract does not support Chinese keys