;;; Nani Project website ;;; Copyright © 2019 Julien Lepiller ;;; ;;; This file is part of the Nani Project website. ;;; ;;; The Nani Project website is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU Affero General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; The Nani Project website is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU Affero General Public License for more details. ;;; ;;; You should have received a copy of the GNU Affero General Public License ;;; along with the Nani Project website. If not, see . (define-module (tools haunt-i18n) #:use-module (haunt builder blog) #:use-module (haunt html) #:use-module (haunt page) #:use-module (sxml simple) #:use-module (ice-9 match) #:use-module (tools i18n) #:export (internationalize)) (define (make-my-page lang title filename body layout) (lambda (site posts) (define (my-body) (site-locale lang) (tr body)) (make-page (if (equal? lang "") (string-append filename ".html") (string-append lang "/" filename ".html")) (with-layout (layout lang filename) site title (my-body)) sxml->html))) (define (internationalize title filename body layout) (map (lambda (lang) (make-my-page lang title filename body layout)) languages))