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

Feature/add i18n docs support #51

Closed

Conversation

Bardreamaster
Copy link
Contributor

Type of PR

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (adding a feature following a feature-request issue)
  • Improvement (improving an existing feature - includes style: and perf:commits)
  • Refactor (rewriting existing code without any feature change)
  • (!) This change is or requires a documentation update

Description

I added the docs i18n files refer to the docusaurus i18n doc. With it, we can translate docs using git. It will create a folder contains all i18n files includes docs, theme, plugins..... We only have to initialize the folder and translate the text, then push back.

I have translate two pages for review and test the workflow, which are intro at /zh-Hans/version-2.0.0-beta/ and quick-start at /zh-Hans/version-2.0.0-beta/quick-start .

To view the translation, you only have to build and serve the docs locally.

Although most page looks good, there's still a problem I need help:

As you click the logo on top-left, it will redirect to /version-2.0.0-beta even if you are in zh-Hans page before. It is caused by the home setting in documentation/src/pages/index.js which just redirect the home page by hard code like this:

export default function Home() {
 return <Redirect to="/version-2.0.0-beta" />;
}

So, you cannot jump into a homepage with other language. Please help to fix that. If necessary, I'll put it in issue.

And after checking this i18n related workflow, I could keep translate docs.

Changes

  • Added translations files in /i18n

@starjustice
Copy link
Collaborator

Hey @Bardreamaster, thank you for creating this PR to support multi-language documentation.

However, after I pulled from your branch and tested the documentation, I noticed that it doesn't seem to be working as expected.

image
  1. When I attempt to change the language, the value in the language dropdown does not update.
  2. After clicking on the 'zh-hans' language, it redirects to a 'not found' page.
  3. If you attempt to select the 'zh-hans' language from the dropdown again after being redirected to the 'not found' page, it appends the language to the link, resulting in 'http://localhost:3000/zh-Hans/zh-Hans/version-2.0.0-beta'.
  4. When you are on the 'zh-hans' 'not found' page and attempt to switch to English, it does not redirect to the English version of the documentation.

@Bardreamaster
Copy link
Contributor Author

@starjustice Yes I know there's problem as you see. As the problem I mentioned in the description:

Although most page looks good, there's still a problem I need help: As you click the logo on top-left, it will redirect to /version-2.0.0-beta even if you are in zh-Hans page before. It is caused by the home setting in documentation/src/pages/index.js which just redirect the home page by hard code like this:

It's because when you click zh-Hans option on dropdown tab, there's no avalible route for the main page.

So if you:

  • First, select a specific page which is not the main page. (example: /version-2.0.0-beta/quick-start )
  • Then change to Chinese.
  • You'll see the chinese page for this page.

I'm not sure how docusaurus manage these routings for multi-language pages. That why I ask for help.

Maybe you can try as i say. Thanks.

@starjustice
Copy link
Collaborator

And another comment for this PR.

Could you please change the merge branch from alpha-v2 to v2.0.0-beta?
Starting from now, we will be updating new changes in the v2.0.0-beta branch, and the alpha-v2 branch will be deleted.

@starjustice
Copy link
Collaborator

@starjustice Yes I know there's problem as you see. As the problem I mentioned in the description:

Although most page looks good, there's still a problem I need help: As you click the logo on top-left, it will redirect to /version-2.0.0-beta even if you are in zh-Hans page before. It is caused by the home setting in documentation/src/pages/index.js which just redirect the home page by hard code like this:

It's because when you click zh-Hans option on dropdown tab, there's no avalible route for the main page.

So if you:

  • First, select a specific page which is not the main page. (example: /version-2.0.0-beta/quick-start )
  • Then change to Chinese.
  • You'll see the chinese page for this page.

I'm not sure how docusaurus manage these routings for multi-language pages. That why I ask for help.

Maybe you can try as i say. Thanks.

Hey @Bardreamaster thanks for reply my comment. I have already tried your steps and we will added this in our sprint to be fix

@Bardreamaster Bardreamaster changed the base branch from alpha-v2 to v2.0.0-beta September 18, 2023 04:06
@Bardreamaster
Copy link
Contributor Author

And another comment for this PR.

Could you please change the merge branch from alpha-v2 to v2.0.0-beta? Starting from now, we will be updating new changes in the v2.0.0-beta branch, and the alpha-v2 branch will be deleted.

@starjustice I'v changed. Thanks for reply.

@starjustice
Copy link
Collaborator

Hey @Bardreamaster just want to inform I already made some changes in this PR for page/index.js Maybe you can check and try again after these changes

changes

  • up version docusaurus into 2.4.3
  • adjust path redirect in index.js

@Bardreamaster
Copy link
Contributor Author

@starjustice Thanks for reply and sorry for reply too late.

I've pull the latest update to check if the main page redirect is right. Unfortunately, there are problems:

  • If you visit the path http://127.0.0.1:3000/zh-Hans/version-2.0.0-beta/ directly, it returns 404.
  • If you change the language from English to Chinese while you're on the default main page http://127.0.0.1:3000/version-2.0.0-beta/, it still returns 404.
  • But if you select a random page first like http://127.0.0.1:3000/version-2.0.0-beta/quick-start, then change into Chinese. And select the /Lexicon/introduction tab on sidebar, you can enter the "main page" with browser address bar shows http://127.0.0.1:3000/zh-Hans/version-2.0.0-beta/ which is the same as before.

I'm very confused about it. Hope you can help to solve.

I'll keep translate content while you are fixing it.

@starjustice starjustice deleted the branch lexiconhq:v2.0.0-beta November 2, 2023 10:07
@starjustice starjustice closed this Nov 2, 2023
@starjustice
Copy link
Collaborator

Hey @Bardreamaster, could you please change the target merge branch from v2.0.0-beta to master? This will allow us to reopen this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants