diff options
author | Ludovic Courtès <ludo@gnu.org> | 2020-04-21 22:23:54 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2020-04-21 23:52:19 +0200 |
commit | 84c37e636804513f1fde1fe437784400d99e268e (patch) | |
tree | 5fea9eb322052e2340082e52a1624c548ce5757d | |
parent | cc753650eccf3dcbf074999c458e42df8d3c0827 (diff) | |
download | patches-84c37e636804513f1fde1fe437784400d99e268e.tar patches-84c37e636804513f1fde1fe437784400d99e268e.tar.gz |
self: translate-texi-manuals: Add 'available-translations'.
* guix/self.scm (translate-texi-manuals)[build](available-translations):
New procedure.
Use it rather than directly calling 'find-files' & co.
-rw-r--r-- | guix/self.scm | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/guix/self.scm b/guix/self.scm index 93dcb9bee3..3cc1003c3a 100644 --- a/guix/self.scm +++ b/guix/self.scm @@ -363,12 +363,25 @@ a list of extra files, such as '(\"contributing\")." translations)))))) (cons prefix extras)))) - (for-each (lambda (po) - (match (reverse (string-split po #\.)) - ((_ lang _ ...) - (translate-texi "guix" po lang - #:extras '("contributing"))))) - (find-files "." "^guix-manual\\.[a-z]{2}(_[A-Z]{2})?\\.po$")) + (define (available-translations directory domain) + ;; Return the list of available translations under DIRECTORY for + ;; DOMAIN, a gettext domain such as "guix-manual". The result is + ;; a list of language/PO file pairs. + (filter-map (lambda (po) + (let ((base (basename po))) + (and (string-prefix? (string-append domain ".") + base) + (match (string-split base #\.) + ((_ ... lang "po") + (cons lang po)))))) + (find-files directory + "\\.[a-z]{2}(_[A-Z]{2})?\\.po$"))) + + (for-each (match-lambda + ((language . po) + (translate-texi "guix" po language + #:extras '("contributing")))) + (available-translations "." "guix-manual")) (for-each (lambda (file) |