「2023.003|EN」Translate Hexo Articles efficiently using ChatGPT

Translation Requirements

  • The title and excerpt in the Front-matter need to be translated
  • Both Hexo and NexT themes define their own Tag Plugins (Hexo / NexT), which are used to insert images, codes, etc., and do not need to be translated in most cases
  • The translation quality should be relatively high, and it can be published after simple proofreading and confirmation

Use ChatGPT - Genie AI for Translation

Traditional translation tools such as Google Translate cannot meet the requirements mentioned above, but fortunately ChatGPT has been released, which can basically meet these requirements.

Since I use VSCode as an editor, I will first consider using VSCode plugins to solve the problem. As of writing this article, searching for ChatGPT in the VSCode plugin market, the download times and scores of the ChatGPT - Genie AI plugin are the best. So I chose it first.

Genie AI is essentially calling the ChatGPT API for translation. When using it for the first time, a dialog box will pop up asking you to fill in the OpenAI API key.

The steps for translation are as follows:

  1. Select the post source code to be translated
    • If the account associated with the OpenAI API key is Free Plan instead of Plus, the length of the message sent will have a limit, currently 2048. Therefore, in this case, if the article is long, you can only select the post source code content less than 2048 bytes each time and translate it in multiple times.
  2. Enter the translation requirements in the Genie AI interface, I entered This is the source code of a post written with Hexo's Next theme. Please help me generate an English translation version, and the code part does not need to be translated, click the Ask button
    • Change English to the language you want to translate
  3. Genie AI will open a new file and write the translated source code into it

Existing Problems

  • I found that the translation quality of Chinese direct translation into Japanese is not as good as that of Chinese=>English=>Japanese. It may be necessary to use the latter method for subsequent article translations.
  • Sometimes, although ChatGPT is asked to translate English into Japanese, it eventually translates into Chinese.
    • It may be because there are too many words selected. Although the upper limit of the number of words per message for ChatGPT free plan is 2048, if 1800+ words are sent, this problem may occur.
    • This can be avoided by selecting fewer than 1400 characters each time.
    • You can also solve this problem by switching the tab of the menu Temperature to Creative.