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

feat:站点资产国际化 #385

Merged
merged 28 commits into from
Jun 27, 2023
Merged

feat:站点资产国际化 #385

merged 28 commits into from
Jun 27, 2023

Conversation

yangzy0603
Copy link
Collaborator

@yangzy0603 yangzy0603 commented Jun 21, 2023

  • gi-sdk 增加 IntlProvider ,并在 gi context 中增加资产语言包信息并传递 useIntl hook。
  • 一方资产国际化统一使用 context 中传递的 useIntl 提供的能力处理。
  • 非一方资产从 context 中获取语言环境,国际化方案不做限制,可自行维护。
  • 当前 pr 仅以 gi-assets-basic 的 FilterPanel 为例。
  • 资产包中Info 、 registerMeta 等非 React 组件部分的文案均使用 sdk 导出的静态方法 formatMessage 做多语言转换,changeLanguage、getCurrentLanguage 配合使用

@yangzy0603 yangzy0603 added the WIP label Jun 21, 2023
@github-actions
Copy link

github-actions bot commented Jun 21, 2023

你好, @yangzy0603 CI 执行失败, 请点击 [Details] 按钮查看, 并根据日志修复

Hello, @yangzy0603 CI run failed, please click the [Details] button for detailed log information and fix it.

packages/gi-assets-basic/src/index.tsx Outdated Show resolved Hide resolved
@yangzy0603 yangzy0603 changed the title feat:基于 react-intl 的资产国际化方案 feat:站点资产国际化 Jun 27, 2023
@pomelo-nwu pomelo-nwu merged commit 555ba9d into master Jun 27, 2023
@pomelo-nwu pomelo-nwu deleted the feat/locale branch June 27, 2023 11:42
@@ -14,13 +14,14 @@
"build": "node --experimental-json-modules scripts/pre-build.mjs && NODE_OPTIONS=--max_old_space_size=4096 umi build",
"build:docker": "node scripts/link.mjs && cd ../../ && npm run build:all:umd && cd packages/gi-site/ && BUILD_MODE=docker node scripts/pre-build.mjs && node scripts/copy-assets.mjs && BUILD_MODE=docker NODE_OPTIONS=--max_old_space_size=4096 umi build",
"deploy": "node ./scripts/deploy.js",
"start": "node --experimental-json-modules scripts/link.mjs && node scripts/pre-build.mjs && cross-env NODE_OPTIONS=--max_old_space_size=4096 cross-env PORT=8000 umi dev",
"start": "node --experimental-json-modules scripts/link.mjs && node scripts/pre-build.mjs && cross-env NODE_OPTIONS=--openssl-legacy-provider --max_old_space_size=4096 cross-env PORT=8000 umi dev",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pomelo-nwu @Yanyan-Wang

--openssl-legacy-provider是Node 17之后的flag,node 16下运行报错:

image

去掉后可以跑起来。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yangzy0603 yangzy0603 removed the WIP label Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants