Docusaurus: AUTOGENERATED_TABLE_OF_CONTENTS does not work with translations

Created on 14 Feb 2019  路  11Comments  路  Source: facebook/docusaurus

馃悰 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.)

bug good first issue

All 11 comments

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

Also issue number 1234 :tada:

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?

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

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

@vikrantsinghthakur yes 馃槃 Will be waiting for your PR

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

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

@jakebolam Thanks, done.

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 !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

itelofilho picture itelofilho  路  3Comments

awibox picture awibox  路  3Comments

rickyvetter picture rickyvetter  路  3Comments

endiliey picture endiliey  路  3Comments

MoogyG picture MoogyG  路  3Comments