Commit df67f0af authored by Fabien Maniere's avatar Fabien Maniere

First WIP poc with hakyll translations

parent e90be9ee
packages:
./
/home/fabien/projects/hakyll-source/packages/hakyll-contrib-i18n/
---
title: GarganText - écosystème numérique décentralisé libre, fiable, transparent et intelligible
title: Bienvenue dans le projet GarganText
description: Exploration de vos données dans un écosystème numérique décentralisé libre et fiable, transparent et intelligible. La complexité de vos données devient un atout.
keywords: gargantext, libre, fiable, transparent, intelligible, écosystème, décentralisé, cartographie, cartographie des connaissances, spatialisation des connaissances
---
......
---
#
# Translations for the French language.
# It has higher precedence than the one in the templates directory
#
# /!\ This file must exist /!\
#
translation:
# Global
SITE_TITLE : "GarganText - écosystème numérique décentralisé libre, fiable, transparent et intelligible"
# Header / Navigation
NAV_DISCOVER : "Découvrir"
NAV_LEARN : "Se former"
NAV_CONNECT : "Se connecter"
NAV_SOURCE_CODE : "Code source"
# Footer
NAV_LEGAL_INFO : "Mentions légales"
\ No newline at end of file
name: gargantext-org-website
version: 0.1.0.0
build-type: Simple
cabal-version: >= 1.10
cabal-version: >= 2.0
executable site
main-is: site.hs
build-depends: base == 4.*
, hakyll == 4.16.*
, hakyll-contrib-i18n ^>= 0.1.1.1
, network-uri
, time
ghc-options: -threaded -rtsopts -with-rtsopts=-N
......
......@@ -2,6 +2,15 @@
{-# LANGUAGE OverloadedStrings #-}
import Data.Monoid (mappend)
import Hakyll
import Hakyll.Contrib.I18n
( Language
, categoryField'
, feedConfiguration
, tagsField'
, translate
, translationCompiler
, translationContext
)
import Data.List (sortBy)
import Data.Ord (comparing)
import Data.Time.Clock (getCurrentTime)
......@@ -12,8 +21,9 @@ import Network.URI (parseURI, uriAuthority, uriRegName)
--------------------------------------------------------------------------------
main :: IO ()
main = hakyllWith config $ do
-- enTranslations <- loadTranslations "translations/en.json"
-- frTranslations <- loadTranslations "translations/fr.json"
match "*/translation.yml" $
compile translationCompiler
-- Static files
match ("js/*" .||. "images/*" .||. "favicon/*" .||. "css/fonts/*") $ do
......@@ -61,6 +71,9 @@ main = hakyllWith config $ do
route idRoute
compile $ do
defaultTranslation <- loadBody "templates/translation.yml"
makeItem $ Redirect $ translate defaultTranslation "DEFAULT_LANGUAGE"
discoverPresentation <- loadAll "tiles/discover/presentation/*"
discoverVideos <- loadAll "tiles/discover/videos/*"
......
......@@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
<title>$title$</title>
<title>$translate("SITE_TITLE")$ - $title$</title>
$if(description)$<meta name="description" content="$description$">$endif$
$if(keywords)$<meta name="keywords" content="$keywords$">$endif$
<link rel="icon" href="/favicon/favicon.ico">
......
<footer class="bg-green justify-content-center align-items-center text-center p-4 mt-5">
<div class="footer-bottom text-light text-center py-5 "><a href="https://gitlab.iscpif.fr/gargantext/main/raw/master/LICENSE" target="_blank" class="text-light">Mentions légales <i class="fa fa-external-link " aria-hidden="true"></i></a> - © GarganText $year$</div>
<div class="footer-bottom text-light text-center py-5 "><a href="https://gitlab.iscpif.fr/gargantext/main/raw/master/LICENSE" target="_blank" class="text-light">$translate("NAV_LEGAL_INFO")$ <i class="fa fa-external-link " aria-hidden="true"></i></a> - © GarganText $year$</div>
<ul class="logos list-unstyled list-inline">
<li class="list-inline-item"><a href="https://www.cnrs.fr" target="_blank" class="footer-link"><img src="/images/logo-cnrs-white.png" alt="CNRS - Centre national de la recherche scientifique" class="logo logo-iscpif"></a></li>
<li class="list-inline-item"><a href="https://www.cnrs.fr" target="_blank" class="footer-link"><img src="/images/logo-cnrs-white.png" alt="$translate("NAV_LABEL_CNRS")$" class="logo logo-iscpif"></a></li>
<a class="list-inline-item"><a href="https://iscpif.fr" target="_blank" class="footer-link"><img src="/images/logo-iscpif.png" alt="ISCPIF - Institut des systèmes complexes Paris Ile-de-France" class="logo logo-cnrs"></a></li>
</ul>
</footer>
......@@ -16,7 +16,7 @@
<div class="collapse navbar-collapse" id="navbarTogglerGarg">
<ul class="navbar-nav ms-auto me-5 mb-2 mb-lg-0 text-center">
<li class="nav-item">
<a class="nav-link text-dark" href="#discover">Découvrir</a>
<a class="nav-link text-dark" href="#discover">$translate("NAV_DISCOVER")$</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" href="#learn">Se former</a>
......@@ -27,10 +27,9 @@
<li class="nav-item small mx-3">
<a class="nav-link bg-light" href="https://gitlab.iscpif.fr/gargantext/main" target="_blank" title="Code source de GarganText sur Gitlab"><i class="fa fa-git-square fa-lg" aria-hidden="true"></i> Code source <sup><i class="fa fa-external-link" aria-hidden="true"></i></sup></a>
</li>
<!-- <li class="nav-item ms-lg-5 d-flex ">
<a class="nav-link" aria-current="page" href="#" title="English">🇬🇧</a>
<span class="px-1 small">|</span><a class="nav-link" aria-current="page" href="#">🇨🇵</a>
</li> -->
<li class="nav-item ms-lg-5 d-flex ">
<a class="nav-link" aria-current="page" href="/en" title="English">🇬🇧</a><span class="px-1 small">|</span><a class="nav-link" aria-current="page" href="/fr">🇨🇵</a>
</li>
</ul>
</div>
</div>
......
<div class="row row-cols-1 row-cols-lg-2 g-4"></div>
$for(tiles)$
<div class="col">
<div class="card h-100 border-0 bg-transparent" style="">
<div class="row g-0">
$if(image)$
<div class="img-wrapper col-md-5">
<img src="$image$" class="img-fluid rounded-start" alt="...">
</div>
$endif$
<div class="col-md-7">
<div class="card-body pt-0">
<h5 class="card-title">$title$</h5>
<p class="card-text">$description$</p>
<p class="card-text"><small class="text-muted">$url$ <i class="fa fa-external-link " aria-hidden="true"></i></small></p>
<a href="$url$" target="_blank" class="btn btn-primary">Voir <i class="fa fa-external-link " aria-hidden="true"></i></a>
</div>
</div>
</div>
</div>
</div>
$endfor$
</div>
---
#
# Translations in this file act as default.
# The can be overridden in language specific translations.
#
# /!\ This file must exist /!\
#
translation:
DEFAULT_LANGUAGE : fr
FEED_AUTHOR_EMAIL : your.email@add.ress
FEED_AUTHOR_NAME : Your NAME
FEED_ROOT : Your site's url
FEED_TITLE : Your site's name
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment