update website [ci skip]

This commit is contained in:
Facebook GitHub Bot 2017-10-25 02:24:35 +00:00
parent de42cc4e10
commit 240e00e46b

View file

@ -70,8 +70,11 @@ const translate = require("../../server/translate.js").translate;
<p>For other pages, Docusaurus will automatically transform all <code>&lt;translate&gt;</code> tags it finds into function calls that return the translated strings from the corresponding localized file <em><code>locale.json</code></em>.</p>
<h2><a class="anchor" name="crowdin"></a>Crowdin <a class="hash-link" href="#crowdin">#</a></h2>
<p>Crowdin is a company that provides translation services. For Open Source projects, Crowdin provides free string translations</p>
<p>Create your translation project on <a href="https://www.crowdin.com/">Crowdin</a>. You can use <a href="https://support.crowdin.com/translation-process-overview/">Crowdin's guides</a> to learn more about the translations work flow.</p>
<p>Create your translation project on <a href="https://www.crowdin.com/">Crowdin</a>. You can use <a href="https://support.crowdin.com/translation-process-overview/">Crowdin's guides</a> to learn more about the translations work flow. <em>We suggest that you deselect and do not include &quot;English&quot; as a translateable language to prevent the creation of <code>en-US</code> localization files as this can lead to confusion.</em></p>
<p>Your project will need a <code>crowdin.yaml</code> file generated.</p>
<blockquote>
<p>You will need to install <code>crowdin-cli</code>. Please follow the <a href="https://support.crowdin.com/cli-tool/">installation directions</a>.</p>
</blockquote>
<p>The example below can be automatically generated by the docusaurus cli with the <code>examples</code> script. It should be placed in the top level of your project directory to configure how and what files are uploaded/downloaded.</p>
<p>Below is an example crowdin configuration for the respective languages: German, Spanish, French, Japanese, Korean, Behasa Indonesia, Portuguese Brazilian, Chinese Simplified, and Chinese Traditional.</p>
<pre><code class="language-yaml"><span class="hljs-attr">project_identifier_env:</span> <span class="hljs-string">CROWDIN_DOCUSAURUS_PROJECT_ID</span>
@ -95,12 +98,15 @@ const translate = require("../../server/translate.js").translate;
<span class="hljs-attr"> 'zh-CN':</span> <span class="hljs-string">'zh-Hans'</span>
<span class="hljs-attr"> 'zh-TW':</span> <span class="hljs-string">'zh-Hant'</span>
</code></pre>
<p>You can <a href="">go here</a> to learn more about customizing your <code>crowdin.yaml</code> file.</p>
<p>You can go <a href="https://support.crowdin.com/configuration-file/">here</a> to learn more about customizing your <code>crowdin.yaml</code> file.</p>
<h3><a class="anchor" name="manual-file-sync"></a>Manual File Sync <a class="hash-link" href="#manual-file-sync">#</a></h3>
<p>You will want to manually sync your files to and from crowdin. The sync process will upload any markdown files in <code>/docs</code> as well as translatable strings in <code>website/i18n/en.json</code>. (These strings can be generated by running <code>yarn write-translations</code>.)</p>
<p>You can add the following to your <code>package.json</code> to manually trigger crowdin.</p>
<pre><code class="language-json">"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"
},
</code></pre>
<p>These commands require having an environment variable set with your crowdin project id and api key (<code>CROWDIN_PROJECT_ID</code>, <code>CROWDIN_API_KEY</code>). You can add them inline like above or add them permanently to your <code>.bashrc</code> or <code>.bash_profile</code>.</p>