Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
726 views
in Technique[技术] by (71.8m points)

docusaurus - 版本化的Docusaurus网站针对其他语言返回404(Versioned Docusaurus site returns 404 for the other languages)

I receive the following error message when I want to navigate to a translated page of a versioned Docusaurus site:

(当我要导航到版本化的Docusaurus网站的翻译页面时,收到以下错误消息:)

Cannot GET /docs/de/...

(无法获取/ docs / de / ...)

I followed all the recommendations there are to find on the docs site.

(我遵循了可在docs网站上找到的所有建议。)

Here is what I have.

(这就是我所拥有的。)

Crowdin.yaml:

(Crowdin.yaml:)

files:
  -
    source: '/docs/**/*.md'
    translation: '/website/translated_docs/%locale%/**/%original_file_name%'    
    languages_mapping: &anchor
      locale:
        'de': 'de'
  -
    source: '/website/i18n/en.json'
    translation: '/website/i18n/%locale%.json'
    languages_mapping: *anchor

  -
    source: '/website/versioned_docs/**/*.md'
    translation: '/website/translated_docs/%locale%/**/%original_file_name%'
    languages_mapping: *anchor

package.json

(package.json)

{
  "main": "main.js",
  "scripts": {
    "examples": "docusaurus-examples",
    "start": "docusaurus-start",
    "build": "docusaurus-build",
    "publish-gh-pages": "docusaurus-publish",
    "write-translations": "docusaurus-write-translations",
    "version": "docusaurus-version",
    "rename-version": "docusaurus-rename-version",
    "crowdin-upload": "crowdin --config ../crowdin.yaml upload sources --auto-update -b master",
    "crowdin-download": "crowdin --config ../crowdin.yaml download -b master",
    "lint": "yarn run markdownlint --config .markdownlint.json ../docs"
  },
  "devDependencies": {
    "docusaurus": "1.13.0",
    "markdownlint-cli": "^0.18.0"
  }
}

versions.json

(版本.json)

[
    "2019.6.0",
    "2019.5.0"
]

After running the commands yarn crowdin-upload and yarn crowdin-download , the translated_docs folder is populated.

(在运行命令yarn crowdin-uploadyarn crowdin-download ,将填充translated_docs文件夹。)

Inside the de subfolder, there are the folders of the docs, including another subdirectory for the version version-2019.6.0 .

(在de子文件夹内,有docs文件夹,包括version-2019.6.0另一个子目录。)

When I run yarn start and switch the language to the other language, the top menu is translated.

(当我运行yarn start并将语言切换为其他语言时,顶层菜单将被翻译。)

However, when I navigate to http://localhost:3000/docs/de/user-manual/user-intro , I get a blank page with the error message "Cannot GET/...".

(但是,当我导航到http://localhost:3000/docs/de/user-manual/user-intro ,我得到了一个空白页,并显示错误消息“ Cannot GET / ...”。)

When I remove the versions.json and versions.js from the project, everything works perfectly.

(当我从项目中删除versions.json和versions.js时,一切工作正常。)

So the issue must be located somewhere in this area.

(因此,问题必须位于该区域的某个位置。)

As far as I know, there is no way of debugging or diagnosing the exact problem.

(据我所知,没有办法调试或诊断确切的问题。)

Which is why I would like to hear who else has had this problem?

(这就是为什么我想听听还有谁遇到这个问题?)

  ask by hbulens translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...