From b9bb2163211c6dda3a549443dde95606abad3ecf Mon Sep 17 00:00:00 2001
From: OSFr0g <108383157+OSFr0g@users.noreply.github.com>
Date: Sun, 3 Mar 2024 20:01:26 +0100
Subject: [PATCH] Add docs translation for menus and includes (#1143)
---
CONTRIBUTING_DOCS.md | 73 ++++++
docs/_data/converToJson.js | 18 ++
docs/_data/navigation.yml | 3 +-
docs/_data/navigation_es.yml | 121 +++++++++
docs/_data/navigation_fr.yml | 126 +++++++++
docs/_includes/improve_fr | 6 +
docs/_includes/masthead.html | 40 ++-
docs/_includes/nav_list | 9 +
docs/_includes/wip_fr | 15 ++
docs/_pages/docs/es/00-quick-start/02-tor.md | 2 +-
docs/_pages/docs/es/home.md | 4 +-
.../docs/fr/00-quick-start/01-lightning.md | 2 +-
docs/_pages/docs/fr/00-quick-start/02-tor.md | 2 +-
.../docs/fr/00-quick-start/03-access.md | 2 +-
.../fr/01-best-practices/00-best-practices.md | 2 +-
.../docs/fr/01-best-practices/01-pgp-guide.md | 2 +-
.../01-best-practices/02-payment-methods.md | 2 +-
.../fr/01-best-practices/03-proxy-wallets.md | 2 +-
.../docs/fr/01-best-practices/04-channels.md | 2 +-
docs/_pages/docs/fr/02-features/01-private.md | 2 +-
docs/_pages/docs/fr/02-features/02-fast.md | 2 +-
docs/_pages/docs/fr/02-features/03-safe.md | 2 +-
.../fr/03-understand/01-trade-pipeline.md | 2 +-
.../_pages/docs/fr/03-understand/02-robots.md | 2 +-
.../docs/fr/03-understand/03-premium.md | 2 +-
docs/_pages/docs/fr/03-understand/04-bonds.md | 2 +-
.../docs/fr/03-understand/05-trade-escrow.md | 2 +-
.../docs/fr/03-understand/06-disputes.md | 2 +-
.../docs/fr/03-understand/07-wallets.md | 2 +-
.../_pages/docs/fr/03-understand/08-limits.md | 2 +-
docs/_pages/docs/fr/03-understand/09-swaps.md | 2 +-
.../docs/fr/03-understand/10-telegram.md | 2 +-
.../_pages/docs/fr/03-understand/12-prices.md | 2 +-
docs/_pages/docs/fr/03-understand/13-fees.md | 2 +-
.../fr/03-understand/14-on-chain-payouts.md | 2 +-
.../docs/fr/contribute/00-contribute.md | 23 ++
.../docs/fr/contribute/01-development.md | 97 +++++++
.../_pages/docs/fr/contribute/02-languages.md | 53 ++++
.../_pages/docs/fr/contribute/03-liquidity.md | 35 +++
docs/_pages/docs/fr/contribute/04-guides.md | 30 +++
docs/_pages/docs/fr/contribute/05-art.md | 22 ++
docs/_pages/docs/fr/contribute/06-outreach.md | 26 ++
docs/_pages/docs/fr/contribute/07-donate.md | 60 +++++
docs/_pages/docs/fr/home.md | 72 ++++++
docs/_pages/docs/fr/stats.md | 13 +
docs/contributeDocsImages/image-1.png | Bin 0 -> 7373 bytes
docs/contributeDocsImages/image-11.png | Bin 0 -> 11286 bytes
docs/contributeDocsImages/image-12.png | Bin 0 -> 2873 bytes
docs/contributeDocsImages/image-13.png | Bin 0 -> 9807 bytes
docs/contributeDocsImages/image-14.png | Bin 0 -> 14742 bytes
docs/contributeDocsImages/image-15.png | Bin 0 -> 11607 bytes
docs/contributeDocsImages/image-2.png | Bin 0 -> 1392 bytes
docs/contributeDocsImages/image-3.png | Bin 0 -> 1103 bytes
docs/contributeDocsImages/image-4.png | Bin 0 -> 3871 bytes
docs/contributeDocsImages/image-5.png | Bin 0 -> 12197 bytes
docs/contributeDocsImages/image-6.png | Bin 0 -> 12592 bytes
docs/contributeDocsImages/image-9.png | Bin 0 -> 30200 bytes
docs/contributeDocsImages/image.png | Bin 0 -> 12570 bytes
docs/header-menu-jsons/navigation.json | 240 ++++++++++++++++++
docs/header-menu-jsons/navigation_es.json | 232 +++++++++++++++++
docs/header-menu-jsons/navigation_fr.json | 240 ++++++++++++++++++
docs/utils/mastheadHelper.js | 66 +++++
package-lock.json | 28 ++
package.json | 5 +
64 files changed, 1672 insertions(+), 35 deletions(-)
create mode 100644 CONTRIBUTING_DOCS.md
create mode 100644 docs/_data/converToJson.js
create mode 100644 docs/_data/navigation_es.yml
create mode 100644 docs/_data/navigation_fr.yml
create mode 100644 docs/_includes/improve_fr
create mode 100644 docs/_includes/wip_fr
create mode 100644 docs/_pages/docs/fr/contribute/00-contribute.md
create mode 100644 docs/_pages/docs/fr/contribute/01-development.md
create mode 100644 docs/_pages/docs/fr/contribute/02-languages.md
create mode 100644 docs/_pages/docs/fr/contribute/03-liquidity.md
create mode 100644 docs/_pages/docs/fr/contribute/04-guides.md
create mode 100644 docs/_pages/docs/fr/contribute/05-art.md
create mode 100644 docs/_pages/docs/fr/contribute/06-outreach.md
create mode 100644 docs/_pages/docs/fr/contribute/07-donate.md
create mode 100644 docs/_pages/docs/fr/home.md
create mode 100644 docs/_pages/docs/fr/stats.md
create mode 100644 docs/contributeDocsImages/image-1.png
create mode 100644 docs/contributeDocsImages/image-11.png
create mode 100644 docs/contributeDocsImages/image-12.png
create mode 100644 docs/contributeDocsImages/image-13.png
create mode 100644 docs/contributeDocsImages/image-14.png
create mode 100644 docs/contributeDocsImages/image-15.png
create mode 100644 docs/contributeDocsImages/image-2.png
create mode 100644 docs/contributeDocsImages/image-3.png
create mode 100644 docs/contributeDocsImages/image-4.png
create mode 100644 docs/contributeDocsImages/image-5.png
create mode 100644 docs/contributeDocsImages/image-6.png
create mode 100644 docs/contributeDocsImages/image-9.png
create mode 100644 docs/contributeDocsImages/image.png
create mode 100644 docs/header-menu-jsons/navigation.json
create mode 100644 docs/header-menu-jsons/navigation_es.json
create mode 100644 docs/header-menu-jsons/navigation_fr.json
create mode 100644 docs/utils/mastheadHelper.js
create mode 100644 package-lock.json
create mode 100644 package.json
diff --git a/CONTRIBUTING_DOCS.md b/CONTRIBUTING_DOCS.md
new file mode 100644
index 00000000..3c6907a6
--- /dev/null
+++ b/CONTRIBUTING_DOCS.md
@@ -0,0 +1,73 @@
+# Contributing to docs
+
+In order to translate the docs to your language, there are several steps to be done.
+
+## Preparing the files
+
+In the root folder, go to docs/_pages/docs
+
+Create a folder with your language and copy inside the following folders/files
+
+- /docs/_pages/`contribute`
+- /docs/_pages/docs/`00-quick-start`
+- /docs/_pages/docs/`01-best-practices`
+- /docs/_pages/docs/`02-features`
+- /docs/_pages/docs/`03-understand`
+- /docs/_pages/`home.md`
+- /docs/_pages/`stats.md`
+
+this is how it looks the spanish folder
+
+![spanish expample](/docs/contributeDocsImages/image-1.png "spanish folder")
+
+Then go to `/docs/_includes/` and make a copy of the improve and wip files, adding at the end of them `xxx_{your language}`
+
+![alt text](/docs/contributeDocsImages/image-2.png) ![alt text](/docs/contributeDocsImages/image-3.png)
+
+Go to /docs/_data/ and make a copy of navigation.yml , adding at the end of them `xxx_{your language}`
+
+![alt text](/docs/contributeDocsImages/image.png)
+
+## Start translation
+
+Now go file by file in the folder you created and translate everything
+In the beginning of most folders you will find this structure
+
+![alt text](/docs/contributeDocsImages/image-5.png)
+
+Remember to change the title, the permalink and the sidebar title.
+This is how it looks once changed, in the permalink, add /{your language}/, and do the same in all links with this structure.
+
+![alt text](/docs/contributeDocsImages/image-6.png)
+
+In order to do this quicker and easier, its better to use a find and replace tool. Here is what it looks in VSCode.
+Go to the magnifying glass icon in the left and use this as a sample.
+
+![alt text](/docs/contributeDocsImages/image-9.png)
+
+You can replace all at once, or go one by one
+
+![alt text](/docs/contributeDocsImages/image-11.png)
+
+There will be some files that include at the bottom a include for the improve file or the **wip** file
+Use the same tool to change it quick in all files.
+
+![alt text](/docs/contributeDocsImages/image-12.png)
+
+![alt text](/docs/contributeDocsImages/image-13.png)
+
+***
+
+## Menus
+
+### Header Menu
+In order to trasnlate the menus, change all the titles and urls in the `/docs/_data/navigation_{your language}.yml` file you copied earlier. Then go to `/docs/_data/convertToJson.js` and change the filename const to your filename
+
+![alt text](/docs/contributeDocsImages/image-15.png)
+
+After that,from the root, run node `node .\docs\_data\converToJson.js`, and a json copy will be generated.
+
+### Sidebar
+In the `/docs/_includes/nav_list` file, add 2 lines changing the language, just like in the picture below. (change all ocurrences of **'es'**). Add a {% endif %} at the end.
+
+![alt text](/docs/contributeDocsImages/image-14.png)
diff --git a/docs/_data/converToJson.js b/docs/_data/converToJson.js
new file mode 100644
index 00000000..7bce1262
--- /dev/null
+++ b/docs/_data/converToJson.js
@@ -0,0 +1,18 @@
+const fs = require('fs');
+const yaml = require('js-yaml');
+
+const fileName = 'navigation_{your languageD}';
+
+// Read YAML file
+const yamlData = fs.readFileSync(`./docs/_data/${fileName}.yml`, 'utf8');
+
+// Parse YAML to JavaScript object
+const jsonData = yaml.load(yamlData);
+
+// Convert JavaScript object to JSON
+const jsonContent = JSON.stringify(jsonData, null, 2);
+
+// Write JSON to file
+fs.writeFileSync(`./docs/header-menu-jsons/${fileName}.json`, jsonContent, 'utf8');
+
+console.log('Conversion completed successfully!');
diff --git a/docs/_data/navigation.yml b/docs/_data/navigation.yml
index 1f6a8267..9c07567c 100644
--- a/docs/_data/navigation.yml
+++ b/docs/_data/navigation.yml
@@ -122,4 +122,5 @@ contribute:
- title: ' Outreach'
url: /contribute/outreach/
- title: ' Donate'
- url: /contribute/donate/
\ No newline at end of file
+ url: /contribute/donate/
+
diff --git a/docs/_data/navigation_es.yml b/docs/_data/navigation_es.yml
new file mode 100644
index 00000000..d5d836ea
--- /dev/null
+++ b/docs/_data/navigation_es.yml
@@ -0,0 +1,121 @@
+main:
+ - title: ' Acceso Rápido'
+ url: /docs/es/quick-start/
+ - title: ' Tutorials'
+ url: /watch/en/
+ - title: ' Estadísticas'
+ url: /stats/es/
+ - title: ' Contribuir'
+ url: /contribute/es/
+ - title: ' Blog'
+ url: /blog/es/
+
+docs:
+ - title: 'Inicio Rápido'
+ url: /docs/es/quick-start/
+ children:
+ - title: ' Lightning Network'
+ url: /docs/es/lightning/
+ - title: ' La red TOR'
+ url: /docs/es/tor/
+ - title: ' Acceso'
+ url: /docs/es/access/
+
+ - title: 'Features'
+ url: /docs/es/features/
+ children:
+ - title: ' Privado'
+ url: /docs/es/private/
+ - title: ' Rápido'
+ url: /docs/es/fast/
+ - title: ' Seguro'
+ url: /docs/es/safe/
+
+ - title: 'Entender'
+ url: /docs/es/understand/
+ children:
+ - title: ' Flujo de comercio'
+ url: /docs/es/trade-pipeline/
+ - title: ' Robots'
+ url: /docs/es/robots/
+ - title: ' Premium'
+ url: /docs/es/premium/
+ - title: ' Fianzas'
+ url: /docs/es/bonds/
+ - title: ' Depósito de garantía'
+ url: /docs/es/escrow/
+ - title: ' Pagos On-Chain'
+ url: /docs/es/on-chain-payouts/
+ - title: ' Precios'
+ url: /docs/es/prices/
+ - title: ' Comisiones'
+ url: /docs/es/fees/
+ - title: ' Disputas'
+ url: /docs/es/disputes/
+ - title: ' Wallets'
+ url: /docs/es/wallets/
+ - title: ' Limites'
+ url: /docs/es/limits/
+ - title: ' Swaps'
+ url: /docs/es/swaps/
+ - title: ' Telegram'
+ url: /docs/es/telegram/
+ - title: ' API'
+ url: /docs/es/api/
+
+ - title: 'Mejores practicas'
+ url: /docs/es/best-practices/
+ children:
+ - title: ' Cifrado PGP'
+ url: /docs/es/pgp-encryption/
+ - title: ' Métodos de pago'
+ url: /docs/es/payment-methods/
+ - title: ' Wallets Proxy'
+ url: /docs/es/proxy-wallets/
+ - title: ' Canales Lightning'
+ url: /docs/es/channels/
+
+tutorial:
+ - title: 'Ver'
+ url: "/watch/en/"
+ children:
+ - title: ' English'
+ url: "/watch/en/"
+ - title: ' Español'
+ url: "/watch/es/"
+ - title: ' Deutsch'
+ url: "/watch/de/"
+ - title: ' Português'
+ url: "/watch/pt/"
+ - title: ' Français'
+ url: "/watch/fr/"
+ - title: ' Polski'
+ url: "/watch/pl/"
+ - title: 'Leer'
+ url: "/watch/en/"
+ children:
+ - title: ' English'
+ url: "/read/en/"
+ - title: ' Español'
+ url: "/read/es/"
+ - title: ' Deutsch'
+ url: "/read/de/"
+
+contribute:
+ - title: 'Contribuir'
+ url: /contribute/es/
+ children:
+ - title: ' Código'
+ url: /contribute/es/code/
+ - title: ' Traducciones'
+ url: /contribute/es/languages/
+ - title: ' Liquidez'
+ url: /contribute/es/liquidity/
+ - title: ' Guías'
+ url: /contribute/es/guides/
+ - title: ' Arte'
+ url: /contribute/es/art/
+ - title: ' Comparte'
+ url: /contribute/es/outreach/
+ - title: ' Dona'
+ url: /contribute/es/donate/
diff --git a/docs/_data/navigation_fr.yml b/docs/_data/navigation_fr.yml
new file mode 100644
index 00000000..0b354b59
--- /dev/null
+++ b/docs/_data/navigation_fr.yml
@@ -0,0 +1,126 @@
+main:
+ - title: ' Quick-Start'
+ url: /docs/fr/quick-start/
+ - title: ' Tutorials'
+ url: /watch/fr/
+ - title: ' Stats'
+ url: /stats/fr/
+ - title: ' Contribute'
+ url: /contribute/fr/
+ - title: ' Blog'
+ url: /blog/fr/
+
+docs:
+ - title: 'Quick Start'
+ url: /docs/fr/quick-start/
+ children:
+ - title: ' Lightning Network'
+ url: /docs/fr/lightning/
+ - title: ' TOR Network'
+ url: /docs/fr/tor/
+ - title: ' Access'
+ url: /docs/fr/access/
+
+ - title: 'Features'
+ url: /docs/fr/features/
+ children:
+ - title: ' Private'
+ url: /docs/fr/private/
+ - title: ' Fast'
+ url: /docs/fr/fast/
+ - title: ' Safe'
+ url: /docs/fr/safe/
+
+ - title: 'Understand'
+ url: /docs/fr/understand/
+ children:
+ - title: ' Trade Pipeline'
+ url: /docs/fr/trade-pipeline/
+ - title: ' Robots'
+ url: /docs/fr/robots/
+ - title: ' Premium'
+ url: /docs/fr/premium/
+ - title: ' Bonds'
+ url: /docs/fr/bonds/
+ - title: ' Trade Escrow'
+ url: /docs/fr/escrow/
+ - title: ' On-Chain Payouts'
+ url: /docs/fr/on-chain-payouts/
+ - title: ' Prices'
+ url: /docs/fr/prices/
+ - title: ' Fees'
+ url: /docs/fr/fees/
+ - title: ' Disputes'
+ url: /docs/fr/disputes/
+ - title: ' Wallets'
+ url: /docs/fr/wallets/
+ - title: ' Limits'
+ url: /docs/fr/limits/
+ - title: ' Swaps'
+ url: /docs/fr/swaps/
+ - title: ' Telegram'
+ url: /docs/fr/telegram/
+ - title: ' API'
+ url: /docs/fr/api/
+
+ - title: 'Best Practices'
+ url: /docs/fr/best-practices/
+ children:
+ - title: ' PGP Encryption'
+ url: /docs/fr/pgp-encryption/
+ - title: ' Payment Methods'
+ url: /docs/fr/payment-methods/
+ - title: ' Proxy Wallets'
+ url: /docs/fr/proxy-wallets/
+ - title: ' Lightning Channels'
+ url: /docs/fr/channels/
+
+tutorial:
+ - title: 'Watch'
+ url: "/watch/fr/"
+ children:
+ - title: ' English'
+ url: "/watch/en/"
+ - title: ' Español'
+ url: "/watch/es/"
+ - title: ' Deutsch'
+ url: "/watch/de/"
+ - title: ' Português'
+ url: "/watch/pt/"
+ - title: ' Français'
+ url: "/watch/fr/"
+ - title: ' Polski'
+ url: "/watch/pl/"
+ - title: ' Русский'
+ url: "/watch/ru/"
+ - title: 'Read'
+ url: "/watch/en/"
+ children:
+ - title: ' English'
+ url: "/read/en/"
+ - title: ' Español'
+ url: "/read/es/"
+ - title: ' Deutsch'
+ url: "/read/de/"
+ - title: ' Русский'
+ url: "/read/ru/"
+
+contribute:
+ - title: 'Contribute'
+ url: /contribute/fr/
+ children:
+ - title: ' Code'
+ url: /contribute/fr/code/
+ - title: ' Translations'
+ url: /contribute/fr/languages/
+ - title: ' Liquidity'
+ url: /contribute/fr/liquidity/
+ - title: ' Guides'
+ url: /contribute/fr/guides/
+ - title: ' Art'
+ url: /contribute/fr/art/
+ - title: ' Outreach'
+ url: /contribute/fr/outreach/
+ - title: ' Donate'
+ url: /contribute/fr/donate/
+
diff --git a/docs/_includes/improve_fr b/docs/_includes/improve_fr
new file mode 100644
index 00000000..7be844a1
--- /dev/null
+++ b/docs/_includes/improve_fr
@@ -0,0 +1,6 @@
+## You can help improve this page!
+
+Learn RoboSats is a joint effort of the RoboSats community. If you have used RoboSats before, you are already an expert! Help improve this documentation.
+
+**ProTip:** You can directly [edit this page ](https://github.com/RoboSats/robosats/blob/main/docs/{{page.src}}) and open a [Pull Request ](https://github.com/RoboSats/robosats/pulls). Your changes will show right here.
+{: .notice--primary}
diff --git a/docs/_includes/masthead.html b/docs/_includes/masthead.html
index d55112b0..220fabe1 100644
--- a/docs/_includes/masthead.html
+++ b/docs/_includes/masthead.html
@@ -7,17 +7,13 @@
{% unless logo_path == empty %}
{% endunless %}
-
+
{{ site.masthead_title | default: site.title }}
{% if site.subtitle %}{{ site.subtitle }}{% endif %}
-
- {%- for link in site.data.navigation.main -%}
-
- {%- endfor -%}
+
+
{% if site.search == true %}
+
+
+
+
diff --git a/docs/_includes/nav_list b/docs/_includes/nav_list
index a035a5bd..f7ddd3d3 100644
--- a/docs/_includes/nav_list
+++ b/docs/_includes/nav_list
@@ -1,4 +1,12 @@
+{% assign url = page.url %}
{% assign navigation = site.data.navigation[include.nav] %}
+{% if url contains "/es/" %}
+ {% assign navigation = site.data.navigation_es[include.nav] %}
+{% endif %}
+{% if url contains "/fr/" %}
+ {% assign navigation = site.data.navigation_fr[include.nav] %}
+{% endif %}
+