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

[NEW FEATURE] Add script to support auto translate some fixed content #22834

Open
fuchunhui opened this issue Jul 31, 2024 · 4 comments
Open
Labels
community issues, pull requests and discussion by the community documentation Improvements or additions to documentation enhancement Improves an existing feature. system Infrastructure and configuration for the project

Comments

@fuchunhui
Copy link
Contributor

As everyone knows, the translation work of the MDN open source community is done by volunteers, a very time-consuming work. In order to improve the translation efficiency, we can use some tools to assist the translation work.

Practice sharing

At the beginning of the translation process, I can only complete the translation of a single file at one time. As I become familiar with the process, I can batch process some files, but I find it a painful thing.

When operating a single file, first process the header content, then the body title, and finally the body content.

When operating multiple files, I need to open multiple files, then process them one by one. Later, I thought of using the folder search and replace function by vscode, update and replace the keywords.

When the next batch translation, I need to search and replace in batch through shift + command + f, case by case processing, unfortunately, there will still be omissions.

files ## Specifications ## Browser compatibility
screenshot_166 screenshot_167 screenshot_168

I don't want to spend time doing these repetitive things anymore, I want a better way.

Any better way?

Perhaps scripts can be used to solve this problem.

This script will not solve all the problems, it currently has the ability to cover:

  • Handler header information, delete invalid content, replace the title with translation.
  • Keep slug and title, create l10n content template.
  • Process the body title, replace the title.
  • Process the link, replace the link.
before command example one example two
screenshot_169 screenshot_170 screenshot_171

How to use the script

image

npm run auto:translate file-path

The principle is very simple, it scan the directory content, match through regular expressions, and replace the fixed content.

The advantages of the script

  • No language restrictions, the configuration content can be customized.
  • Focus on the core content, reduce repetitive labor.

Finally, what do you think?

@PassionPenguin
Copy link
Contributor

any link or detailed code to the script you created?

but indeed, translating the title could be the easiest things over the whole file, so...This could be useful, but the efforts to maintain such a script may not be worthy enough.

@yin1999 yin1999 added documentation Improvements or additions to documentation enhancement Improves an existing feature. system Infrastructure and configuration for the project community issues, pull requests and discussion by the community labels Aug 2, 2024
@fuchunhui
Copy link
Contributor Author

any link or detailed code to the script you created?

but indeed, translating the title could be the easiest things over the whole file, so...This could be useful, but the efforts to maintain such a script may not be worthy enough.

Thanks for your attention. yes, I will submit the code later, so that we can understand it better.

Precisely because this is the simplest content, I chose to start from here, first solve the basic problems, and ensure that the translation process is always correct. And the content is the most important part, the quality of machine-translated content is quite good, but most of it still has a lot of room for improvement, the calibration process is also a time-consuming thing. Here I am very grateful and admire the persons who often code review. their workload is very large.

As of now, I have used this tool to complete 15 commits, and the experience is very smooth, worth a try.

fuchunhui added a commit to fuchunhui/translated-content that referenced this issue Aug 2, 2024
@fuchunhui
Copy link
Contributor Author

fuchunhui commented Aug 2, 2024

A draft version of the code.

If your files path is files/zh-cn/web/api/htmlselectelement, then you can do like this:

node scripts/auto-translate.js files/zh-cn/web/api/htmlselectelement

fuchunhui added a commit to fuchunhui/translated-content that referenced this issue Aug 15, 2024
fuchunhui added a commit to fuchunhui/translated-content that referenced this issue Aug 15, 2024
@yin1999
Copy link
Member

yin1999 commented Sep 4, 2024

I don't have a clear opinion on introducing this script.

But as @PassionPenguin said, translating headings is the simplest task. We may not need to introduce special tools for this. There are many maintainers of mdn/content having their own tools to help themselves maintain the English documents. But they have not introduced these tools into the mdn/content repository yet.

I believe people has their own habits of contributing to translated-content. Specific tools may not help most people.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community issues, pull requests and discussion by the community documentation Improvements or additions to documentation enhancement Improves an existing feature. system Infrastructure and configuration for the project
Projects
None yet
Development

No branches or pull requests

3 participants