From 240e00e46bc2ee5d5d0565e3e13df5f83cf5763e Mon Sep 17 00:00:00 2001 From: Facebook GitHub Bot Date: Wed, 25 Oct 2017 02:24:35 +0000 Subject: [PATCH] update website [ci skip] --- docs/en/translation.html | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/en/translation.html b/docs/en/translation.html index 51ac2221b1..a90fbec040 100644 --- a/docs/en/translation.html +++ b/docs/en/translation.html @@ -70,8 +70,11 @@ const translate = require("../../server/translate.js").translate;

For other pages, Docusaurus will automatically transform all <translate> tags it finds into function calls that return the translated strings from the corresponding localized file locale.json.

Crowdin #

Crowdin is a company that provides translation services. For Open Source projects, Crowdin provides free string translations

-

Create your translation project on Crowdin. You can use Crowdin's guides to learn more about the translations work flow.

+

Create your translation project on Crowdin. You can use Crowdin's guides to learn more about the translations work flow. We suggest that you deselect and do not include "English" as a translateable language to prevent the creation of en-US localization files as this can lead to confusion.

Your project will need a crowdin.yaml file generated.

+
+

You will need to install crowdin-cli. Please follow the installation directions.

+

The example below can be automatically generated by the docusaurus cli with the examples script. It should be placed in the top level of your project directory to configure how and what files are uploaded/downloaded.

Below is an example crowdin configuration for the respective languages: German, Spanish, French, Japanese, Korean, Behasa Indonesia, Portuguese Brazilian, Chinese Simplified, and Chinese Traditional.

project_identifier_env: CROWDIN_DOCUSAURUS_PROJECT_ID
@@ -95,12 +98,15 @@ const translate = require("../../server/translate.js").translate;
         'zh-CN': 'zh-Hans'
         'zh-TW': 'zh-Hant'
 
-

You can go here to learn more about customizing your crowdin.yaml file.

+

You can go here to learn more about customizing your crowdin.yaml file.

Manual File Sync #

+

You will want to manually sync your files to and from crowdin. The sync process will upload any markdown files in /docs as well as translatable strings in website/i18n/en.json. (These strings can be generated by running yarn write-translations.)

You can add the following to your package.json to manually trigger crowdin.

"scripts": {
-  "crowdin-upload": "export CROWDIN_DOCUSAURUS_PROJECT_ID=$YOUR_CROWDIN_ID; export CROWDIN_DOCUSAURUS_API_KEY=$YOUR_CROWDIN_API_KEY; crowdin-cli --config ../crowdin.yaml upload sources --auto-update -b master",
-  "crowdin-download": "export CROWDIN_DOCUSAURUS_PROJECT_ID=$YOUR_CROWDIN_ID; export CROWDIN_DOCUSAURUS_API_KEY=$YOUR_CROWDIN_API_KEY; crowdin-cli --config ../crowdin.yaml download -b master"
+  "crowdin-upload": "export CROWDIN_DOCUSAURUS_PROJECT_ID=$YOUR_CROWDIN_ID;
+  export CROWDIN_DOCUSAURUS_API_KEY=$YOUR_CROWDIN_API_KEY; crowdin-cli --config ../crowdin.yaml upload sources --auto-update -b master",
+  "crowdin-download": "export CROWDIN_DOCUSAURUS_PROJECT_ID=$YOUR_CROWDIN_ID;
+  export CROWDIN_DOCUSAURUS_API_KEY=$YOUR_CROWDIN_API_KEY; crowdin-cli --config ../crowdin.yaml download -b master"
 },
 

These commands require having an environment variable set with your crowdin project id and api key (CROWDIN_PROJECT_ID, CROWDIN_API_KEY). You can add them inline like above or add them permanently to your .bashrc or .bash_profile.