Translations and Localization
Docusaurus allows for easy translation functionality using Crowdin. Documentation files written in English are uploaded to Crowdin for translation by users within a community. Top-level pages written with English strings can be translated by wrapping any strings you want to translate in a <translate>
tag. Other titles and labels will also be found and properly translated.
Translations & Localization
Docusaurus allows for easy translation functionality using Crowdin. Documentation files written in English are uploaded to Crowdin for translation by users within a community. Top-level pages written with English strings can be translated by wrapping any strings you want to translate in a <translate>
tag. Other titles and labels will also be found and properly translated.
Docusaurus Translation Configurations
To generate example files for translations with Docusaurus, run the examples
script with the command line argument translations
:
npm run examples translations
@@ -120,8 +120,16 @@ languages.js
If you want to add additional custom translation strings, or override any of the strings that get produced by the script that creates the website/i18n/en.json
file, you can add a website/data/custom-translation-strings.json
file. The file should have form of:
{
"localized-strings": {
- "id": "string",
- "id2": "string2"
+ "docs": {
+ "id": {
+ "title": "string1",
+ "sidebar_label": "string2"
+ },
+ "version-0.0.1-id": {
+ "title": "string3",
+ "sidebar_label": "string4"
+ }
+ }
},
"pages-strings" : {
"id3": "string3",
@@ -270,7 +278,7 @@ CROWDIN_DOCUSAURUS_PROJECT_ID=YOUR_CROWDIN_PROJECT_ID CROWDIN_DOCUSAURUS_API_KEY
languages_mapping: *anchor
Translated, versioned documents will be copied into website/translated_docs/${language}/${version}/
.
-