-
Notifications
You must be signed in to change notification settings - Fork 42
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
Docs: The Proposal of Karmada Dashboard Automation i18n Tool which is Developed for OSPP 2024 Project. #119
Docs: The Proposal of Karmada Dashboard Automation i18n Tool which is Developed for OSPP 2024 Project. #119
Conversation
/assign |
@chouchongYHMing plz resolve the problem of DCO |
cde6e27
to
dc32b0c
Compare
docs/i18n-docs.md
Outdated
|
||
## Summary | ||
|
||
Internationalization (also called i18n) is essential for software that aims to become global. During the development of the Karmada dashboard, we encountered inefficiencies, errors, and lack of engineering rigor in manually maintaining translation content (also called locales files). To solve these issues and meet the i18n needs of the Karmada dashboard project, we developed a ready-to-use automated i18n tool. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we suffered from low efficiency、 easy to make mistakes、lack of engineering due to maintaining i18n translation (aka locales) manually.
docs/i18n-docs.md
Outdated
|
||
## Summary | ||
|
||
Internationalization (also called i18n) is essential for software that aims to become global. During the development of the Karmada dashboard, we encountered inefficiencies, errors, and lack of engineering rigor in manually maintaining translation content (also called locales files). To solve these issues and meet the i18n needs of the Karmada dashboard project, we developed a ready-to-use automated i18n tool. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out-of-the-box
docs/i18n-docs.md
Outdated
|
||
## Motivation | ||
|
||
During the development of the Karmada dashboard, early on, we maintained the locales files manually. If new Chinese content was added to the code, it required to replace by the corresponding i18n keys and functions. After that, a mapping of code points to the corresponding Chinese content was added to the Chinese locales file. Then translating the Chinese content and inserting a mapping of code points to the translated content in the locales files of the respective languages. When the project was small and the amount of Chinese characters was limited, the cost of manual maintenance was relatively acceptable. However, as the project scale expanded and the number of Chinese characters increased, the cost of manually maintaining locales files rose exponentially. Therefore, an automated i18n tool was needed to meet the i18n requirements of the Karmada dashboard. In the open source community, it was hard to find a ready-to-use i18n tool that perfectly supported the i18n needs of the Karmada dashboard. Therefore, we aimed to develop an automated i18n tool which is based on the perspective of the Karmada dashboard's i18n requirements, to satisfy the specific i18n needs of the Karmada dashboard. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we maintained the locales files manually in the early stages.
docs/i18n-docs.md
Outdated
|
||
## Motivation | ||
|
||
During the development of the Karmada dashboard, early on, we maintained the locales files manually. If new Chinese content was added to the code, it required to replace by the corresponding i18n keys and functions. After that, a mapping of code points to the corresponding Chinese content was added to the Chinese locales file. Then translating the Chinese content and inserting a mapping of code points to the translated content in the locales files of the respective languages. When the project was small and the amount of Chinese characters was limited, the cost of manual maintenance was relatively acceptable. However, as the project scale expanded and the number of Chinese characters increased, the cost of manually maintaining locales files rose exponentially. Therefore, an automated i18n tool was needed to meet the i18n requirements of the Karmada dashboard. In the open source community, it was hard to find a ready-to-use i18n tool that perfectly supported the i18n needs of the Karmada dashboard. Therefore, we aimed to develop an automated i18n tool which is based on the perspective of the Karmada dashboard's i18n requirements, to satisfy the specific i18n needs of the Karmada dashboard. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to replace Chinese content with i18n keys and functions.
docs/i18n-docs.md
Outdated
|
||
## Motivation | ||
|
||
During the development of the Karmada dashboard, early on, we maintained the locales files manually. If new Chinese content was added to the code, it required to replace by the corresponding i18n keys and functions. After that, a mapping of code points to the corresponding Chinese content was added to the Chinese locales file. Then translating the Chinese content and inserting a mapping of code points to the translated content in the locales files of the respective languages. When the project was small and the amount of Chinese characters was limited, the cost of manual maintenance was relatively acceptable. However, as the project scale expanded and the number of Chinese characters increased, the cost of manually maintaining locales files rose exponentially. Therefore, an automated i18n tool was needed to meet the i18n requirements of the Karmada dashboard. In the open source community, it was hard to find a ready-to-use i18n tool that perfectly supported the i18n needs of the Karmada dashboard. Therefore, we aimed to develop an automated i18n tool which is based on the perspective of the Karmada dashboard's i18n requirements, to satisfy the specific i18n needs of the Karmada dashboard. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scale up
docs/i18n-docs.md
Outdated
|
||
## Motivation | ||
|
||
During the development of the Karmada dashboard, early on, we maintained the locales files manually. If new Chinese content was added to the code, it required to replace by the corresponding i18n keys and functions. After that, a mapping of code points to the corresponding Chinese content was added to the Chinese locales file. Then translating the Chinese content and inserting a mapping of code points to the translated content in the locales files of the respective languages. When the project was small and the amount of Chinese characters was limited, the cost of manual maintenance was relatively acceptable. However, as the project scale expanded and the number of Chinese characters increased, the cost of manually maintaining locales files rose exponentially. Therefore, an automated i18n tool was needed to meet the i18n requirements of the Karmada dashboard. In the open source community, it was hard to find a ready-to-use i18n tool that perfectly supported the i18n needs of the Karmada dashboard. Therefore, we aimed to develop an automated i18n tool which is based on the perspective of the Karmada dashboard's i18n requirements, to satisfy the specific i18n needs of the Karmada dashboard. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
increased rapidly
docs/i18n-docs.md
Outdated
|
||
## Motivation | ||
|
||
During the development of the Karmada dashboard, early on, we maintained the locales files manually. If new Chinese content was added to the code, it required to replace by the corresponding i18n keys and functions. After that, a mapping of code points to the corresponding Chinese content was added to the Chinese locales file. Then translating the Chinese content and inserting a mapping of code points to the translated content in the locales files of the respective languages. When the project was small and the amount of Chinese characters was limited, the cost of manual maintenance was relatively acceptable. However, as the project scale expanded and the number of Chinese characters increased, the cost of manually maintaining locales files rose exponentially. Therefore, an automated i18n tool was needed to meet the i18n requirements of the Karmada dashboard. In the open source community, it was hard to find a ready-to-use i18n tool that perfectly supported the i18n needs of the Karmada dashboard. Therefore, we aimed to develop an automated i18n tool which is based on the perspective of the Karmada dashboard's i18n requirements, to satisfy the specific i18n needs of the Karmada dashboard. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the cost of maintaining locales files in manual way rose exponentially
docs/i18n-docs.md
Outdated
|
||
## Motivation | ||
|
||
During the development of the Karmada dashboard, early on, we maintained the locales files manually. If new Chinese content was added to the code, it required to replace by the corresponding i18n keys and functions. After that, a mapping of code points to the corresponding Chinese content was added to the Chinese locales file. Then translating the Chinese content and inserting a mapping of code points to the translated content in the locales files of the respective languages. When the project was small and the amount of Chinese characters was limited, the cost of manual maintenance was relatively acceptable. However, as the project scale expanded and the number of Chinese characters increased, the cost of manually maintaining locales files rose exponentially. Therefore, an automated i18n tool was needed to meet the i18n requirements of the Karmada dashboard. In the open source community, it was hard to find a ready-to-use i18n tool that perfectly supported the i18n needs of the Karmada dashboard. Therefore, we aimed to develop an automated i18n tool which is based on the perspective of the Karmada dashboard's i18n requirements, to satisfy the specific i18n needs of the Karmada dashboard. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out-of-the-box
docs/i18n-docs.md
Outdated
|
||
## Proposal | ||
|
||
<!-- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why only Chinese comment here? should it be removed?
docs/i18n-docs.md
Outdated
|
||
1. processAST Function: Responsible for processing the AST, identifying and replacing Chinese strings. | ||
2. generateKey Function: Generates unique keys for use in the i18n JSON file. | ||
3. updateLocales Function: Update Locales files as material for subsequent translation functions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update locales files
docs/i18n-docs.md
Outdated
<!-- | ||
扫描流程:扫描模块负责接收外部传入的原始文件,返回处理好的AST(Abstract Syntax Tree)树,内部流程如图: | ||
--> | ||
Convert the input files into an AST, traverse the AST to find nodes which containing Chinese characters, calculate the code points corresponding to the Chinese characters and save them in the i18nMap, and save the transformed AST nodes in CNpath. After completing one scan, continue to traverse CNpath, converting the Chinese characters in the corresponding AST nodes into the form of i18n function calls, and generate a new AST tree to return. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After the first round of scanning finished,
docs/i18n-docs.md
Outdated
<!-- | ||
代码生成流程:接收扫描模块返回的修改后的AST树,将修改后的AST树转换成原始代码,内部流程如图: | ||
--> | ||
If the original code does not include an import statement for the i18n instance, an appropriate import statement needs to be inserted. This completes the main workflow of code generation. The process of code generation might inadvertently alter statements unrelated to i18n. To address this issue, a prettier process is introduced to style the generated code according to the original coding style, minimizing changes which brought by code-gen. Finally, the newly generated code is written back into the original file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which were introduced by code-gen
docs/i18n-docs.md
Outdated
|
||
## Motivation | ||
|
||
During the development of the Karmada dashboard, early on, we maintained the locales files manually. If new Chinese content was added to the code, it required to replace by the corresponding i18n keys and functions. After that, a mapping of code points to the corresponding Chinese content was added to the Chinese locales file. Then translating the Chinese content and inserting a mapping of code points to the translated content in the locales files of the respective languages. When the project was small and the amount of Chinese characters was limited, the cost of manual maintenance was relatively acceptable. However, as the project scale expanded and the number of Chinese characters increased, the cost of manually maintaining locales files rose exponentially. Therefore, an automated i18n tool was needed to meet the i18n requirements of the Karmada dashboard. In the open source community, it was hard to find a ready-to-use i18n tool that perfectly supported the i18n needs of the Karmada dashboard. Therefore, we aimed to develop an automated i18n tool which is based on the perspective of the Karmada dashboard's i18n requirements, to satisfy the specific i18n needs of the Karmada dashboard. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was acceptable
docs/i18n-docs.md
Outdated
#### Story 2 | ||
As software developers, they can improve the code for each module. The executable code for each module is stored in the 'src' directory. Developers simply need to open each file to directly modify and enhance it. When they want to develop new tools in the future and need to use these modules, they can directly reference them, avoiding redundant production. | ||
<!-- | ||
作为程序开发者,它可以对每个模块的代码进行改进。在scr目录下存放了每个模块的执行代码。开发者只需点开每个文件即可直接对其进行修改和增强。当他们在未来想开发的新的工具,需要用到这些模块时,也可以直接进行引用,避免了重复生产。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--> | ||
|
||
#### Story 1 | ||
As a developer of the Karmada dashboard, when introducing new features with a significant amount of new Chinese content, there is an automated tool that can extract, translate, and generate corresponding locale files for this new content with a single click, thereby reducing the maintenance cost of i18n. The community administrator provides the corresponding i18n translation rules for specific descriptions. In automatic translation, you can preferentially use the i18n translation rules provided by the community administrator and combine them with automatic translation to improve the overall effect of i18n translation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that, it's two user-stories?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's same situation to community members.
925f443
to
9567273
Compare
docs/i18n-docs.md
Outdated
|
||
## Summary | ||
|
||
Internationalization (aka i18n) is essential for software that aims to become global. During the development of the Karmada dashboard, we suffered from low efficiency、 easy to make mistakes、lack of engineering due to maintaining i18n translation (aka locales) manually. To solve these issues and meet the i18n needs of the Karmada dashboard project, we developed a out-of-the-box automated i18n tool. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here should use an out-of-the-box automated i18n tool, not using a
docs/i18n-docs.md
Outdated
|
||
## Motivation | ||
|
||
During the development of the Karmada dashboard, we maintained the locales files manually in the early stages. If new Chinese content was added to the code, we need to replace Chinese content with i18n keys and i18n function. After that, a mapping of code points to the corresponding Chinese content was added to the Chinese locales file. Then translating the Chinese content and inserting a mapping of code points to the translated content in the locales files of the respective languages. When the project was small and the amount of Chinese characters was limited, the cost of manual maintenance was relatively acceptable. However, as the project scale up expanded and the number of Chinese characters increased rapidly, the cost of maintaining locales files in manual way rose exponentially. Therefore, an automated i18n tool was needed to meet the i18n requirements of the Karmada dashboard. In the open source community, it was hard to find a out-of-the-box i18n tool that perfectly supported the i18n needs of the Karmada dashboard. Therefore, we aimed to develop an automated i18n tool which is based on the perspective of the Karmada dashboard's i18n requirements, to satisfy the specific i18n needs of the Karmada dashboard. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here need to remove expanded
~
docs/i18n-docs.md
Outdated
#### Story 2 | ||
As software developers, they can improve the code for each module. The executable code for each module is stored in the 'src' directory. Developers simply need to open each file to directly modify and enhance it. When they want to develop new tools in the future and need to use these modules, they can directly reference them, avoiding redundant production. | ||
<!-- | ||
作为程序开发者,它可以对每个模块的代码进行改进。在scr目录下存放了每个模块的执行代码。开发者只需点开每个文件即可直接对其进行修改和增强。当他们在未来想开发的新的工具,需要用到这些模块时,也可以直接进行引用,避免了重复生产。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8b9bef0
to
ceb8d90
Compare
Signed-off-by: chouchongYHMing <121396869+chouchongYHMing@users.noreply.github.com>
ceb8d90
to
55793d5
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: warjiang The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
documentation
What this PR does / why we need it:
This is the proposal for auto i18n-tool.
Which issue(s) this PR fixes:
Fixes #53
Special notes for your reviewer:
It's for ospp 2024 project.
Does this PR introduce a user-facing change?:
No, It's just for developer.