diff --git a/doc/Makefile b/doc/Makefile deleted file mode 100644 index ce99279b..00000000 --- a/doc/Makefile +++ /dev/null @@ -1,15 +0,0 @@ - -all: install_fr.html install_en.html home_fr.html home_en.html - -install_fr.html: install_fr.md - github-markup install_fr.md >install_fr.html - -install_en.html: install_en.md - github-markup install_en.md >install_en.html - -home_fr.html: home_fr.md - github-markup home_fr.md >home_fr.html - -home_en.html: home_en.md - github-markup home_en.md >home_en.html - diff --git a/doc/README.md b/doc/README.md index 6523a24f..8be9e7c8 100644 --- a/doc/README.md +++ b/doc/README.md @@ -3,5 +3,5 @@ Dependencies: - bootstrap (included) - github-markup https://github.com/github/markup (to be installed) -- make +- submodule git@github.com:AlternC/AlternC.wiki.git in pages/ diff --git a/doc/www/router.php b/doc/www/router.php index 2942f6fd..448cc0f0 100644 --- a/doc/www/router.php +++ b/doc/www/router.php @@ -3,8 +3,11 @@ // List here the supported languages : $otherlang=array( "fr" => "Français", - "en" => "English" + "en" => "English", ); +$locales=array("fr" => "fr_FR.UTF-8", + "en" => "en_GB.UTF-8", + ); $uri=trim($_SERVER["REQUEST_URI"],"/"); @@ -21,12 +24,10 @@ if (!$uri) { exit(); } -if (preg_match('^(.*)-([^-]*)$',$uri,$mat)) { +if (preg_match('#^(.*)-([^-]*)$#',$uri,$mat)) { $lang=$mat[2]; $uri=$mat[1]; } -//list($lang,$uri)=explode("/",$uri,2); - if (!isset($otherlang[$lang])) { header("HTTP/1.0 404 Not Found"); @@ -34,6 +35,13 @@ if (!isset($otherlang[$lang])) { exit(); } +// set locales: +putenv("LC_MESSAGES=".$locales[$lang]); +putenv("LANG=".$locales[$lang]); +putenv("LANGUAGE=".$locales[$lang]); +// this locale MUST be selected in "dpkg-reconfigure locales" +setlocale(LC_ALL,$locales[$lang]); + unset($otherlang[$lang]); header("Content-Type: text/html; charset=UTF-8"); @@ -47,7 +55,7 @@ if (!file_exists("../pages/".$uri."-".$lang.".md")) { // automatic compilation / caching of HTML pages if (!file_exists("../pages/".$uri."-".$lang.".html") || filemtime("../pages/".$uri."-".$lang.".html") < filemtime("../pages/".$uri."-".$lang.".md") ) { - exec("github-markup ".escapeshellarg("../pages/".$uri."-".$lang.".md")." >".escapeshellarg("../pages/".$uri."-".$lang.".html")); + passthru("github-markup ".escapeshellarg("../pages/".$uri."-".$lang.".md")." >".escapeshellarg("../pages/".$uri."-".$lang.".html")." 2>&1"); } $f=fopen("../pages/".$uri."-".$lang.".html","rb");