Skip to content

Commit

Permalink
Setup i18n and bootstrap French translation.
Browse files Browse the repository at this point in the history
  • Loading branch information
KtorZ committed May 14, 2022
1 parent 13aea9b commit 5f33cd5
Show file tree
Hide file tree
Showing 12 changed files with 507 additions and 23 deletions.
19 changes: 19 additions & 0 deletions docs/README.md
Expand Up @@ -33,3 +33,22 @@ $ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.


# Translating

Translations of the documentation are provided in the `i18n/{lang}` folder (for example `i18n/fr` for French). Translations of both the content and the various website elements (such as buttons, headers etc...) are needed. To initialize a new language translation (e.g. `fr`), run the following command:

```
yarn write-translations --locale fr
```

This command will pre-generate all the website elements which need to be translated into French (locale `fr`) in JSON files. Content files themselves then to be copied under their respective directories, and then translated. Here is a table that summarizes the correspondence between the default website structure and their localized versions:

| default | translations |
| ----- | ----- |
| `docs/` | `i18n/{lang}/docusaurus-plugin-content-docs/` |
| `benchmarks/` | `i18n/{lang}/docusaurus-plugin-content-docs-benchmarks/` |
| `core-concepts/` | `i18n/{lang}/docusaurus-plugin-content-docs-core-concepts/` |
| `topologies/` | `i18n/{lang}/docusaurus-plugin-content-docs-topologies/` |
| `adr/` | `i18n/{lang}/docusaurus-plugin-content-blog/` |
18 changes: 16 additions & 2 deletions docs/docusaurus.config.js
Expand Up @@ -14,7 +14,6 @@ const editUrl = 'https://github.com/input-output-hk/hydra-poc/tree/master/docs';
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'Hydra: Head Protocol',
tagline: 'User Manual, Core Concepts and API Reference',
url: 'https://input-output-hk.github.io',
baseUrl: '/head-protocol/',
onBrokenLinks: 'throw',
Expand All @@ -25,7 +24,18 @@ const config = {
staticDirectories: ['static', customFields.apiSpecDir],
customFields,

scripts: [{ src: 'https://plausible.io/js/script.js', defer: true, 'data-domain': 'hydra.family' }],
scripts: [
{
src: 'https://plausible.io/js/script.js',
defer: true,
'data-domain': 'hydra.family'
}
],

i18n: {
defaultLocale: 'en',
locales: ['en', 'fr'],
},

presets: [
[
Expand Down Expand Up @@ -123,6 +133,10 @@ const config = {
label: 'GitHub',
position: 'right',
},
{
type: 'localeDropdown',
position: 'right',
},
],
},
footer: {
Expand Down
295 changes: 295 additions & 0 deletions docs/i18n/fr/code.json
@@ -0,0 +1,295 @@
{
"theme.ErrorPageContent.title": {
"message": "Cette page a planté.",
"description": "The title of the fallback page when the page crashed"
},
"theme.ErrorPageContent.tryAgain": {
"message": "Réessayer",
"description": "The label of the button to try again when the page crashed"
},
"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.BackToTopButton.buttonAriaLabel": {
"message": "Revenez en haut",
"description": "The ARIA label for the back to top button"
},
"theme.blog.archive.title": {
"message": "Archive",
"description": "The page & hero title of the blog archive page"
},
"theme.blog.archive.description": {
"message": "Archive",
"description": "The page & hero description of the blog archive page"
},
"theme.blog.paginator.navAriaLabel": {
"message": "Pagination de la liste des articles 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.blog.post.readMoreLabel": {
"message": "En savoir plus sur {title}",
"description": "The ARIA label for the link to full blog posts from excerpts"
},
"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 articles du blog",
"description": "The ARIA label for the blog posts pagination"
},
"theme.blog.post.paginator.newerPost": {
"message": "Suivant",
"description": "The blog post button label to navigate to the newer/previous post"
},
"theme.blog.post.paginator.olderPost": {
"message": "Précédent",
"description": "The blog post button label to navigate to the older/next post"
},
"theme.blog.sidebar.navAriaLabel": {
"message": "Navigation article de blog récent",
"description": "The ARIA label for recent posts in the blog sidebar"
},
"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.colorToggle.ariaLabel": {
"message": "Basculer entre theme clair ou sombre (theme actuel: {mode})",
"description": "The ARIA label for the navbar color mode toggle"
},
"theme.colorToggle.ariaLabel.mode.dark": {
"message": "Thème sombre",
"description": "The name for the dark color mode"
},
"theme.colorToggle.ariaLabel.mode.light": {
"message": "Thème clair",
"description": "The name for the light color mode"
},
"theme.docs.DocCard.categoryDescription": {
"message": "{count} éléments",
"description": "The default description for a category card in the generated index about how many items this category includes"
},
"theme.docs.sidebar.expandButtonTitle": {
"message": "Afficher le menu latéral",
"description": "The ARIA label and title attribute for expand button of doc sidebar"
},
"theme.docs.sidebar.expandButtonAriaLabel": {
"message": "Afficher 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.collapseButtonTitle": {
"message": "Cacher le menu latéral",
"description": "The title attribute for collapse button of doc sidebar"
},
"theme.docs.sidebar.collapseButtonAriaLabel": {
"message": "Cacher le menu latéral",
"description": "The title attribute for collapse button of doc sidebar"
},
"theme.DocSidebarItem.toggleCollapsedCategoryAriaLabel": {
"message": "Ouvrir/Fermer la catégorie '{label}'",
"description": "The ARIA label to toggle the collapsible sidebar category"
},
"theme.docs.tagDocListPageTitle.nDocsTagged": {
"message": "Un document tagué|{count} documents tagués",
"description": "Pluralized label for \"{count} docs tagged\". 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.docs.tagDocListPageTitle": {
"message": "{nDocsTagged} avec \"{tagName}\"",
"description": "The title of the page for a docs tag"
},
"theme.docs.versionBadge.label": {
"message": "Version: {versionLabel}"
},
"theme.common.editThisPage": {
"message": "Éditer cette page",
"description": "The link label to edit the current page"
},
"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 used to tell the user to check the latest version"
},
"theme.docs.versions.latestVersionLinkLabel": {
"message": "dernière version",
"description": "The label used for the latest version suggestion link label"
},
"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.navbar.mobileSidebarSecondaryMenu.backButtonLabel": {
"message": "← Retour au menu principal",
"description": "The label of the back button to return to main menu, inside the mobile navbar sidebar secondary menu (notably used to display the docs sidebar)"
},
"theme.navbar.mobileVersionsDropdown.label": {
"message": "Versions",
"description": "The label for the navbar versions dropdown on mobile view"
},
"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.TOCCollapsible.toggleButtonLabel": {
"message": "Sur cette page",
"description": "The label used by the button on the collapsible TOC component"
},
"theme.tags.tagsListLabel": {
"message": "Tags :",
"description": "The label alongside a tag list"
},
"theme.navbar.mobileLanguageDropdown.label": {
"message": "Langues",
"description": "The label for the mobile language switcher dropdown"
},
"theme.SearchBar.seeAll": {
"message": "Voir tous les résultats ({count})"
},
"theme.SearchBar.label": {
"message": "Chercher",
"description": "The ARIA label and placeholder for search button"
},
"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": "Indiquez 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": "Recherche par 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.tags.tagsPageTitle": {
"message": "Tags",
"description": "The title of the tag list page"
},
"homepage.tagline": {
"message": "Manuel utilisateur, concepts clés et référence d'API"
},
"homepage.featureList.secure.title": {
"message": "Sécurisé",
"description": "Hydra heads' first highlight: security."
},
"homepage.featureList.secure.tagline": {
"message": "Gardez le contrôle et ne dépensez que ce pour quoi vous avez expressément donné votre accord.",
"description": "Tagline for the 'secure' property."
},
"homepage.featureList.fast.title": {
"message": "Rapide",
"description": "Hydra heads' second highlight: swiftness."
},
"homepage.featureList.fast.tagline": {
"message": "Confirmez les transactions au sein de façon quasi-instantanée.",
"description": "Tagline for the 'fast' property."
},
"homepage.featureList.isomorphic.title": {
"message": "Isomorphique",
"description": "Hydra heads' third highlight: isomorphism."
},
"homepage.featureList.isomorphic.tagline": {
"message": "Tirez parti des aptitudes, interfaces et sécurités du ledger Cardano.",
"description": "Tagline for the 'isomorphic' property."
},
"homepage.gettingStarted": {
"message": "Démarrage rapide - 5min ⏱️",
"description": "'Getting Started' button in the home header."
}
}
14 changes: 14 additions & 0 deletions docs/i18n/fr/docusaurus-plugin-content-blog/options.json
@@ -0,0 +1,14 @@
{
"title": {
"message": "Décisions Architecturales",
"description": "The title for the blog used in SEO"
},
"description": {
"message": "Documentation technique succincte des décisions majeurs relatives au dévelopement du noeud Hydra.",
"description": "The description for the blog used in SEO"
},
"sidebar.title": {
"message": "Décisions Architecturales",
"description": "The label for the left sidebar"
}
}
@@ -0,0 +1,6 @@
{
"version.label": {
"message": "Suivant",
"description": "The label for version current"
}
}
@@ -0,0 +1,6 @@
{
"version.label": {
"message": "Suivant",
"description": "The label for version current"
}
}
@@ -0,0 +1,6 @@
{
"version.label": {
"message": "Suivant",
"description": "The label for version current"
}
}

0 comments on commit 5f33cd5

Please sign in to comment.