mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-01 10:22:30 +02:00
parent
ec9ac8e9fb
commit
181d3d4bf1
10 changed files with 428 additions and 290 deletions
|
@ -210,37 +210,50 @@ CROWDIN_DOCUSAURUS_PROJECT_ID=YOUR_CROWDIN_PROJECT_ID CROWDIN_DOCUSAURUS_API_KEY
|
|||
</blockquote>
|
||||
<h3><a class="anchor" aria-hidden="true" id="automated-file-sync-using-circleci"></a><a href="#automated-file-sync-using-circleci" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Automated File Sync Using CircleCI</h3>
|
||||
<p>You can automate pulling down and uploading translations for your files using the <a href="https://circleci.com">CircleCI</a> web continuous integration service.</p>
|
||||
<p>First, update the <code>circle.yml</code> file in your project directory to include steps to upload English files to be translated and download translated files using the Crowdin CLI. Here is an example <code>circle.yml</code> file:</p>
|
||||
<pre><code class="hljs css language-yaml"><span class="hljs-attr">machine:</span>
|
||||
<span class="hljs-attr"> node:</span>
|
||||
<span class="hljs-attr"> version:</span> <span class="hljs-number">6.10</span><span class="hljs-number">.3</span>
|
||||
<span class="hljs-attr"> npm:</span>
|
||||
<span class="hljs-attr"> version:</span> <span class="hljs-number">3.10</span><span class="hljs-number">.10</span>
|
||||
<p>First, update the <code>.circleci/config.yml</code> file in your project directory to include steps to upload English files to be translated and download translated files using the Crowdin CLI. Here is an example <code>.circleci/config.yml</code> file:</p>
|
||||
<pre><code class="hljs css language-yaml"><span class="hljs-comment"># If you only want circle to run on direct commits to master, you can uncomment this out</span>
|
||||
<span class="hljs-comment"># and uncomment the filters: *filter-only-master down below too</span>
|
||||
<span class="hljs-comment">#</span>
|
||||
<span class="hljs-comment"># aliases:</span>
|
||||
<span class="hljs-comment"># - &filter-only-master</span>
|
||||
<span class="hljs-comment"># branches:</span>
|
||||
<span class="hljs-comment"># only:</span>
|
||||
<span class="hljs-comment"># - master</span>
|
||||
|
||||
<span class="hljs-attr">test:</span>
|
||||
<span class="hljs-attr"> override:</span>
|
||||
<span class="hljs-bullet"> -</span> <span class="hljs-string">"true"</span>
|
||||
<span class="hljs-attr">version:</span> <span class="hljs-number">2</span>
|
||||
<span class="hljs-attr">jobs:</span>
|
||||
<span class="hljs-attr"> deploy-website:</span>
|
||||
<span class="hljs-attr"> docker:</span>
|
||||
<span class="hljs-comment"># specify the version you desire here</span>
|
||||
<span class="hljs-attr"> - image:</span> <span class="hljs-string">circleci/node:8.11.1</span>
|
||||
|
||||
<span class="hljs-attr">deployment:</span>
|
||||
<span class="hljs-attr"> website:</span>
|
||||
<span class="hljs-attr"> branch:</span> <span class="hljs-string">master</span>
|
||||
<span class="hljs-attr"> commands:</span>
|
||||
<span class="hljs-comment"># configure git user</span>
|
||||
<span class="hljs-bullet"> -</span> <span class="hljs-string">git</span> <span class="hljs-string">config</span> <span class="hljs-bullet">--global</span> <span class="hljs-string">user.email</span> <span class="hljs-string">"test-site-bot@users.noreply.github.com"</span>
|
||||
<span class="hljs-bullet"> -</span> <span class="hljs-string">git</span> <span class="hljs-string">config</span> <span class="hljs-bullet">--global</span> <span class="hljs-string">user.name</span> <span class="hljs-string">"Website Deployment Script"</span>
|
||||
<span class="hljs-bullet"> -</span> <span class="hljs-string">echo</span> <span class="hljs-string">"machine github.com login test-site-bot password $GITHUB_TOKEN"</span> <span class="hljs-string">> ~/.netrc
|
||||
# install Docusaurus and generate file of English strings
|
||||
- cd website && npm install && npm run write-translations && cd ..
|
||||
# crowdin install
|
||||
- sudo apt-get install default-jre
|
||||
- wget https://artifacts.crowdin.com/repo/deb/crowdin.deb -O crowdin.deb
|
||||
- sudo dpkg -i crowdin.deb
|
||||
# translations upload/download
|
||||
- crowdin --config crowdin.yaml upload sources --auto-update -b master
|
||||
- crowdin --config crowdin.yaml download -b master
|
||||
# build and publish website
|
||||
- cd website && GIT_USER=test-site-bot npm run publish-gh-pages
|
||||
</span></code></pre>
|
||||
<span class="hljs-attr"> steps:</span>
|
||||
<span class="hljs-bullet"> -</span> <span class="hljs-string">checkout</span>
|
||||
<span class="hljs-attr"> - run:</span>
|
||||
<span class="hljs-attr"> name:</span> <span class="hljs-string">Deploying</span> <span class="hljs-string">to</span> <span class="hljs-string">GitHub</span> <span class="hljs-string">Pages</span>
|
||||
<span class="hljs-attr"> command:</span> <span class="hljs-string">|
|
||||
git config --global user.email "<GITHUB_USERNAME>@users.noreply.github.com"
|
||||
git config --global user.name "<YOUR_NAME>"
|
||||
echo "machine github.com login <GITHUB_USERNAME> password $GITHUB_TOKEN" > ~/.netrc
|
||||
# install Docusaurus and generate file of English strings
|
||||
- cd website && yarn install && yarn run write-translations && cd ..
|
||||
# crowdin install
|
||||
- sudo apt-get install default-jre
|
||||
- wget https://artifacts.crowdin.com/repo/deb/crowdin.deb -O crowdin.deb
|
||||
- sudo dpkg -i crowdin.deb
|
||||
# translations upload/download
|
||||
- crowdin --config crowdin.yaml upload sources --auto-update -b master
|
||||
- crowdin --config crowdin.yaml download -b master
|
||||
# build and publish website
|
||||
cd website && GIT_USER=<GIT_USER> yarn run publish-gh-pages
|
||||
|
||||
</span><span class="hljs-attr">workflows:</span>
|
||||
<span class="hljs-attr"> version:</span> <span class="hljs-number">2</span>
|
||||
<span class="hljs-attr"> build_and_deploy:</span>
|
||||
<span class="hljs-attr"> jobs:</span>
|
||||
<span class="hljs-attr"> - deploy-website:</span>
|
||||
<span class="hljs-comment"># filters: *filter-only-master</span>
|
||||
</code></pre>
|
||||
<p>The <code>crowdin</code> command uses the <code>crowdin.yaml</code> file generated with the <code>examples</code> script. It should be placed in your project directory to configure how and what files are uploaded/downloaded.</p>
|
||||
<p>Note that in the <code>crowdin.yaml</code> file, <code>CROWDIN_PROJECT_ID</code> and <code>CROWDIN_API_KEY</code> are environment variables set-up in Circle for your Crowdin project. They can be found in your Crowdin project settings.</p>
|
||||
<p>Now, Circle will help you automatically get translations prior to building your website. The provided <code>crowdin.yaml</code> file will copy translated documents into <code>website/translated_docs/</code>, and translated versions of the <code>i18n/en.json</code> strings file will into <code>i18n/${language}.json</code>.</p>
|
||||
|
|
|
@ -210,37 +210,50 @@ CROWDIN_DOCUSAURUS_PROJECT_ID=YOUR_CROWDIN_PROJECT_ID CROWDIN_DOCUSAURUS_API_KEY
|
|||
</blockquote>
|
||||
<h3><a class="anchor" aria-hidden="true" id="automated-file-sync-using-circleci"></a><a href="#automated-file-sync-using-circleci" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Automated File Sync Using CircleCI</h3>
|
||||
<p>You can automate pulling down and uploading translations for your files using the <a href="https://circleci.com">CircleCI</a> web continuous integration service.</p>
|
||||
<p>First, update the <code>circle.yml</code> file in your project directory to include steps to upload English files to be translated and download translated files using the Crowdin CLI. Here is an example <code>circle.yml</code> file:</p>
|
||||
<pre><code class="hljs css language-yaml"><span class="hljs-attr">machine:</span>
|
||||
<span class="hljs-attr"> node:</span>
|
||||
<span class="hljs-attr"> version:</span> <span class="hljs-number">6.10</span><span class="hljs-number">.3</span>
|
||||
<span class="hljs-attr"> npm:</span>
|
||||
<span class="hljs-attr"> version:</span> <span class="hljs-number">3.10</span><span class="hljs-number">.10</span>
|
||||
<p>First, update the <code>.circleci/config.yml</code> file in your project directory to include steps to upload English files to be translated and download translated files using the Crowdin CLI. Here is an example <code>.circleci/config.yml</code> file:</p>
|
||||
<pre><code class="hljs css language-yaml"><span class="hljs-comment"># If you only want circle to run on direct commits to master, you can uncomment this out</span>
|
||||
<span class="hljs-comment"># and uncomment the filters: *filter-only-master down below too</span>
|
||||
<span class="hljs-comment">#</span>
|
||||
<span class="hljs-comment"># aliases:</span>
|
||||
<span class="hljs-comment"># - &filter-only-master</span>
|
||||
<span class="hljs-comment"># branches:</span>
|
||||
<span class="hljs-comment"># only:</span>
|
||||
<span class="hljs-comment"># - master</span>
|
||||
|
||||
<span class="hljs-attr">test:</span>
|
||||
<span class="hljs-attr"> override:</span>
|
||||
<span class="hljs-bullet"> -</span> <span class="hljs-string">"true"</span>
|
||||
<span class="hljs-attr">version:</span> <span class="hljs-number">2</span>
|
||||
<span class="hljs-attr">jobs:</span>
|
||||
<span class="hljs-attr"> deploy-website:</span>
|
||||
<span class="hljs-attr"> docker:</span>
|
||||
<span class="hljs-comment"># specify the version you desire here</span>
|
||||
<span class="hljs-attr"> - image:</span> <span class="hljs-string">circleci/node:8.11.1</span>
|
||||
|
||||
<span class="hljs-attr">deployment:</span>
|
||||
<span class="hljs-attr"> website:</span>
|
||||
<span class="hljs-attr"> branch:</span> <span class="hljs-string">master</span>
|
||||
<span class="hljs-attr"> commands:</span>
|
||||
<span class="hljs-comment"># configure git user</span>
|
||||
<span class="hljs-bullet"> -</span> <span class="hljs-string">git</span> <span class="hljs-string">config</span> <span class="hljs-bullet">--global</span> <span class="hljs-string">user.email</span> <span class="hljs-string">"test-site-bot@users.noreply.github.com"</span>
|
||||
<span class="hljs-bullet"> -</span> <span class="hljs-string">git</span> <span class="hljs-string">config</span> <span class="hljs-bullet">--global</span> <span class="hljs-string">user.name</span> <span class="hljs-string">"Website Deployment Script"</span>
|
||||
<span class="hljs-bullet"> -</span> <span class="hljs-string">echo</span> <span class="hljs-string">"machine github.com login test-site-bot password $GITHUB_TOKEN"</span> <span class="hljs-string">> ~/.netrc
|
||||
# install Docusaurus and generate file of English strings
|
||||
- cd website && npm install && npm run write-translations && cd ..
|
||||
# crowdin install
|
||||
- sudo apt-get install default-jre
|
||||
- wget https://artifacts.crowdin.com/repo/deb/crowdin.deb -O crowdin.deb
|
||||
- sudo dpkg -i crowdin.deb
|
||||
# translations upload/download
|
||||
- crowdin --config crowdin.yaml upload sources --auto-update -b master
|
||||
- crowdin --config crowdin.yaml download -b master
|
||||
# build and publish website
|
||||
- cd website && GIT_USER=test-site-bot npm run publish-gh-pages
|
||||
</span></code></pre>
|
||||
<span class="hljs-attr"> steps:</span>
|
||||
<span class="hljs-bullet"> -</span> <span class="hljs-string">checkout</span>
|
||||
<span class="hljs-attr"> - run:</span>
|
||||
<span class="hljs-attr"> name:</span> <span class="hljs-string">Deploying</span> <span class="hljs-string">to</span> <span class="hljs-string">GitHub</span> <span class="hljs-string">Pages</span>
|
||||
<span class="hljs-attr"> command:</span> <span class="hljs-string">|
|
||||
git config --global user.email "<GITHUB_USERNAME>@users.noreply.github.com"
|
||||
git config --global user.name "<YOUR_NAME>"
|
||||
echo "machine github.com login <GITHUB_USERNAME> password $GITHUB_TOKEN" > ~/.netrc
|
||||
# install Docusaurus and generate file of English strings
|
||||
- cd website && yarn install && yarn run write-translations && cd ..
|
||||
# crowdin install
|
||||
- sudo apt-get install default-jre
|
||||
- wget https://artifacts.crowdin.com/repo/deb/crowdin.deb -O crowdin.deb
|
||||
- sudo dpkg -i crowdin.deb
|
||||
# translations upload/download
|
||||
- crowdin --config crowdin.yaml upload sources --auto-update -b master
|
||||
- crowdin --config crowdin.yaml download -b master
|
||||
# build and publish website
|
||||
cd website && GIT_USER=<GIT_USER> yarn run publish-gh-pages
|
||||
|
||||
</span><span class="hljs-attr">workflows:</span>
|
||||
<span class="hljs-attr"> version:</span> <span class="hljs-number">2</span>
|
||||
<span class="hljs-attr"> build_and_deploy:</span>
|
||||
<span class="hljs-attr"> jobs:</span>
|
||||
<span class="hljs-attr"> - deploy-website:</span>
|
||||
<span class="hljs-comment"># filters: *filter-only-master</span>
|
||||
</code></pre>
|
||||
<p>The <code>crowdin</code> command uses the <code>crowdin.yaml</code> file generated with the <code>examples</code> script. It should be placed in your project directory to configure how and what files are uploaded/downloaded.</p>
|
||||
<p>Note that in the <code>crowdin.yaml</code> file, <code>CROWDIN_PROJECT_ID</code> and <code>CROWDIN_API_KEY</code> are environment variables set-up in Circle for your Crowdin project. They can be found in your Crowdin project settings.</p>
|
||||
<p>Now, Circle will help you automatically get translations prior to building your website. The provided <code>crowdin.yaml</code> file will copy translated documents into <code>website/translated_docs/</code>, and translated versions of the <code>i18n/en.json</code> strings file will into <code>i18n/${language}.json</code>.</p>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue