Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs/french] Translate official document to French #377

Merged
merged 15 commits into from
Apr 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
* @format
*/

function makeDocsEditUrl(locale, docPath) {
if (locale === 'en')
return `https://github.com/facebookexperimental/Recoil/edit/docs/docs/docs/${docPath}`
else
return `https://github.com/facebookexperimental/Recoil/edit/docs/docs/i18n/${locale}/docusaurus-plugin-content-docs/current/${docPath}`
}

module.exports = {
title: 'Recoil',
tagline: 'A state management library for React',
Expand All @@ -15,8 +22,20 @@ module.exports = {
favicon: 'img/favicon.png',
organizationName: 'facebookexperimental', // Usually your GitHub org/user name.
projectName: 'Recoil', // Usually your repo name.
i18n: {
defaultLocale: 'en',
locales: ['en', 'fr'],
localeConfigs: {
en: {
label: 'English',
},
fr: {
label: 'Français',
},
},
},
themeConfig: {
algolia: {
algolia: {
apiKey: '9c5a009951e793525603922b8ca66628',
indexName: 'recoiljs'
},
Expand All @@ -39,14 +58,18 @@ module.exports = {
label: 'Docs',
position: 'left',
},
{to: 'blog', label: 'Blog', position: 'left'},
{to: 'resources', label: 'External Resources', position: 'left'},
{ to: 'blog', label: 'Blog', position: 'left' },
{ to: 'resources', label: 'External Resources', position: 'left' },
// Please keep GitHub link to the right for consistency.
{
href: 'https://github.com/facebookexperimental/Recoil',
label: 'GitHub',
position: 'right',
},
{
type: 'localeDropdown',
position: 'right',
}
],
},
footer: {
Expand Down Expand Up @@ -129,14 +152,13 @@ module.exports = {
{
docs: {
sidebarPath: require.resolve('./sidebars.js'),
editUrl:
'https://github.com/facebookexperimental/Recoil/edit/docs/docs/',
editUrl: ({ locale, docPath }) => makeDocsEditUrl(locale, docPath),
},
blog: {
showReadingTime: true,
editUrl:
'https://github.com/facebookexperimental/Recoil/edit/docs/docs/blog/',
feedOptions: {
feedOptions: {
type: 'all',
copyright: `Copyright © ${new Date().getFullYear()} Facebook, Inc.`,
},
Expand Down
233 changes: 233 additions & 0 deletions docs/i18n/fr/code.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
{
"homePage.head.tagline": {
"message": "Librairie de gestion d'état pour React"
},
"homePage.head.start": {
"message": "Commencer"
},
"homePage.minimal.title": {
"message": "Minimal et tout comme React"
},
"homePage.minimal.text": {
"message": "Recoil fonctionne et pense comme React. Ajoutez-le à votre application et obtenez un état partagé rapide et flexible."
},
"homePage.flow.title": {
"message": "Graphe de flux de données "
},
"homePage.flow.text": {
"message": "Données dérivées et requêtes asynchrones sont apprivoisées avec des fonctions pures et des un système d'abonnement efficace."
},
"homePage.cross.title": {
"message": "Observation inter-applications"
},
"homePage.cross.text": {
"message": "Implementez persistance, routage, débogage dans le temps ou retour arrière en observant tous les changements d'état dans votre application, sans nuire au fractionnement du code."
},
"resourcePage.head.title": {
"message": "Ressources Externes"
},
"resourcePage.learn.title": {
"message": "Apprendre Recoil"
},
"resourcePage.learn.course": {
"message": "a créé un cours vidéo Recoil gratuit (en anglais), qui vous emmène de la configuration à l'utilisation avancée. Dans le cours, vous apprendrez à tirer pleinement parti des APIs puissantes de Recoil."
},
"resourcePage.learn.more": {
"message": "Apprenez à récupérer des données avec Suspense, à utiliser Recoil pour résoudre les goulots d'étranglement courants de React, et bien plus encore."
},
"resourcePage.learn.watch": {
"message": "Regarder le cours"
},
"theme.NotFound.title": {
"message": "Page introuvable",
"description": "The title of the 404 page"
},
"theme.NotFound.p1": {
"message": "Nous n'avons pas trouvé ce que vous recherchez.",
"description": "The first paragraph of the 404 page"
},
"theme.NotFound.p2": {
"message": "Veuillez contacter le propriétaire du site qui vous a lié à l'URL d'origine et leur faire savoir que leur lien est cassé.",
"description": "The 2nd paragraph of the 404 page"
},
"theme.AnnouncementBar.closeButtonAriaLabel": {
"message": "Fermer",
"description": "The ARIA label for close button of announcement bar"
},
"theme.blog.paginator.navAriaLabel": {
"message": "Pagination de la liste des posts du blog",
"description": "The ARIA label for the blog pagination"
},
"theme.blog.paginator.newerEntries": {
"message": "Nouvelles entrées",
"description": "The label used to navigate to the newer blog posts page (previous page)"
},
"theme.blog.paginator.olderEntries": {
"message": "Anciennes entrées",
"description": "The label used to navigate to the older blog posts page (next page)"
},
"theme.blog.post.readingTime.plurals": {
"message": "Une minute de lecture|{readingTime} minutes de lecture",
"description": "Pluralized label for \"{readingTime} min read\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)"
},
"theme.tags.tagsListLabel": {
"message": "Tags :",
"description": "The label alongside a tag list"
},
"theme.blog.post.readMore": {
"message": "Lire plus",
"description": "The label used in blog post item excerpts to link to full blog posts"
},
"theme.blog.post.paginator.navAriaLabel": {
"message": "Pagination des blog posts",
"description": "The ARIA label for the blog posts pagination"
},
"theme.blog.post.paginator.newerPost": {
"message": "Article plus récent",
"description": "The blog post button label to navigate to the newer/previous post"
},
"theme.blog.post.paginator.olderPost": {
"message": "Article plus ancien",
"description": "The blog post button label to navigate to the older/next post"
},
"theme.tags.tagsPageTitle": {
"message": "Tags",
"description": "The title of the tag list page"
},
"theme.blog.post.plurals": {
"message": "Un article|{count} articles",
"description": "Pluralized label for \"{count} posts\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)"
},
"theme.blog.tagTitle": {
"message": "{nPosts} tagués avec « {tagName} »",
"description": "The title of the page for a blog tag"
},
"theme.tags.tagsPageLink": {
"message": "Voir tous les tags",
"description": "The label of the link targeting the tag list page"
},
"theme.CodeBlock.copyButtonAriaLabel": {
"message": "Copier le code",
"description": "The ARIA label for copy code blocks button"
},
"theme.CodeBlock.copied": {
"message": "Copié",
"description": "The copied button label on code blocks"
},
"theme.CodeBlock.copy": {
"message": "Copier",
"description": "The copy button label on code blocks"
},
"theme.docs.sidebar.expandButtonTitle": {
"message": "Déplier le menu latéral",
"description": "The ARIA label and title attribute for expand button of doc sidebar"
},
"theme.docs.sidebar.expandButtonAriaLabel": {
"message": "Déplier le menu latéral",
"description": "The ARIA label and title attribute for expand button of doc sidebar"
},
"theme.docs.paginator.navAriaLabel": {
"message": "Pagination des documents",
"description": "The ARIA label for the docs pagination"
},
"theme.docs.paginator.previous": {
"message": "Précédent",
"description": "The label used to navigate to the previous doc"
},
"theme.docs.paginator.next": {
"message": "Suivant",
"description": "The label used to navigate to the next doc"
},
"theme.docs.sidebar.responsiveCloseButtonLabel": {
"message": "Fermer le menu latéral",
"description": "The ARIA label for close button of mobile doc sidebar"
},
"theme.docs.sidebar.responsiveOpenButtonLabel": {
"message": "Ouvrir le menu latéral",
"description": "The ARIA label for open button of mobile doc sidebar"
},
"theme.docs.sidebar.collapseButtonTitle": {
"message": "Réduire le menu latéral",
"description": "The title attribute for collapse button of doc sidebar"
},
"theme.docs.sidebar.collapseButtonAriaLabel": {
"message": "Réduire le menu latéral",
"description": "The title attribute for collapse button of doc sidebar"
},
"theme.docs.versions.unreleasedVersionLabel": {
"message": "Ceci est la documentation de la prochaine version {versionLabel} de {siteTitle}.",
"description": "The label used to tell the user that he's browsing an unreleased doc version"
},
"theme.docs.versions.unmaintainedVersionLabel": {
"message": "Ceci est la documentation de {siteTitle} {versionLabel}, qui n'est plus activement maintenue.",
"description": "The label used to tell the user that he's browsing an unmaintained doc version"
},
"theme.docs.versions.latestVersionSuggestionLabel": {
"message": "Pour une documentation à jour, consultez la {latestVersionLink} ({versionLabel}).",
"description": "The label userd to tell the user that he's browsing an unmaintained doc version"
},
"theme.docs.versions.latestVersionLinkLabel": {
"message": "dernière version",
"description": "The label used for the latest version suggestion link label"
},
"theme.common.editThisPage": {
"message": "Éditer cette page",
"description": "The link label to edit the current page"
},
"theme.common.headingLinkTitle": {
"message": "Lien direct vers le titre",
"description": "Title for link to heading"
},
"theme.lastUpdated.atDate": {
"message": " le {date}",
"description": "The words used to describe on which date a page has been last updated"
},
"theme.lastUpdated.byUser": {
"message": " par {user}",
"description": "The words used to describe by who the page has been last updated"
},
"theme.lastUpdated.lastUpdatedAtBy": {
"message": "Dernière mise à jour{atDate}{byUser}",
"description": "The sentence used to display when a page has been last updated, and by who"
},
"theme.common.skipToMainContent": {
"message": "Aller au contenu principal",
"description": "The skip to content label used for accessibility, allowing to rapidly navigate to main content with keyboard tab/enter navigation"
},
"theme.SearchPage.documentsFound.plurals": {
"message": "Un document trouvé|{count} documents trouvés",
"description": "Pluralized label for \"{count} documents found\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)"
},
"theme.SearchPage.existingResultsTitle": {
"message": "Résultats de recherche pour « {query} »",
"description": "The search page title for non-empty query"
},
"theme.SearchPage.emptyResultsTitle": {
"message": "Rechercher dans la documentation",
"description": "The search page title for empty query"
},
"theme.SearchPage.inputPlaceholder": {
"message": "Tapez votre recherche ici",
"description": "The placeholder for search page input"
},
"theme.SearchPage.inputLabel": {
"message": "Chercher",
"description": "The ARIA label for search page input"
},
"theme.SearchPage.algoliaLabel": {
"message": "Recharche Algolia",
"description": "The ARIA label for Algolia mention"
},
"theme.SearchPage.noResultsText": {
"message": "Aucun résultat trouvé",
"description": "The paragraph for empty search result"
},
"theme.SearchPage.fetchingNewResults": {
"message": "Chargement de nouveaux résultats...",
"description": "The paragraph for fetching new search results"
},
"theme.SearchBar.label": {
"message": "Chercher",
"description": "The ARIA label and placeholder for search button"
}
}
42 changes: 42 additions & 0 deletions docs/i18n/fr/docusaurus-plugin-content-docs/current.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"version.label": {
"message": "Suivant",
"description": "The label for version current"
},
"sidebar.docs.category.Introduction": {
"message": "Introduction",
"description": "The label for category Introduction in sidebar docs"
},
"sidebar.docs.category.Basic Tutorial": {
"message": "Tutoriel de base",
"description": "The label for category Basic Tutorial in sidebar docs"
},
"sidebar.docs.category.Guides": {
"message": "Guides",
"description": "The label for category Guides in sidebar docs"
},
"sidebar.docs.category.API Reference": {
"message": "Référence API",
"description": "The label for category API Reference in sidebar docs"
},
"sidebar.docs.category.Core": {
"message": "Concepts clés",
"description": "The label for category Core in sidebar docs"
},
"sidebar.docs.category.State": {
"message": "État",
"description": "The label for category State in sidebar docs"
},
"sidebar.docs.category.Snapshots": {
"message": "Instantané",
"description": "The label for category Snapshots in sidebar docs"
},
"sidebar.docs.category.Misc": {
"message": "Divers",
"description": "The label for category Misc in sidebar docs"
},
"sidebar.docs.category.Utils": {
"message": "Outils",
"description": "The label for category Utils in sidebar docs"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: class Loadable
sidebar_label: Loadable
---

Un objet `Loadable` représente l'état actuel d'un Recoil [atome](/docs/api-reference/core/atom) ou [sélecteur](/docs/api-reference/core/selector). Cet état peut avoir une valeur disponible, être dans un état d'erreur ou encore être en attente de résolution asynchrone. Un `Loadable` a l'interface suivante:

- `state`: l'état actuel de l'atome ou du sélecteur. Les valeurs possibles sont `'hasValue'`, `'hasError'`, ou `'loading'`.
- `contents`: La valeur représentée par ce `Loadable`. Si l'état est `hasValue`, c'est la valeur réelle, si l'état est `hasError`, c'est l'objet `Error` qui a été lancé, et si l'état est `loading`, alors vous pouvez utiliser `toPromise()` pour obtenir une `Promise` de la valeur.

Les chargeables contiennent également des méthodes d'assistance pour accéder à l'état actuel. *Considérez cette API comme instable*:

- `getValue()` - Méthode pour accéder à la valeur qui correspond à la sémantique des sélecteurs React Suspense et Recoil. Si l'état a une valeur, il renvoie une valeur, s'il contient une erreur, il renvoie cette erreur, et s'il est toujours en attente, il suspend l'exécution ou le rendu pour propager l'état en attente.
- `toPromise()`: renvoie une `Promise` qui se résoudra lorsque le sélecteur sera résolu. Si le sélecteur est synchrone ou a déjà été résolu, il renvoie une `Promise` qui se résout immédiatement.
- `valueMaybe()` - Renvoie la valeur si disponible, sinon renvoie `undefined`
- `valueOrThrow()` - Renvoie la valeur si disponible ou renvoie une erreur.
- `map()` - Prend une fonction pour transformer la valeur du Loadable et renvoie un nouveau Loadable avec la valeur transformée. La fonction de transformation obtient un paramètre de la valeur et renvoie la nouvelle valeur; il peut également propager des erreurs lancées ou du suspense.

### Exemple

```jsx
function UserInfo({userID}) {
const userNameLoadable = useRecoilValueLoadable(userNameQuery(userID));
switch (userNameLoadable.state) {
case 'hasValue':
return <div>{userNameLoadable.contents}</div>;
case 'loading':
return <div>Loading...</div>;
case 'hasError':
throw userNameLoadable.contents;
}
}
```
Loading