lexiconhq / lexicon

Built with Expo, React Native, and GraphQL, Lexicon is a pre-built mobile discussions app that you can customize for your users.
https://lexicon.is
MIT License
177 stars 31 forks source link

Feature/add i18n docs support #51

Closed Bardreamaster closed 8 months ago

Bardreamaster commented 9 months ago

Type of PR

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

starjustice commented 9 months ago

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 commented 9 months ago

@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:

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 commented 9 months ago

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 commented 9 months ago

@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 commented 9 months ago

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 commented 9 months ago

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

Bardreamaster commented 8 months ago

@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:

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

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

starjustice commented 8 months ago

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.