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

Setup i18n for docusaurus #3041

Merged
merged 1 commit into from Feb 26, 2022
Merged

Conversation

Kevan-Y
Copy link
Contributor

@Kevan-Y Kevan-Y commented Feb 24, 2022

Issue This PR Addresses

fixes: #2922

Type of Change

  • Bugfix: Change which fixes an issue
  • New Feature: Change which adds functionality
  • Documentation Update: Change which improves documentation
  • UI: Change which improves UI

Description

Setup i18n for docusaurus, I only put languages that we are going to translate based on the table of this issue #2962

Note: Only the overview page is overwritten, the rest is gonna stay in English

Steps to test the PR

Option 1: Run build

  • cd src/docs
  • pnpm build && pnpm serve

Option 2: Run dev

  • cd src/doc
  • pnpm start -- --locale <LOCAL_CODE> e.g. pnpm start -- --locale fr(For the french version)
2022-02-24.11-36-27.mp4

Checklist

  • Quality: This PR builds and passes our npm test and works locally
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Screenshots: This PR includes screenshots or GIFs of the changes made or an explanation of why it does not (if applicable)
  • Documentation: This PR includes updated/added documentation to user exposed functionality or configuration variables are added/changed or an explanation of why it does not(if applicable)

@gitpod-io
Copy link

gitpod-io bot commented Feb 24, 2022

@Kevan-Y
Copy link
Contributor Author

Kevan-Y commented Feb 24, 2022

To add a new language later, we have to add the LOCAL_CODE in docusaurus.config.js in i18n
Then create your i18n folder.
mkdir -p i18n/<LOCAL_CODE>/docusaurus-plugin-content-docs/current
Then put your translated file in there. I believe it matches the structure of the docs file (where we contain all our original docs )

@Kevan-Y Kevan-Y added the area: docusaurus Anything related to Docusaurus label Feb 24, 2022
@aserputov
Copy link
Contributor

Sounds good for me.

@aserputov aserputov self-requested a review February 24, 2022 17:32
aserputov
aserputov previously approved these changes Feb 24, 2022
tcvan0707
tcvan0707 previously approved these changes Feb 25, 2022
Copy link
Contributor

@tcvan0707 tcvan0707 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally, it worked for me. Later on, we would add the translation version in to the file inside src/docs/i18n, is that correct?

@Kevan-Y
Copy link
Contributor Author

Kevan-Y commented Feb 25, 2022

Tested locally, it worked for me. Later on, we would add the translation version in to the file inside src/docs/i18n, is that correct?

yes, if you looked at the structure there is a folder for each languages we are translating for

DukeManh
DukeManh previously approved these changes Feb 25, 2022
cindyledev
cindyledev previously approved these changes Feb 25, 2022
htmlLang: 'en-CA',
},
fr: {
htmlLang: 'fr-fr',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fr-CA? 🇨🇦

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know about the difference between fr-CA and fr-fr. I'm translating this page, so my French is from France

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kevan-Y what do you mean ? I think it meant to be en-CA, en-FR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aserputov aserputov merged commit 03a6b76 into Seneca-CDOT:master Feb 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: docusaurus Anything related to Docusaurus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Explore supporting different languages for our docs
7 participants