mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 23:57:22 +02:00
331 lines
No EOL
48 KiB
HTML
331 lines
No EOL
48 KiB
HTML
<!DOCTYPE html><html lang="fr"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Translations & Localization · Docusaurus</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="Docusaurus propose une fonctionnalité de traduction facile en utilisant [Crowdin](https://crowdin.com/). Les fichiers de documentation écrits en anglais sont envoyés à Crowdin pour une traduction par les utilisateurs au sein d’une communauté. Les pages de haut niveau écrites avec des chaînes anglaises peuvent être traduites en enregistrant toutes les chaînes que vous souhaitez traduire dans une balise `<translate>` . D'autres titres et étiquettes seront également trouvés et correctement traduits."/><meta name="docsearch:version" content="1.12.0"/><meta name="docsearch:language" content="fr"/><meta property="og:title" content="Translations & Localization · Docusaurus"/><meta property="og:type" content="website"/><meta property="og:url" content="https://docusaurus.io/"/><meta property="og:description" content="Docusaurus propose une fonctionnalité de traduction facile en utilisant [Crowdin](https://crowdin.com/). Les fichiers de documentation écrits en anglais sont envoyés à Crowdin pour une traduction par les utilisateurs au sein d’une communauté. Les pages de haut niveau écrites avec des chaînes anglaises peuvent être traduites en enregistrant toutes les chaînes que vous souhaitez traduire dans une balise `<translate>` . D'autres titres et étiquettes seront également trouvés et correctement traduits."/><meta property="og:image" content="https://docusaurus.io/img/docusaurus.png"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://docusaurus.io/img/docusaurus.png"/><link rel="shortcut icon" href="/img/docusaurus.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://docusaurus.io/blog/atom.xml" title="Docusaurus Blog ATOM Feed"/><link rel="alternate" type="application/rss+xml" href="https://docusaurus.io/blog/feed.xml" title="Docusaurus Blog RSS Feed"/><script>
|
||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
||
|
||
ga('create', 'UA-44373548-31', 'auto');
|
||
ga('send', 'pageview');
|
||
</script><script type="text/javascript" src="https://buttons.github.io/buttons.js"></script><script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js"></script><script type="text/javascript" src="/js/code-blocks-buttons.js"></script><script src="https://unpkg.com/vanilla-back-to-top@7.1.14/dist/vanilla-back-to-top.min.js"></script><script>
|
||
document.addEventListener('DOMContentLoaded', function() {
|
||
addBackToTop(
|
||
{"zIndex":100}
|
||
)
|
||
});
|
||
</script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/prism.css"/><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/fr"><img class="logo" src="/img/docusaurus.svg" alt="Docusaurus"/><h2 class="headerTitleWithLogo">Docusaurus</h2></a><a href="/fr/versions"><h3>1.12.0</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-site-internal"><li class="siteNavGroupActive"><a href="/docs/fr/1.12.0/installation" target="_self">Documentations</a></li><li class=""><a href="/docs/fr/1.12.0/tutorial-setup" target="_self">Tutoriel</a></li><li class=""><a href="/fr/users" target="_self">Utilisateurs</a></li><li class=""><a href="/blog/" target="_self">Blog</a></li><li class=""><a href="https://github.com/facebook/docusaurus" target="_blank">GitHub</a></li><span><li><a id="languages-menu" href="#"><img class="languages-icon" src="/img/language.svg" alt="Languages icon"/>Français</a><div id="languages-dropdown" class="hide"><ul id="languages-dropdown-items"><li><a href="/docs/en/1.12.0/translation">English</a></li><li><a href="/docs/ko/1.12.0/translation">한국어</a></li><li><a href="/docs/pt-BR/1.12.0/translation">Português (Brasil)</a></li><li><a href="/docs/ro/1.12.0/translation">Română</a></li><li><a href="/docs/ru/1.12.0/translation">Русский</a></li><li><a href="/docs/zh-CN/1.12.0/translation">简体中文</a></li><li><a href="https://crowdin.com/project/docusaurus" target="_blank" rel="noreferrer noopener">Aidez-nous à traduire</a></li></ul></div></li><script>
|
||
const languagesMenuItem = document.getElementById("languages-menu");
|
||
const languagesDropDown = document.getElementById("languages-dropdown");
|
||
languagesMenuItem.addEventListener("click", function(event) {
|
||
event.preventDefault();
|
||
|
||
if (languagesDropDown.className == "hide") {
|
||
languagesDropDown.className = "visible";
|
||
} else {
|
||
languagesDropDown.className = "hide";
|
||
}
|
||
});
|
||
</script></span><li class="navSearchWrapper reactNavSearchWrapper"><input type="text" id="search_input_react" placeholder="Search" title="Search"/></li></ul></nav></div></header></div></div><div class="navPusher"><div class="docMainWrapper wrapper"><div class="docsNavContainer" id="docsNav"><nav class="toc"><div class="toggleNav"><section class="navWrapper wrapper"><div class="navBreadcrumb wrapper"><div class="navToggle" id="navToggler"><div class="hamburger-menu"><div class="line1"></div><div class="line2"></div><div class="line3"></div></div></div><h2><i>›</i><span>Guides</span></h2><div class="tocToggler" id="tocToggler"><i class="icon-toc"></i></div></div><div class="navGroups"><div class="navGroup"><h3 class="navGroupCategoryTitle collapsible">Premiers pas<span class="arrow"><svg width="24" height="24" viewBox="0 0 24 24"><path fill="#565656" d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"></path><path d="M0 0h24v24H0z" fill="none"></path></svg></span></h3><ul class="hide"><li class="navListItem"><a class="navItem" href="/docs/fr/1.12.0/installation">Installation</a></li><li class="navListItem"><a class="navItem" href="/docs/fr/1.12.0/site-preparation">Site Preparation</a></li><li class="navListItem"><a class="navItem" href="/docs/fr/1.12.0/site-creation">Creating your site</a></li><li class="navListItem"><a class="navItem" href="/docs/fr/1.12.0/publishing">Publishing your site</a></li><li class="navListItem"><a class="navItem" href="/docs/fr/1.12.0/docker">Docker</a></li></ul></div><div class="navGroup"><h3 class="navGroupCategoryTitle collapsible">Guides<span class="arrow"><svg width="24" height="24" viewBox="0 0 24 24"><path fill="#565656" d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"></path><path d="M0 0h24v24H0z" fill="none"></path></svg></span></h3><ul class="hide"><li class="navListItem"><a class="navItem" href="/docs/fr/1.12.0/adding-blog">Adding a Blog</a></li><li class="navListItem"><a class="navItem" href="/docs/fr/1.12.0/custom-pages">Custom Pages</a></li><li class="navListItem"><a class="navItem" href="/docs/fr/1.12.0/search">Enabling Search</a></li><li class="navListItem"><a class="navItem" href="/docs/fr/1.12.0/navigation">Navigation and Sidebars</a></li><li class="navListItem navListItemActive"><a class="navItem" href="/docs/fr/1.12.0/translation">Translations & Localization</a></li><li class="navListItem"><a class="navItem" href="/docs/fr/1.12.0/versioning">Versioning</a></li></ul></div><div class="navGroup"><h3 class="navGroupCategoryTitle collapsible">API<span class="arrow"><svg width="24" height="24" viewBox="0 0 24 24"><path fill="#565656" d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"></path><path d="M0 0h24v24H0z" fill="none"></path></svg></span></h3><ul class="hide"><li class="navListItem"><a class="navItem" href="/docs/fr/1.12.0/commands">CLI Commands</a></li><li class="navListItem"><a class="navItem" href="/docs/fr/1.12.0/doc-markdown">Markdown Features</a></li><li class="navListItem"><a class="navItem" href="/docs/fr/1.12.0/api-pages">Pages and Styles</a></li><li class="navListItem"><a class="navItem" href="/docs/fr/1.12.0/site-config">siteConfig.js</a></li></ul></div></div></section></div><script>
|
||
var coll = document.getElementsByClassName('collapsible');
|
||
var checkActiveCategory = true;
|
||
for (var i = 0; i < coll.length; i++) {
|
||
var links = coll[i].nextElementSibling.getElementsByTagName('*');
|
||
if (checkActiveCategory){
|
||
for (var j = 0; j < links.length; j++) {
|
||
if (links[j].classList.contains('navListItemActive')){
|
||
coll[i].nextElementSibling.classList.toggle('hide');
|
||
coll[i].childNodes[1].classList.toggle('rotate');
|
||
checkActiveCategory = false;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
coll[i].addEventListener('click', function() {
|
||
var arrow = this.childNodes[1];
|
||
arrow.classList.toggle('rotate');
|
||
var content = this.nextElementSibling;
|
||
content.classList.toggle('hide');
|
||
});
|
||
}
|
||
|
||
document.addEventListener('DOMContentLoaded', function() {
|
||
createToggler('#navToggler', '#docsNav', 'docsSliderActive');
|
||
createToggler('#tocToggler', 'body', 'tocActive');
|
||
|
||
var headings = document.querySelector('.toc-headings');
|
||
headings && headings.addEventListener('click', function(event) {
|
||
var el = event.target;
|
||
while(el !== headings){
|
||
if (el.tagName === 'A') {
|
||
document.body.classList.remove('tocActive');
|
||
break;
|
||
} else{
|
||
el = el.parentNode;
|
||
}
|
||
}
|
||
}, false);
|
||
|
||
function createToggler(togglerSelector, targetSelector, className) {
|
||
var toggler = document.querySelector(togglerSelector);
|
||
var target = document.querySelector(targetSelector);
|
||
|
||
if (!toggler) {
|
||
return;
|
||
}
|
||
|
||
toggler.onclick = function(event) {
|
||
event.preventDefault();
|
||
|
||
target.classList.toggle(className);
|
||
};
|
||
}
|
||
});
|
||
</script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/docusaurus/fr" target="_blank" rel="noreferrer noopener">Translate</a><h1 id="__docusaurus" class="postHeaderTitle">Translations & Localization</h1></header><article><div><span><p>Docusaurus propose une fonctionnalité de traduction facile en utilisant <a href="https://crowdin.com/">Crowdin</a>. Les fichiers de documentation écrits en anglais sont envoyés à Crowdin pour une traduction par les utilisateurs au sein d’une communauté. Les pages de haut niveau écrites avec des chaînes anglaises peuvent être traduites en enregistrant toutes les chaînes que vous souhaitez traduire dans une balise <code><translate></code> . D'autres titres et étiquettes seront également trouvés et correctement traduits.</p>
|
||
<h2><a class="anchor" aria-hidden="true" id="configurations-de-traduction-de-docusaurus"></a><a href="#configurations-de-traduction-de-docusaurus" 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>Configurations de traduction de Docusaurus</h2>
|
||
<p>Pour générer des fichiers d'exemple pour les traductions avec Docusaurus, exécutez le script <code>examples</code> avec l'argument de la ligne de commande <code>translations</code> :</p>
|
||
<pre><code class="hljs css language-bash">npm run examples translations
|
||
</code></pre>
|
||
<p>ou</p>
|
||
<pre><code class="hljs css language-bash">yarn examples translations
|
||
</code></pre>
|
||
<p>Ceci créera les fichiers suivants :</p>
|
||
<pre><code class="hljs css language-bash">pages/en/<span class="hljs-built_in">help</span>-with-translations.js
|
||
languages.js
|
||
../crowdin.yaml
|
||
</code></pre>
|
||
<ul>
|
||
<li>Le fichier <code>pages/en/help-with-translations.js</code> inclut la même page d'aide de démarrage générée par le script <code>examples</code> mais inclut maintenant les balises de traduction.</li>
|
||
</ul>
|
||
<blockquote>
|
||
<p>Généralement, vous utiliserez <code>help-with-translations.js</code> comme guide pour activer les traductions dans vos autres pages, mais vous ne livrerez pas réellement le fichier à votre dépôt (c'est-à-dire que vous pourrez le supprimer). Cependant, si vous voulez une page d'Aide, et que vous n'en avez pas, vous pouvez renommer ce fichier en <code>help.js</code> et l'utiliser comme point de départ.</p>
|
||
</blockquote>
|
||
<ul>
|
||
<li><p>Le fichier <code>languages.js</code> indique à Docusaurus quelles langues vous souhaitez activer pour votre site. Par défaut, nous espérons que l'anglais sera activé.</p></li>
|
||
<li><p>Le fichier <code>crowdin.yaml</code> est utilisé pour configurer l'intégration de Crowdin et est copié d'un niveau vers le haut dans le dépôt de votre projet Docusaurus. Si votre projet Docusaurus réside dans <code>/project/website</code>, alors <code>crowdin.yaml</code> sera copié dans <code>/project/crowdin.yaml</code>.</p></li>
|
||
</ul>
|
||
<h2><a class="anchor" aria-hidden="true" id="traduire-vos-docs-existantes"></a><a href="#traduire-vos-docs-existantes" 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>Traduire vos docs existantes</h2>
|
||
<p>Vos fichiers de documentation (par exemple les fichiers <code>.md</code> qui vivent dans votre répertoire <code>docs</code>) ne doivent pas être modifiés ou déplacés pour supporter les traductions. Ils seront envoyés à Crowdin pour être traduits directement.</p>
|
||
<h2><a class="anchor" aria-hidden="true" id="activer-les-traductions-sur-les-pages"></a><a href="#activer-les-traductions-sur-les-pages" 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>Activer les traductions sur les pages</h2>
|
||
<p>Les pages vous permettent de personnaliser la mise en page et le contenu spécifique des pages comme une page d'index personnalisée ou une page d'aide.</p>
|
||
<p>Les pages avec du texte que vous souhaitez traduire doivent être placées dans le répertoire <code>site/pages/en</code> .</p>
|
||
<p>Enveloppez les chaînes de caractères que vous voulez traduire dans une balise <code><translate></code>, et ajoutez l'instruction suivante <code>require</code> en haut du fichier :</p>
|
||
<pre><code class="hljs css language-jsx"><span class="token operator">...</span>
|
||
<span class="token keyword">const</span> translate <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">'../../server/translate.js'</span><span class="token punctuation">)</span><span class="token punctuation">.</span>translate<span class="token punctuation">;</span>
|
||
<span class="token operator">...</span>
|
||
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>h2</span><span class="token punctuation">></span></span><span class="token plain-text">
|
||
</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>translate</span><span class="token punctuation">></span></span><span class="token plain-text">Cette entête sera traduite</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>translate</span><span class="token punctuation">></span></span><span class="token plain-text">
|
||
</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>h2</span><span class="token punctuation">></span></span>
|
||
<span class="token operator">...</span>
|
||
</code></pre>
|
||
<p>Vous pouvez également inclure un attribut de description facultatif pour donner plus de contexte à un traducteur sur la façon de traduire la chaîne :</p>
|
||
<pre><code class="hljs css language-jsx"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>p</span><span class="token punctuation">></span></span><span class="token plain-text">
|
||
</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>translate</span> <span class="token attr-name">desc</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>flower, not verb<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token plain-text">Rose</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>translate</span><span class="token punctuation">></span></span><span class="token plain-text">
|
||
</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>p</span><span class="token punctuation">></span></span><span class="token plain-text">
|
||
</span></code></pre>
|
||
<blockquote>
|
||
<p>La balise <code><translate></code> fonctionne généralement bien sur des chaînes de caractères pures. Si vous avez une chaîne comme "Docusaurus fournit actuellement un support pour aider votre site à utiliser <a href="${siteConfig.baseUrl}${siteConfig.docsUrl}/${this.props.language}/translation.html">translations</a>", encapsuler la balise <code><translation></code> autour de cette chaîne entière causera des problèmes à cause du lien markdown, etc. Vos possibilités sont de ne pas traduire ces chaînes de caractères, ou de disséminer un tas de balises <code><translate></code> parmi les chaînes de caractères pures de cette chaîne.</p>
|
||
</blockquote>
|
||
<h2><a class="anchor" aria-hidden="true" id="collecter-des-chaînes-à-traduire"></a><a href="#collecter-des-chaînes-à-traduire" 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>Collecter des chaînes à traduire</h2>
|
||
<p>Les chaînes dans les pages à traduire doivent être extraites et fournies à Crowdin.</p>
|
||
<p>Ajoutez le script suivant à votre fichier <code>website/package.json</code> s'il n'existe pas déjà :</p>
|
||
<pre><code class="hljs css language-js">{
|
||
...
|
||
<span class="hljs-string">"scripts"</span>: {
|
||
<span class="hljs-string">"write-translations"</span>: <span class="hljs-string">"docusaurus-write-translations"</span>
|
||
},
|
||
...
|
||
}
|
||
</code></pre>
|
||
<p>L'exécution du script générera un fichier <code>website/i18n/fr.json</code> contenant toutes les chaînes qui seront traduites de l'anglais dans d'autres langues.</p>
|
||
<p>Le script comprendra du texte provenant des endroits suivants :</p>
|
||
<ul>
|
||
<li>Les chaînes <code>title</code> et <code>sidebar_label</code> dans les entêtes du document markdown</li>
|
||
<li>Les noms des catégories dans <code>sidebars.json</code></li>
|
||
<li>tagline dans <code>siteConfig.js</code></li>
|
||
<li>Les chaînes <code>label</code> de headerLinks dans <code>siteConfig.js</code></li>
|
||
<li>Les chaînes enveloppées dans la balise <code><translate></code> dans tous les fichiers <code>.js</code> dans <code>pages</code></li>
|
||
</ul>
|
||
<h3><a class="anchor" aria-hidden="true" id="chaînes-de-traduction-personnalisées"></a><a href="#chaînes-de-traduction-personnalisées" 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>Chaînes de traduction personnalisées</h3>
|
||
<p>Si vous voulez ajouter des chaînes de traduction personnalisées supplémentaires ou remplacer l'une des chaînes qui sont produites par le script qui crée le fichier <code>website/i18n/en.json</code>, vous pouvez ajouter un fichier <code>website/data/custom-translation-strings.json</code> . Le fichier doit être sous la forme :</p>
|
||
<pre><code class="hljs css language-json">{
|
||
<span class="hljs-attr">"localized-strings"</span>: {
|
||
<span class="hljs-attr">"docs"</span>: {
|
||
<span class="hljs-attr">"id"</span>: {
|
||
<span class="hljs-attr">"title"</span>: <span class="hljs-string">"string1"</span>,
|
||
<span class="hljs-attr">"sidebar_label"</span>: <span class="hljs-string">"string2"</span>
|
||
},
|
||
<span class="hljs-attr">"version-0.0.1-id"</span>: {
|
||
<span class="hljs-attr">"title"</span>: <span class="hljs-string">"string3"</span>,
|
||
<span class="hljs-attr">"sidebar_label"</span>: <span class="hljs-string">"string4"</span>
|
||
}
|
||
}
|
||
},
|
||
<span class="hljs-attr">"pages-strings"</span>: {
|
||
<span class="hljs-attr">"id3"</span>: <span class="hljs-string">"string3"</span>,
|
||
<span class="hljs-attr">"id4"</span>: <span class="hljs-string">"string4"</span>
|
||
}
|
||
}
|
||
</code></pre>
|
||
<p>où <code>localized-strings</code> représentent des chaînes de caractères dans le contenu de votre documentation et <code>pages-strings</code> représente des métadonnées dans votre documentation (par exemple, titre, liens, etc.).</p>
|
||
<p>Voici un exemple :</p>
|
||
<pre><code class="hljs css language-json">{
|
||
<span class="hljs-attr">"_comment"</span>: <span class="hljs-string">"Ce fichier est utilisé pour fournir des chaînes personnalisées pour les traductions, y compris en supportant les valeurs par défaut"</span>,
|
||
<span class="hljs-attr">"localized-strings"</span>: {
|
||
<span class="hljs-attr">"traduction"</span>: <span class="hljs-string">"Traductions et localisation"</span>
|
||
},
|
||
<span class="hljs-attr">"pages-strings"</span>: {
|
||
<span class="hljs-attr">"Aidez à traduire|recrutez des traducteurs de la communauté pour votre projet"</span>: <span class="hljs-string">"Aidez-nous à traduire"</span>
|
||
}
|
||
}
|
||
</code></pre>
|
||
<p>Voir le <code>website/i18n/en.json</code> généré pour exemple.</p>
|
||
<h2><a class="anchor" aria-hidden="true" id="comment-les-chaînes-de-caractères-sont-traduites"></a><a href="#comment-les-chaînes-de-caractères-sont-traduites" 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>Comment les chaînes de caractères sont traduites</h2>
|
||
<p>Docusaurus lui-même ne fait aucune traduction d'une langue à une autre. Au lieu de cela, il intègre <a href="https://crowdin.com/">Crowdin</a> pour télécharger les traductions et ensuite extraire les fichiers correctement traduits à partir de Crowdin.</p>
|
||
<h2><a class="anchor" aria-hidden="true" id="comment-docusaurus-utilise-les-traductions-de-chaînes-de-caractères"></a><a href="#comment-docusaurus-utilise-les-traductions-de-chaînes-de-caractères" 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>Comment Docusaurus utilise les traductions de chaînes de caractères</h2>
|
||
<p>This section provides context about how translations in Docusaurus works.</p>
|
||
<h3><a class="anchor" aria-hidden="true" id="strings"></a><a href="#strings" 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>Strings</h3>
|
||
<p>A Docusaurus site has many strings used throughout it that require localization. However, maintaining a list of strings used throughout a site can be laborious. Docusaurus simplifies this by centralizing strings.</p>
|
||
<p>The header navigation, for example, can have links to 'Home' or your 'Blog'. This and other strings found in the headers and sidebars of pages are extracted and placed into <code>i18n/en.json</code>. When your files are translated, say into Spanish, an <code>i18n/es-ES.json</code> file will be downloaded from Crowdin. Then, when the Spanish pages are generated, Docusaurus will replace the English version of corresponding strings with translated strings from the corresponding localized strings file (e.g. In a Spanish enabled site 'Help' will become 'Ayuda').</p>
|
||
<h3><a class="anchor" aria-hidden="true" id="markdown-files"></a><a href="#markdown-files" 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>Markdown Files</h3>
|
||
<p>For documentation files themselves, translated versions of these files are downloaded and then rendered through the proper layout template.</p>
|
||
<h3><a class="anchor" aria-hidden="true" id="other-pages"></a><a href="#other-pages" 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>Other Pages</h3>
|
||
<p>For other pages, Docusaurus will automatically transform all <code><translate></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" aria-hidden="true" id="crowdin"></a><a href="#crowdin" 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>Crowdin</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://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 "English" as a translatable language to prevent the creation of <code>en-US</code> localization files as this can lead to confusion.</em></p>
|
||
<blockquote>
|
||
<p>Ensure in your Crowdin settings, in the Translations section, that "Duplicate Strings" are set to <a href="https://support.crowdin.com/api/create-project/">"Hide - all duplicates will share the same translation"</a>. This setting will ensure that identical strings between versions share a single translation.</p>
|
||
</blockquote>
|
||
<p>Your project will need a <code>crowdin.yaml</code> file generated. If you ran <code>yarn examples translations</code> or <code>npm run examples translations</code>, this file was created for you on the same level as your <code>website</code> directory.</p>
|
||
<blockquote>
|
||
<p>You will need to install the <code>crowdin</code> command line interface. 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, Bahasa Indonesia, Portuguese Brazilian, Chinese Simplified, and Chinese Traditional.</p>
|
||
<pre><code class="hljs css language-yaml"><span class="hljs-attr">project_identifier_env:</span> <span class="hljs-string">CROWDIN_DOCUSAURUS_PROJECT_ID</span>
|
||
<span class="hljs-attr">api_key_env:</span> <span class="hljs-string">CROWDIN_DOCUSAURUS_API_KEY</span>
|
||
<span class="hljs-attr">base_path:</span> <span class="hljs-string">'./'</span>
|
||
<span class="hljs-attr">preserve_hierarchy:</span> <span class="hljs-literal">true</span>
|
||
|
||
<span class="hljs-attr">files:</span>
|
||
|
||
<span class="hljs-bullet">-</span> <span class="hljs-attr">source:</span> <span class="hljs-string">'/docs/**/*.md'</span>
|
||
<span class="hljs-attr">translation:</span> <span class="hljs-string">'/website/translated_docs/%locale%/**/%original_file_name%'</span>
|
||
<span class="hljs-attr">languages_mapping:</span> <span class="hljs-meta">&anchor</span>
|
||
<span class="hljs-attr">locale:</span>
|
||
<span class="hljs-attr">'de':</span> <span class="hljs-string">'de'</span>
|
||
<span class="hljs-attr">'es-ES':</span> <span class="hljs-string">'es-ES'</span>
|
||
<span class="hljs-attr">'fr':</span> <span class="hljs-string">'fr'</span>
|
||
<span class="hljs-attr">'ja':</span> <span class="hljs-string">'ja'</span>
|
||
<span class="hljs-attr">'ko':</span> <span class="hljs-string">'ko'</span>
|
||
<span class="hljs-attr">'mr':</span> <span class="hljs-string">'mr-IN'</span>
|
||
<span class="hljs-attr">'pt-BR':</span> <span class="hljs-string">'pt-BR'</span>
|
||
<span class="hljs-attr">'zh-CN':</span> <span class="hljs-string">'zh-CN'</span>
|
||
<span class="hljs-attr">'zh-TW':</span> <span class="hljs-string">'zh-TW'</span>
|
||
</code></pre>
|
||
<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" aria-hidden="true" id="setup-the-crowdin-scripts"></a><a href="#setup-the-crowdin-scripts" 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>Setup the Crowdin Scripts</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="hljs css language-js"><span class="hljs-string">"scripts"</span>: {
|
||
<span class="hljs-string">"crowdin-upload"</span>: <span class="hljs-string">"crowdin --config ../crowdin.yaml upload sources --auto-update -b master"</span>,
|
||
<span class="hljs-string">"crowdin-download"</span>: <span class="hljs-string">"crowdin --config ../crowdin.yaml download -b master"</span>
|
||
},
|
||
</code></pre>
|
||
<h3><a class="anchor" aria-hidden="true" id="manual-file-sync"></a><a href="#manual-file-sync" 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>Manual File Sync</h3>
|
||
<p>You will always want to upload your markdown files and translatable strings first and the download the translations section. So run the commands in this order:</p>
|
||
<pre><code class="hljs css language-bash">CROWDIN_DOCUSAURUS_PROJECT_ID=YOUR_CROWDIN_PROJECT_ID CROWDIN_DOCUSAURUS_API_KEY=YOUR_CROWDIN_API_KEY yarn run crowdin-upload
|
||
CROWDIN_DOCUSAURUS_PROJECT_ID=YOUR_CROWDIN_PROJECT_ID CROWDIN_DOCUSAURUS_API_KEY=YOUR_CROWDIN_API_KEY yarn run crowdin-download
|
||
</code></pre>
|
||
<blockquote>
|
||
<p><code>YOUR_CROWDIN_PROJECT_ID</code> is the name of your Crowdin project. e.g., for <a href="https://crowdin.com/project/docusaurus/">https://crowdin.com/project/docusaurus/</a>, that variable would be set to <code>docusaurus</code>. <code>YOUR_CROWDIN_API_KEY</code> is a unique key that is like a password. You can find it in the <code>API</code> tab of your Crowdin project's <code>Settings</code>.</p>
|
||
<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 preface them inline as done above or add them permanently to your <code>.bashrc</code> or <code>.bash_profile</code>.</p>
|
||
<p>If you run more than one localized Docusaurus project on your computer, you should change the name of the environment variables to something unique (<code>CROWDIN_PROJECTNAME_PROJECT_ID</code>, <code>CROWDIN_PROJECTNAME_API_KEY</code>).</p>
|
||
<p>Since the files are generated, you do not need to have any files in your <code>website/i18n</code> or <code>website/translated_docs</code> directory as part of your repo. So you can can add <code>website/i18n/*</code> and <code>website/translated_docs</code> to your <code>.gitignore</code> file.</p>
|
||
</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>.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">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-bullet">-</span> <span class="hljs-attr">image:</span> <span class="hljs-string">circleci/node:8.11.1</span>
|
||
|
||
<span class="hljs-attr">steps:</span>
|
||
|
||
<span class="hljs-bullet">-</span> <span class="hljs-string">checkout</span>
|
||
<span class="hljs-bullet">-</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-bullet">-</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>
|
||
<p>If you wish to use Crowdin on your machine locally, you can install the <a href="https://support.crowdin.com/cli-tool/">Crowdin CLI tool</a> and run the same commands found in the <code>circle.yaml</code> file. The only difference is that you must set <code>project_identifier</code> and <code>api_key</code> values in the <code>crowdin.yaml</code> file since you will not have Circle environment variables set up.</p>
|
||
<h2><a class="anchor" aria-hidden="true" id="versioned-translations"></a><a href="#versioned-translations" 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>Versioned Translations</h2>
|
||
<p>If you wish to have translation and versioning for your documentation, add the following section to the end of your <code>crowdin.yaml</code> file:</p>
|
||
<pre><code class="hljs css language-yaml"> <span class="hljs-bullet">-</span>
|
||
<span class="hljs-attr">source:</span> <span class="hljs-string">'/website/versioned_docs/**/*.md'</span>
|
||
<span class="hljs-attr">translation:</span> <span class="hljs-string">'/website/translated_docs/%locale%/**/%original_file_name%'</span>
|
||
<span class="hljs-attr">languages_mapping:</span> <span class="hljs-meta">*anchor</span>
|
||
</code></pre>
|
||
<p>Translated, versioned documents will be copied into <code>website/translated_docs/${language}/${version}/</code>.</p>
|
||
</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/fr/1.12.0/navigation"><span class="arrow-prev">← </span><span>Navigation et Barre latérale</span></a><a class="docs-next button" href="/docs/fr/1.12.0/versioning"><span>Gestion de version</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#configurations-de-traduction-de-docusaurus">Configurations de traduction de Docusaurus</a></li><li><a href="#traduire-vos-docs-existantes">Traduire vos docs existantes</a></li><li><a href="#activer-les-traductions-sur-les-pages">Activer les traductions sur les pages</a></li><li><a href="#collecter-des-chaînes-à-traduire">Collecter des chaînes à traduire</a><ul class="toc-headings"><li><a href="#chaînes-de-traduction-personnalisées">Chaînes de traduction personnalisées</a></li></ul></li><li><a href="#comment-les-chaînes-de-caractères-sont-traduites">Comment les chaînes de caractères sont traduites</a></li><li><a href="#comment-docusaurus-utilise-les-traductions-de-chaînes-de-caractères">Comment Docusaurus utilise les traductions de chaînes de caractères</a><ul class="toc-headings"><li><a href="#strings">Strings</a></li><li><a href="#markdown-files">Markdown Files</a></li><li><a href="#other-pages">Other Pages</a></li></ul></li><li><a href="#crowdin">Crowdin</a><ul class="toc-headings"><li><a href="#setup-the-crowdin-scripts">Setup the Crowdin Scripts</a></li><li><a href="#manual-file-sync">Manual File Sync</a></li><li><a href="#automated-file-sync-using-circleci">Automated File Sync Using CircleCI</a></li></ul></li><li><a href="#versioned-translations">Versioned Translations</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/docusaurus_monochrome.svg" alt="Docusaurus" width="66" height="58"/></a><div class="footerSection"><h5>Docs</h5><a href="
|
||
/docs/fr/installation">Getting Started</a><a href="
|
||
/docs/fr/versioning">Versioning</a><a href="
|
||
/docs/fr/translation">Localization</a><a href="
|
||
/docs/fr/search">Adding Search</a></div><div class="footerSection"><h5>Community</h5><a href="/fr/help">Help</a><a href="/fr/users">User Showcase</a><a href="/fr/about-slash">About</a></div><div class="footerSection"><h5>Legal</h5><a href="https://opensource.facebook.com/legal/privacy/" target="_blank" rel="noreferrer noopener">Privacy</a><a href="https://opensource.facebook.com/legal/terms/" target="_blank" rel="noreferrer noopener">Terms</a></div><div class="footerSection"><h5>Social</h5><div class="social"><a class="github-button" href="https://github.com/facebook/docusaurus" data-count-href="https://github.com/facebook/docusaurus/stargazers" data-show-count="true" data-count-aria-label="# stargazers on GitHub" aria-label="Star this project on GitHub">docusaurus</a></div><div class="social"><a href="https://twitter.com/docusaurus" class="twitter-follow-button">Follow @docusaurus</a></div><div class="social"><div class="fb-like" data-href="https://docusaurus.io" data-colorscheme="dark" data-layout="standard" data-share="true" data-width="225" data-show-faces="false"></div></div></div></section><a href="https://opensource.facebook.com/" target="_blank" rel="noreferrer noopener" class="fbOpenSource"><img src="/img/oss_logo.png" alt="Facebook Open Source" width="170" height="45"/></a><section class="copyright"><span>Copyright © 2020 Facebook Inc.</span> Landing images by <a href="https://undraw.co/">unDraw</a>.</section></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.fbAsyncInit = function() {FB.init({appId:'199138890728411',xfbml:true,version:'v2.7'});};(function(d, s, id){var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) {return;}js = d.createElement(s); js.id = id;js.src = '//connect.facebook.net/en_US/sdk.js';fjs.parentNode.insertBefore(js, fjs);}(document, 'script','facebook-jssdk'));
|
||
</script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter-wjs'));</script><script>
|
||
document.addEventListener('keyup', function(e) {
|
||
if (e.target !== document.body) {
|
||
return;
|
||
}
|
||
// keyCode for '/' (slash)
|
||
if (e.keyCode === 191) {
|
||
const search = document.getElementById('search_input_react');
|
||
search && search.focus();
|
||
}
|
||
});
|
||
</script><script>
|
||
var search = docsearch({
|
||
|
||
apiKey: '3eb9507824b8be89e7a199ecaa1a9d2c',
|
||
indexName: 'docusaurus',
|
||
inputSelector: '#search_input_react',
|
||
algoliaOptions: {"facetFilters":["language:fr","version:1.12.0"]}
|
||
});
|
||
</script></body></html> |