* gnu/packages/gnuzilla.scm (update-mozilla-locales): New procedure.
(all-mozilla-locales): Comment how to proceed to update it.
---

(no changes since v1)

 gnu/packages/gnuzilla.scm | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm
index b2e0870fea..2011555d47 100644
--- a/gnu/packages/gnuzilla.scm
+++ b/gnu/packages/gnuzilla.scm
@@ -37,6 +37,7 @@
 
 (define-module (gnu packages gnuzilla)
   #:use-module ((srfi srfi-1) #:hide (zip))
+  #:use-module (ice-9 format)
   #:use-module (ice-9 match)
   #:use-module (gnu packages)
   #:use-module ((guix licenses) #:prefix license:)
@@ -91,7 +92,8 @@ (define-module (gnu packages gnuzilla)
   #:use-module (gnu packages xiph)
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages readline)
-  #:use-module (gnu packages sqlite))
+  #:use-module (gnu packages sqlite)
+  #:autoload (json parser) (json->scm))
 
 (define-public mozjs
   (package
@@ -348,6 +350,10 @@ (define-public mozjs-78
     (inputs
      (list icu4c readline zlib))))
 
+
+;;;
+;;; Localization helper procedures.
+;;;
 (define mozilla-compare-locales
   (origin
     (method hg-fetch)
@@ -371,6 +377,27 @@ (define-syntax-rule (mozilla-locales (hash-string 
changeset locale) ...)
   (list (mozilla-locale locale changeset hash-string)
         ...))
 
+(define (update-mozilla-locales changesets.json)
+  "Output a new list of Mozilla locales, to update the ALL-MOZILLA-LOCALES
+variable defined bellow.  It requires guile-json to be installed."
+  ;; To extract the file used as argument, do:
+  ;; tar -xf $(./pre-inst-env guix build \
+  ;;  -e '(@@ (gnu packages gnuzilla) upstream-firefox-source)') \
+  ;;  --strip-components=3 \
+  ;;  --wildcards '*/browser/locales/l10n-changesets.json'
+  (match (call-with-input-file changesets.json json->scm)
+    (((lang ("revision" . revision) platforms pin) ...)
+     (let ((data (reverse (map (lambda (rev lang)
+                                 `(,(list->string (make-list 40 #\0))
+                                   ,(string-take rev 12) ,lang))
+                               revision lang))))
+       (format #t "~{~s~%~}" data)
+       data))))
+
+;;; This list must be maintained by hand by comparing with the entries in the
+;;; browser/locales/l10n-changesets.json file in the Firefox source (see the
+;;; 'update-mozilla-locales' procedure above which aims to make this a bit
+;;; easier).
 (define all-mozilla-locales
   (mozilla-locales
    ;;                      sha256                            changeset    
locale

base-commit: 47439697aeed1d8788e7fc4c02ef1c610e0b4151
-- 
2.39.1




Reply via email to