From f3566430a3adf571441c4a90bfe3fbd98eca1dc3 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Tue, 20 Oct 2020 18:44:13 +0200 Subject: [PATCH 1/3] Introduce multi-lingual docs Signed-off-by: Thomas Citharel --- .gitlab-ci.yml | 1 + docker/tests/Dockerfile | 4 ++-- docs/fr/docs/index.md | 10 +++++++++ docs/fr/mkdocs.yml | 42 ++++++++++++++++++++++++++++++++++++ docs/javascripts/redirect.js | 18 ++++++++++++++++ docs/theme/main.html | 7 ++++++ mkdocs.yml | 6 ++++++ 7 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 docs/fr/docs/index.md create mode 100644 docs/fr/mkdocs.yml create mode 100644 docs/javascripts/redirect.js create mode 100644 docs/theme/main.html diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ed1495133..ee8f714ab 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -108,6 +108,7 @@ pages: script: - mkdir public - mkdocs build + - cd docs/fr && mkdocs build - mv site/* public/ # Mix docs disabled because of https://github.com/elixir-lang/ex_doc/issues/1172 # - mix deps.get diff --git a/docker/tests/Dockerfile b/docker/tests/Dockerfile index caed50223..2e23c3956 100644 --- a/docker/tests/Dockerfile +++ b/docker/tests/Dockerfile @@ -1,11 +1,11 @@ FROM elixir:latest LABEL maintainer="Thomas Citharel " -ENV REFRESHED_AT=2020-08-10 +ENV REFRESHED_AT=2020-10-20 RUN apt-get update -yq && apt-get install -yq build-essential inotify-tools postgresql-client git curl gnupg xvfb libgtk-3-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 python3-pip cmake RUN curl -sL https://deb.nodesource.com/setup_12.x | bash && apt-get install nodejs -yq RUN npm install -g yarn wait-on RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* RUN mix local.hex --force && mix local.rebar --force -RUN pip3 install mkdocs mkdocs-material pymdown-extensions pygments mkdocs-git-revision-date-localized-plugin mkdocs-minify-plugin +RUN pip3 install mkdocs mkdocs-material pymdown-extensions pygments mkdocs-git-revision-date-localized-plugin mkdocs-minify-plugin mkdocs-exclude RUN curl https://dbip.mirror.framasoft.org/files/dbip-city-lite-latest.mmdb --output GeoLite2-City.mmdb -s && mkdir -p /usr/share/GeoIP && mv GeoLite2-City.mmdb /usr/share/GeoIP/ diff --git a/docs/fr/docs/index.md b/docs/fr/docs/index.md new file mode 100644 index 000000000..09258dfc5 --- /dev/null +++ b/docs/fr/docs/index.md @@ -0,0 +1,10 @@ +--- +title: Documentation de Mobilizon +--- + +Bienvenue sur la documentation de Mobilizon + +* [En apprendre plus à propos de Mobilizon](/about) (en anglais) +* Apprendre comment utiliser Mobilizon (pas encore écrit) +* [Apprendre à installer Mobilizon](/administration) (en anglais) +* [Apprendre à contribuer à Mobilizon](/contribute) (en anglais) diff --git a/docs/fr/mkdocs.yml b/docs/fr/mkdocs.yml new file mode 100644 index 000000000..a6bc3841e --- /dev/null +++ b/docs/fr/mkdocs.yml @@ -0,0 +1,42 @@ +site_name: Mobilizon +repo_name: "framasoft/mobilizon" +repo_url: "https://framagit.org/framasoft/mobilizon" +site_dir: "../../site/fr" +extra: + social: + - icon: "fontawesome/brands/twitter" + link: "https://twitter.com/joinmobilizon" +markdown_extensions: + - admonition + - codehilite + - footnotes + - meta + - toc: + permalink: true + - pymdownx.superfences + - pymdownx.magiclink + - pymdownx.smartsymbols + - pymdownx.tabbed + - pymdownx.tilde + - pymdownx.mark +plugins: + - search: + lang: ["fr"] + - git-revision-date-localized + - minify: + minify_html: true +theme: + name: "material" + language: "fr" + features: + - instant + - tabs + custom_dir: "../theme/" + palette: + primary: "amber" + accent: "deep purple" + scheme: slate + font: false + icon: + logo: material/calendar + repo: fontawesome/brands/gitlab diff --git a/docs/javascripts/redirect.js b/docs/javascripts/redirect.js new file mode 100644 index 000000000..6142dda3a --- /dev/null +++ b/docs/javascripts/redirect.js @@ -0,0 +1,18 @@ +const languages = ["fr"]; + +const navigatorLanguage = + window.navigator.userLanguage || window.navigator.language; + +let language; +if (languages.includes(navigatorLanguage)) { + language = navigatorLanguage; +} +const split = navigatorLanguage.split("-")[0]; +if (languages.includes(split)) { + language = split; +} +const url = new URL(window.location.href); +if (language && (url.pathname === "/" || url.pathname.startsWith("/use/"))) { + url.pathname = `/${language}${url.pathname}`; + window.location.replace(url); +} diff --git a/docs/theme/main.html b/docs/theme/main.html new file mode 100644 index 000000000..3aea8be21 --- /dev/null +++ b/docs/theme/main.html @@ -0,0 +1,7 @@ +{% extends "base.html" %} + +{% block site_meta %} + {% if page.is_homepage %} + + {% endif %} +{% endblock %} diff --git a/mkdocs.yml b/mkdocs.yml index 604f35beb..7a2f32751 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,4 +1,5 @@ site_name: Mobilizon +site_url: "https://docs.joinmobilizon.org/" repo_name: "framasoft/mobilizon" repo_url: "https://framagit.org/framasoft/mobilizon" extra: @@ -23,6 +24,9 @@ plugins: - git-revision-date-localized - minify: minify_html: true + - exclude: + glob: + - fr/* theme: name: "material" features: @@ -37,3 +41,5 @@ theme: icon: logo: material/calendar repo: fontawesome/brands/gitlab +extra_javascript: + - javascripts/redirect.js From a40c9fd4b560caba55b9a78d4afb57d3435d78ef Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 21 Oct 2020 09:04:29 +0200 Subject: [PATCH 2/3] Handle timezone not found in preferences Signed-off-by: Thomas Citharel --- js/src/views/Settings/Preferences.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/src/views/Settings/Preferences.vue b/js/src/views/Settings/Preferences.vue index 7e82a5c3b..876daa270 100644 --- a/js/src/views/Settings/Preferences.vue +++ b/js/src/views/Settings/Preferences.vue @@ -39,11 +39,12 @@ - {{ + {{ $t("Timezone detected as {timezone}.", { timezone: Intl.DateTimeFormat().resolvedOptions().timeZone, }) }} + {{ $t("Unable to detect timezone.") }} From b1dcbf191cdda8fa47ccfcc41c96f871b977b018 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 21 Oct 2020 09:19:18 +0200 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=93=96=20Improve=20dependency=20link?= =?UTF-8?q?=20on=20install=20guide?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit People were missing it Signed-off-by: Thomas Citharel --- docs/administration/index.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/administration/index.md b/docs/administration/index.md index f30ce63c9..834ff9944 100644 --- a/docs/administration/index.md +++ b/docs/administration/index.md @@ -12,9 +12,16 @@ ## Dependencies -Mobilizon requires Elixir, NodeJS and PostgreSQL among other things. +Mobilizon requires Elixir, NodeJS and PostgreSQL among other things. Prefer to install Elixir and NodeJS from their official repositories instead of your distribution's packages. -Installing dependencies depends on the system you're using. Follow the steps of the [dependencies guide](dependencies.md). +Recommended versions: + +* Elixir 1.8+ +* NodeJS 12+ +* PostgreSQL 11+ + +!!! important + Installing dependencies depends on the system you're using. Follow the steps of the [dependencies guide](dependencies.md) and come back to this page when done. ## Setup