Docusaurus: Runtime error when adding new translation string.

Created on 30 Sep 2017  路  3Comments  路  Source: facebook/docusaurus

Adding a new translation tag like <translate>hello</translate> without running docusaurus-write-translations results in a cryptic runtime error when running docusaurus-start. Would be nice to get explicit instructions on next steps.

TypeError: Cannot read property 'replace' of undefined
    at parseEscapeSequences (/path/to/website/node_modules/docusaurus/lib/server/translate.js:16:10)
    at translate (/path/to/website/node_modules/docusaurus/lib/server/translate.js:32:10)
    at Index.render (/path/to/website/node_modules/docusaurus/lib/pages/en/tempindex.js:204:15)
    at /path/to/website/node_modules/react-dom/lib/ReactCompositeComponent.js:793:21
    at measureLifeCyclePerf (/path/to/website/node_modules/react-dom/lib/ReactCompositeComponent.js:73:12)
    at ReactCompositeComponentWrapper._renderValidatedComponentWithoutOwnerOrContext (/path/to/website/node_modules/react-dom/lib/ReactCompositeComponent.js:792:25)
    at ReactCompositeComponentWrapper._renderValidatedComponent (/path/to/website/node_modules/react-dom/lib/ReactCompositeComponent.js:819:32)
    at ReactCompositeComponentWrapper.performInitialMount (/path/to/website/node_modules/react-dom/lib/ReactCompositeComponent.js:359:30)
    at ReactCompositeComponentWrapper.mountComponent (/path/to/website/node_modules/react-dom/lib/ReactCompositeComponent.js:255:21)
    at Object.mountComponent (/path/to/website/node_modules/react-dom/lib/ReactReconciler.js:43:35)

All 3 comments

Thanks for reporting this. We need a better error message -- and perhaps force running docusaurus-write-translations on each build or server start.

Needing to run write-translations was a small stumbling block early on. Having it run implicitly would be nice!
Though I really love the speed and simplicity of the current sever starting process. It'd be nice if it's kept as fast =)

@chenglou I've further expanded support for strings and docs that may not exist when localization is enabled. https://github.com/facebookexperimental/Docusaurus/pull/151 and https://github.com/facebookexperimental/Docusaurus/pull/148

Was this page helpful?
0 / 5 - 0 ratings

Related issues

slorber picture slorber  路  3Comments

NikitaIT picture NikitaIT  路  3Comments

omry picture omry  路  3Comments

endiliey picture endiliey  路  3Comments

MoogyG picture MoogyG  路  3Comments