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

AUTOGENERATED_TABLE_OF_CONTENTS does not work with translations #1234

Closed
jakebolam opened this issue Feb 14, 2019 · 11 comments
Closed

AUTOGENERATED_TABLE_OF_CONTENTS does not work with translations #1234

jakebolam opened this issue Feb 14, 2019 · 11 comments
Labels
bug An error in the Docusaurus core causing instability or issues with its execution good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin.

Comments

@jakebolam
Copy link
Contributor

🐛 Bug Report

AUTOGENERATED_TABLE_OF_CONTENTS does not work with translations enabled

Have you read the Contributing Guidelines on issues?

Yes

To Reproduce

  1. Enable translations
  2. Add a doc page with some h3
  3. Add AUTOGENERATED_TABLE_OF_CONTENTS

Expected behavior

Generated for all languages

(Write what you thought would happen.)

Actual Behavior

(Write what happened. Add screenshots, if applicable.)

Reproducible Demo

(Paste the link to an example repo, including a siteConfig.js, and exact instructions to reproduce the issue.)

@jakebolam
Copy link
Contributor Author

On phone will update description when on PC.

Here's an example: https://allcontributors.org/docs/ko/cli/usage#%EC%BD%94%EB%A9%98%EB%93%9C%EB%93%A4

@jakebolam
Copy link
Contributor Author

Reported here all-contributors/all-contributors#196

@jakebolam
Copy link
Contributor Author

Also issue number 1234 🎉

@jakebolam
Copy link
Contributor Author

Looks like insertTOC needs to be called during write-translations, but we can't write back to the same file 🤔

I'm not sure of the best approach here. @yangshun any thoughts?

@endiliey endiliey added the bug An error in the Docusaurus core causing instability or issues with its execution label Mar 16, 2019
@endiliey
Copy link
Contributor

Interesting bug happening on docusaurus own website 😄

image

The cause is due to how crowdin deals with <var> string like <TEST_WORD>, <AUTOTEST_STRING>

<AUTOGENERATED_TABLE_OF_CONTENTS> somehow got transformed into its lowercase part <autogenerated_table_of_contents> and hence https://github.com/facebook/Docusaurus/blob/93e2b7dab3779f22eb08ef4cb8060945bf023945/v1/lib/core/toc.js#L60-L71 fails because it's CASE SENSITIVE

@endiliey endiliey added the good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin. label Mar 16, 2019
@vikrantsinghthakur
Copy link
Contributor

Can I take this up as my first issue if no one else is already working on it?

@endiliey
Copy link
Contributor

@vikrantsinghthakur yes 😄 Will be waiting for your PR

@vikrantsinghthakur
Copy link
Contributor

@endiliey So I was thinking, as a solution for this bug, the insertTOC function should add table for lowercase token too(which we are getting from crowdin) in rawContent. Would that be a correct fix?

@jakebolam
Copy link
Contributor Author

jakebolam commented Mar 19, 2019

@vikrantsinghthakur put up the PR and I can test it? (Can also comment feedback on the PR)

@vikrantsinghthakur
Copy link
Contributor

@jakebolam Thanks, done.

@endiliey
Copy link
Contributor

endiliey commented Mar 20, 2019

This is now fixed on master branch. Unfortunately we're one step too late to release it along v1.7.3

image

Probably v1.7.4 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin.
Projects
None yet
Development

No branches or pull requests

3 participants