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

Fix sidebar localization #3

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Conversation

kylebuss
Copy link
Contributor

When Notion documents are nested, docu-notion creates a _category_.json file for the dropdown link. However, the translation of the label in this file does not get picked up by Docusaurus.

To resolve this we can run yarn write-translations -- --locale {language code} which will generate files in the i18n folder. The generated files will include current.json in the i18n\{language code}\docusaurus-plugin-content-docs\current. Docusaurus is then able to read the current.json when building and applies the correct translations to the sidebar.

As we do not need to include all the files that are created when running the write-translations command, I've only included the current.json file to the repo. The translations were copied from the _category_.json file or left in English if not translation was complete.

@Nateowami
Copy link
Collaborator

  • There's no need to require yarn when we can just as easily run tasks with npm run
  • Making this a manual step is unsustainable. It should probably be added as a step in pull_docs.sh. If we have to write a simple script that generates these files, so be it.

@kylebuss
Copy link
Contributor Author

I was running into an error when using npm run for the write-translations command, which is why I ended up using yarn.

[ERROR] [Error: ENOENT: no such file or directory, lstat 'C:\Source\scripture-forge-help\de'] { errno: -4058, code: 'ENOENT', syscall: 'lstat', path: 'C:\\Source\\scripture-forge-help\\de' }

I agree that leaving this as a manual step is not the way we want to go. Do we want to add the current.json file to be translated in Crowdin and pull it into the i18n localizations from there?

As a side note, I cannot create a Notion integration to run pull_docs.sh as a guest. Do you have the current token/root page id that can be shared and I can add as a secret locally?

@kylebuss kylebuss force-pushed the fix/sidebar-not-translated branch 2 times, most recently from 885bdb5 to 98960f3 Compare January 31, 2025 16:40
@kylebuss kylebuss force-pushed the fix/sidebar-not-translated branch from 98960f3 to f432866 Compare January 31, 2025 20:36
@kylebuss kylebuss marked this pull request as draft January 31, 2025 20:53
@kylebuss
Copy link
Contributor Author

@Nateowami I was able to figure out how to run it with npm rather than yarn: npm run write-translations -- -- --locale de, however, we shouldn't need to run it for a locale after all.

I've also made some changes based on my proposed Crowdin file structure. The pull_docs.sh will run the write-translations and then copy all the files we want to translate to the crowdin/Guides directory. This should simplify the updating of docs to Crowdin but there would still be the manual step of selecting what part of the docs need translated including the sidebar and footer sections.

Additionally, I've swapped the default for pulling from s3. It made more sense that we should be able to run the command without passing a parameter each time to skip pulling since that appears to be what we are currently defaulting to.

This did end up a bit messy and potentially conflicts with the preview branch so I may still clean it up a bit before it's ready to merge.

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