Merge branch 'multi-lingual-docs' into 'master'

Introduce multi-lingual docs

See merge request framasoft/mobilizon!625
This commit is contained in:
Thomas Citharel 2020-10-21 09:30:22 +02:00
commit dc9da523be
9 changed files with 97 additions and 5 deletions

View File

@ -108,6 +108,7 @@ pages:
script: script:
- mkdir public - mkdir public
- mkdocs build - mkdocs build
- cd docs/fr && mkdocs build
- mv site/* public/ - mv site/* public/
# Mix docs disabled because of https://github.com/elixir-lang/ex_doc/issues/1172 # Mix docs disabled because of https://github.com/elixir-lang/ex_doc/issues/1172
# - mix deps.get # - mix deps.get

View File

@ -1,11 +1,11 @@
FROM elixir:latest FROM elixir:latest
LABEL maintainer="Thomas Citharel <tcit@tcit.fr>" LABEL maintainer="Thomas Citharel <tcit@tcit.fr>"
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 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 curl -sL https://deb.nodesource.com/setup_12.x | bash && apt-get install nodejs -yq
RUN npm install -g yarn wait-on RUN npm install -g yarn wait-on
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN mix local.hex --force && mix local.rebar --force 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/ 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/

View File

@ -12,9 +12,16 @@
## Dependencies ## 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 ## Setup

10
docs/fr/docs/index.md Normal file
View File

@ -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)

42
docs/fr/mkdocs.yml Normal file
View File

@ -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

View File

@ -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);
}

7
docs/theme/main.html vendored Normal file
View File

@ -0,0 +1,7 @@
{% extends "base.html" %}
{% block site_meta %}
{% if page.is_homepage %}
<link rel="alternate" hreflang="fr" href="{{ config.site_url }}fr/" />
{% endif %}
{% endblock %}

View File

@ -39,11 +39,12 @@
</optgroup> </optgroup>
</b-select> </b-select>
</b-field> </b-field>
<em>{{ <em v-if="Intl.DateTimeFormat().resolvedOptions().timeZone">{{
$t("Timezone detected as {timezone}.", { $t("Timezone detected as {timezone}.", {
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone, timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
}) })
}}</em> }}</em>
<b-message v-else type="is-danger">{{ $t("Unable to detect timezone.") }}</b-message>
</div> </div>
</div> </div>
</template> </template>

View File

@ -1,4 +1,5 @@
site_name: Mobilizon site_name: Mobilizon
site_url: "https://docs.joinmobilizon.org/"
repo_name: "framasoft/mobilizon" repo_name: "framasoft/mobilizon"
repo_url: "https://framagit.org/framasoft/mobilizon" repo_url: "https://framagit.org/framasoft/mobilizon"
extra: extra:
@ -23,6 +24,9 @@ plugins:
- git-revision-date-localized - git-revision-date-localized
- minify: - minify:
minify_html: true minify_html: true
- exclude:
glob:
- fr/*
theme: theme:
name: "material" name: "material"
features: features:
@ -37,3 +41,5 @@ theme:
icon: icon:
logo: material/calendar logo: material/calendar
repo: fontawesome/brands/gitlab repo: fontawesome/brands/gitlab
extra_javascript:
- javascripts/redirect.js