feat: add internationalization (i18n) support#485
Open
Jefsky wants to merge 1 commit intoalibaba:mainfrom
Open
feat: add internationalization (i18n) support#485Jefsky wants to merge 1 commit intoalibaba:mainfrom
Jefsky wants to merge 1 commit intoalibaba:mainfrom
Conversation
Collaborator
|
Could you explain the expected benefit of this change? |
Author
|
The key benefits of this change are:
The existing i18n infrastructure (I18n class with locale support) was already in place — this PR just externalized the inline translation objects into JSON files. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements i18n support for the page-agent UI package as requested in issue #195.
Changes Made:
Created JSON locale files:
**Refactored **:
**Updated **:
Architecture:
The i18n system already existed in the codebase (I18n class with locale support for 'en-US' and 'zh-CN'). This PR simply externalizes the translation data into JSON files for easier maintenance and future translation contributions.
Testing:
✔ @page-agent/page-controller
(node:62494) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
(Use
node --trace-warnings ...to show where the warning was created)�[36m📦 Building @page-agent/page-controller�[39m
�[36mvite v7.3.2 �[32mbuilding client environment for production...�[36m�[39m
transforming...
�[32m✓�[39m 11 modules transformed.
rendering chunks...
�[32m
�[36m[unplugin:dts]�[32m Start generate declaration files...�[39m
computing gzip size...
�[2mdist/lib/�[22m�[36mSimulatorMask-BfJiQVCo.js �[39m�[1m�[2m11.60 kB�[22m�[1m�[22m�[2m │ gzip: 3.23 kB�[22m�[2m │ map: 15.64 kB�[22m
�[2mdist/lib/�[22m�[36mpage-controller.js �[39m�[1m�[2m75.11 kB�[22m�[1m�[22m�[2m │ gzip: 16.09 kB�[22m�[2m │ map: 157.83 kB�[22m
�[32m�[36m[unplugin:dts]�[32m Start bundling declaration files...�[39m
Analysis will use the bundled TypeScript version 6.0.3
�[32m�[36m[unplugin:dts]�[32m Declaration files built in 1891ms.
�[39m
�[32m✓ built in 2.14s�[39m
✔ @page-agent/ui
(node:62516) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
(Use
node --trace-warnings ...to show where the warning was created)�[36m📦 Building @page-agent/ui�[39m
�[36mvite v7.3.2 �[32mbuilding client environment for production...�[36m�[39m
transforming...
�[32m✓�[39m 9 modules transformed.
rendering chunks...
�[32m
�[36m[unplugin:dts]�[32m Start generate declaration files...�[39m
computing gzip size...
�[2mdist/lib/�[22m�[36mpage-agent-ui.js �[39m�[1m�[2m37.39 kB�[22m�[1m�[22m�[2m │ gzip: 9.77 kB�[22m�[2m │ map: 37.19 kB�[22m
�[32m�[36m[unplugin:dts]�[32m Start bundling declaration files...�[39m
Analysis will use the bundled TypeScript version 6.0.3
�[32m�[36m[unplugin:dts]�[32m Declaration files built in 1798ms.
�[39m
�[32m✓ built in 1.98s�[39m
✔ @page-agent/llms
(node:62483) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
(Use
node --trace-warnings ...to show where the warning was created)�[36m📦 Building @page-agent/llms�[39m
�[36mvite v7.3.2 �[32mbuilding client environment for production...�[36m�[39m
transforming...
�[32m✓�[39m 5 modules transformed.
rendering chunks...
�[32m
�[36m[unplugin:dts]�[32m Start generate declaration files...�[39m
computing gzip size...
�[2mdist/lib/�[22m�[36mpage-agent-llms.js �[39m�[1m�[2m13.77 kB�[22m�[1m�[22m�[2m │ gzip: 3.83 kB�[22m�[2m │ map: 26.20 kB�[22m
�[32m�[36m[unplugin:dts]�[32m Start bundling declaration files...�[39m
Analysis will use the bundled TypeScript version 6.0.3
�[32m�[36m[unplugin:dts]�[32m Declaration files built in 1716ms.
�[39m
�[32m✓ built in 1.80s�[39m
✔ @page-agent/core
(node:62517) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
(Use
node --trace-warnings ...to show where the warning was created)�[36mvite v7.3.2 �[32mbuilding client environment for production...�[36m�[39m
transforming...
�[32m✓�[39m 5 modules transformed.
rendering chunks...
�[32m
�[36m[unplugin:dts]�[32m Start generate declaration files...�[39m
computing gzip size...
�[2mdist/esm/�[22m�[36mpage-agent-core.js �[39m�[1m�[2m36.34 kB�[22m�[1m�[22m�[2m │ gzip: 11.10 kB�[22m�[2m │ map: 62.76 kB�[22m
�[32m�[36m[unplugin:dts]�[32m Start bundling declaration files...�[39m
Analysis will use the bundled TypeScript version 6.0.3
�[32m�[36m[unplugin:dts]�[32m Declaration files built in 2308ms.
�[39m
�[32m✓ built in 2.42s�[39m
✔ page-agent
(node:62515) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
(Use
node --trace-warnings ...to show where the warning was created)�[36mvite v7.3.2 �[32mbuilding client environment for production...�[36m�[39m
transforming...
�[32m✓�[39m 1 modules transformed.
rendering chunks...
�[32m
�[36m[unplugin:dts]�[32m Start generate declaration files...�[39m
computing gzip size...
�[2mdist/esm/�[22m�[36mpage-agent.js �[39m�[1m�[2m0.61 kB�[22m�[1m�[22m�[2m │ gzip: 0.29 kB�[22m�[2m │ map: 1.26 kB�[22m
�[32m�[36m[unplugin:dts]�[32m Start bundling declaration files...�[39m
Analysis will use the bundled TypeScript version 6.0.3
�[32m�[36m[unplugin:dts]�[32m Declaration files built in 2636ms.
�[39m
�[32m✓ built in 2.74s�[39m
(node:62564) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
(Use
node --trace-warnings ...to show where the warning was created)�[36mvite v7.3.2 �[32mbuilding client environment for production...�[36m�[39m
transforming...
�[32m✓�[39m 114 modules transformed.
rendering chunks...
computing gzip size...
�[2mdist/iife/�[22m�[36mpage-agent.demo.js �[39m�[1m�[2m204.56 kB�[22m�[1m�[22m�[2m │ gzip: 57.26 kB�[22m
�[32m✓ built in 320ms�[39m
✔ All 5 tasks completed )
Benefits: