diff options
Diffstat (limited to 'disfluid/maintainer/update-po.scm')
-rw-r--r-- | disfluid/maintainer/update-po.scm | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/disfluid/maintainer/update-po.scm b/disfluid/maintainer/update-po.scm new file mode 100644 index 0000000..37ef174 --- /dev/null +++ b/disfluid/maintainer/update-po.scm @@ -0,0 +1,58 @@ +;; disfluid, implementation of the Solid specification +;; Copyright (C) 2022 Vivien Kraus + +;; This program 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. + +;; This program 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 this program. If not, see <https://www.gnu.org/licenses/>. + +(define-module (disfluid maintainer update-po) + #:use-module (disfluid maintainer update-repository) + #:use-module (disfluid maintainer local-package) + #:use-module (guix gexp) + #:use-module (guix packages) + #:use-module (gnu packages base) + #:declarative? #t + #:export (update-po)) + +(define (update-po) + (let ((pkg (local-package))) + (let ((updated-po + (computed-file + "fixed-po-files" + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + (use-modules (ice-9 rdelim)) + (invoke + #$(file-append tar "/bin/tar") + "xf" + #$(file-append + pkg + "/share/disfluid/complete-corresponding-source.tar.gz")) + (with-directory-excursion + (string-append "disfluid-" #$(package-version pkg)) + (let ((out (string-append #$output "/po"))) + (mkdir-p out) + (copy-file "po/disfluid.pot" + (string-append out "/disfluid.pot")) + (call-with-input-file "po/LINGUAS" + (lambda (port) + (let loop () + (let ((next (read-line port))) + (unless (eof-object? next) + (when (not (string-prefix? "#" next)) + (copy-file + (format #f "po/~a.po" next) + (format #f "~a/~a.po" out next))) + (loop))))))))))))) + (update-repository "translations" updated-po + "Automatic translations synchronization")))) |