From 3bb699aa956069c3fbad60ae9c597c0f8a791c15 Mon Sep 17 00:00:00 2001
From: Laurent Peuch <cortex@worlddomination.be>
Date: Wed, 20 Mar 2024 04:27:08 +0100
Subject: [PATCH] feat(readme_generator/i18n): make README.md.j2 translatable

---
 tools/readme_generator/templates/README.md.j2 | 67 ++++++++++---------
 1 file changed, 34 insertions(+), 33 deletions(-)

diff --git a/tools/readme_generator/templates/README.md.j2 b/tools/readme_generator/templates/README.md.j2
index 46f33e4..f45ffde 100644
--- a/tools/readme_generator/templates/README.md.j2
+++ b/tools/readme_generator/templates/README.md.j2
@@ -1,83 +1,84 @@
 {% if manifest.id == "example" -%}
-# Packaging an app, starting from this example
+# {{ _('Packaging an app, starting from this example') }}
 
-* Copy this app before working on it, using the ['Use this template'](https://github.com/YunoHost/example_ynh/generate) button on the Github repo.
-* Edit the `manifest.json` with app specific info.
-* Edit the `install`, `upgrade`, `remove`, `backup`, and `restore` scripts, and any relevant conf files in `conf/`.
-  * Using the [script helpers documentation.](https://yunohost.org/packaging_apps_helpers)
-* Add a `LICENSE` file for the package.
-* Edit `doc/DISCLAIMER*.md`
-* The `README.md` files are to be automatically generated by https://github.com/YunoHost/apps/tree/master/tools/readme_generator
+* {{ _("Copy this app before working on it, using the ['Use this template'](https://github.com/YunoHost/example_ynh/generate) button on the Github repo.") }}
+* {{ _("Edit the `manifest.json` with app specific info.") }}
+* {{ _("Edit the `install`, `upgrade`, `remove`, `backup`, and `restore` scripts, and any relevant conf files in `conf/`.") }}
+  * {{ _("Using the [script helpers documentation.](https://yunohost.org/packaging_apps_helpers)") }}
+* {{ _("Add a `LICENSE` file for the package.") }}
+* {{ _("Edit `doc/DISCLAIMER*.md`") }}
+* {{ _("The `README.md` files are to be automatically generated by https://github.com/YunoHost/apps/tree/master/tools/readme_generator") }}
 
 ---
 {% endif -%}
 
 <!--
-N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/readme_generator
-It shall NOT be edited by hand.
+{{ _("N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/readme_generator
+It shall NOT be edited by hand.") }}
 -->
 
-# {{manifest.name}} for YunoHost
+# {{ _("%(application_name)s for YunoHost")|format(application_name=manifest.name) }}
 
-[![Integration level](https://dash.yunohost.org/integration/{{manifest.id}}.svg)](https://dash.yunohost.org/appci/app/{{manifest.id}}) ![Working status](https://ci-apps.yunohost.org/ci/badges/{{manifest.id}}.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/{{manifest.id}}.maintain.svg)
+[![{{ _("Integration level") }}](https://dash.yunohost.org/integration/{{manifest.id}}.svg)](https://dash.yunohost.org/appci/app/{{manifest.id}}) ![{{ _("Working status") }}](https://ci-apps.yunohost.org/ci/badges/{{manifest.id}}.status.svg) ![{{ _("Maintenance status") }}](https://ci-apps.yunohost.org/ci/badges/{{manifest.id}}.maintain.svg)
 
-[![Install {{manifest.name}} with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app={{manifest.id}})
+[![{{ _("Install %(application_name)s with YunoHost")|format(application_name=manifest.name) }}](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app={{manifest.id}})
 
 *[Lire ce readme en français.](./README_fr.md)*
 
-> *This package allows you to install {{manifest.name}} quickly and simply on a YunoHost server.
-If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
+> *{{ _("This package allows you to install %(application_name)s quickly and simply on a YunoHost server.
+If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.")|format(application_name=manifest.name) }}*
 
-## Overview
+## {{ _("Overview") }}
 
 {% if description %}{{description}}{% else %}{{manifest.description[lang]}}{% endif %}
-**Shipped version:** {% if upstream.version %}{{upstream.version}}{% else %}{{manifest.version}}
+{{ _("**Shipped version:**") }} {% if upstream.version %}{{upstream.version}}{% else %}{{manifest.version}}
 {% endif -%}
 
 {% if upstream.demo %}
-**Demo:** <{{upstream.demo}}>
+{{ _("**Demo:**") }} <{{upstream.demo}}>
 {% endif -%}
 
 {% if screenshots %}
-## Screenshots
+## {{ _("Screenshots") }}
 
 {% for screenshot in screenshots -%}
-    ![Screenshot of {{manifest.name}}](./{{screenshot}})
+    ![{{ _("Screenshot of %(application_name)s")|format(application_name=manifest.name) }}](./{{screenshot}})
 {% endfor %}
 {% endif -%}
 
 {% if disclaimer -%}
-## Disclaimers / important information
+## {{ _("Disclaimers / important information") }}
 
 {{ disclaimer }}
 {% endif -%}
 
 {% if antifeatures -%}
-## :red_circle: Antifeatures
+## :red_circle: {{ _("Antifeatures") }}
 
 {% for antifeature in antifeatures.values() -%}
   - **{{ antifeature.title }}**: {{ antifeature.description }}
 {% endfor %}
 {% endif -%}
 
-## Documentation and resources
+## {{ _("Documentation and resources") }}
 
-{% if upstream.website -%}- Official app website: <{{ upstream.website }}>
+{% if upstream.website -%}- {{ _("Official app website:") }} <{{ upstream.website }}>
 {% endif -%}
-{% if upstream.userdoc -%}- Official user documentation: <{{ upstream.userdoc }}>
+{% if upstream.userdoc -%}- {{ _("Official user documentation:") }} <{{ upstream.userdoc }}>
 {% endif -%}
-{% if upstream.admindoc -%}- Official admin documentation: <{{ upstream.admindoc }}>
+{% if upstream.admindoc -%}- {{ _("Official admin documentation:") }} <{{ upstream.admindoc }}>
 {% endif -%}
-{% if upstream.code -%}- Upstream app code repository: <{{ upstream.code }}>
+{% if upstream.code -%}- {{ _("Upstream app code repository:") }} <{{ upstream.code }}>
 {% endif -%}
-- YunoHost Store: <https://apps.yunohost.org/app/{{manifest.id}}>
-- Report a bug: <https://github.com/YunoHost-Apps/{{manifest.id}}_ynh/issues>
+- {{ _("YunoHost Store:") }} <https://apps.yunohost.org/app/{{manifest.id}}>
+- {{ _("Report a bug:") }} <https://github.com/YunoHost-Apps/{{manifest.id}}_ynh/issues>
 
-## Developer info
+## {{ _("Developer info") }}
 
-Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/{{manifest.id}}_ynh/tree/testing).
+{{ _("Please send your pull request to the [testing branch](%(testing_branch_url)s)")|format(testing_branch_url="https://github.com/YunoHost-Apps/" + manifest.id + "_ynh/tree/testing") }},
 
-To try the testing branch, please proceed like that.
+
+{{ _("To try the testing branch, please proceed like that.") }}
 
 ```bash
 sudo yunohost app install https://github.com/YunoHost-Apps/{{manifest.id}}_ynh/tree/testing --debug
@@ -85,5 +86,5 @@ or
 sudo yunohost app upgrade {{manifest.id}} -u https://github.com/YunoHost-Apps/{{manifest.id}}_ynh/tree/testing --debug
 ```
 
-**More info regarding app packaging:** <https://yunohost.org/packaging_apps>
+**{{ _("More info regarding app packaging:") }}** <https://yunohost.org/packaging_apps>