From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id SDC5HiOrqWW4nAAA62LTzQ:P1 (envelope-from ) for ; Thu, 18 Jan 2024 23:50:11 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id SDC5HiOrqWW4nAAA62LTzQ (envelope-from ) for ; Thu, 18 Jan 2024 23:50:11 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lassieur.org header.s=fm2 header.b=YUshavz8; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm3 header.b="X XIKLva"; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1705618211; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=XXS2dU1cZOWej46RDLNJKLrworaGA7sHiDYt36whYUY=; b=UvrnsJZatPUcKI5kxFlu6r5q9AOMaflP0RQggDez6xs7Kbp96cBkcUnMiE7xorkrq/16cN asalzUwgeKGZGXI/aasEL8UGh06R9OOlD5C/dD+qI2QVXoZLprwdfrw6E/uYodtgnwRYm2 DEg4RCfkENAW/odyhGs6uqmRW0++fMqSNdKU/RMrNnpva+X0U8fn97MVU/7oeQX1yYi3sU mvMkDHTWNywu108mefrcf8Zi7Wdx9I+ggp0RqlDT55FbywqWoBmlDJ/+fWyqMKFEDB2wuz 7wnOHmmMmB0nGnipyA2YrMALRV+ytW3KWbNpRwglxOuqrun9xDgJ9FoosBVFxQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1705618211; a=rsa-sha256; cv=none; b=pZifYz0cW0VAW7RL94Ub1raSpcSpL8NTN0Ku3efkDRh4H9PR0EW4oxHsXiIA6I8LJH68AB 9CBjApz28WUvCOw/IcwyAjJ/IDnsDjp2HV1sospahJcSu4AF5mJ5jEgx6PWImQVsVsw/3Y dZ6DkOEJ3qQ9ZQ/UyVv+TnMlL70iSrSIzuE24VNZjILIDr1C34mv6yp6Gmrm8i7aH8wObZ WQ/G5iIj0Anbeg02A1t4804W10FITgl4GZxJRIrMvOwxEKdHOy1hMsohzUtGB1fRRWriwG 1CpWZPYsZH3dL/XE5UKqRrxG5m4EF5P0tkn1UYwqNYixQmBSlLNMc9YTvEpbMw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lassieur.org header.s=fm2 header.b=YUshavz8; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm3 header.b="X XIKLva"; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 4DAAF730D0 for ; Thu, 18 Jan 2024 23:50:10 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQbD0-0004wu-I5; Thu, 18 Jan 2024 17:50:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQbCy-0004wM-LI for guix-patches@gnu.org; Thu, 18 Jan 2024 17:50:00 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rQbCy-0004tQ-CG for guix-patches@gnu.org; Thu, 18 Jan 2024 17:50:00 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rQbCz-0000VY-PI for guix-patches@gnu.org; Thu, 18 Jan 2024 17:50:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68503] [PATCH v3] gnu: torbrowser: Add support for language localisation. Resent-From: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 18 Jan 2024 22:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68503 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68503@debbugs.gnu.org Cc: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Received: via spool by 68503-submit@debbugs.gnu.org id=B68503.17056181941923 (code B ref 68503); Thu, 18 Jan 2024 22:50:01 +0000 Received: (at 68503) by debbugs.gnu.org; 18 Jan 2024 22:49:54 +0000 Received: from localhost ([127.0.0.1]:56913 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rQbCr-0000Uv-8w for submit@debbugs.gnu.org; Thu, 18 Jan 2024 17:49:53 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:51249) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rQbCo-0000Ug-Hw for 68503@debbugs.gnu.org; Thu, 18 Jan 2024 17:49:52 -0500 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 06C485C0167; Thu, 18 Jan 2024 17:49:43 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Thu, 18 Jan 2024 17:49:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lassieur.org; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1705618183; x=1705704583; bh=XXS2dU1cZOWej46RDLNJKLrworaGA7sHiDYt36whYUY=; b= YUshavz8dS8Dp1pjIvph2Ci3wWs8Ap7FDxAcxJ1238ZFWgJlc1Js6v2MzXKlaOTD RoPSpe630aHYjSnUQzZ7vBodEogPZeaV5BpLF02qhxPcJLTaNwtBXxdioh5nIc05 tlb+BuA9WFI0lB51/kEISfEE3EDwtnhfRTP8suP5Qn0+Snn+y4aRG5SXstEc7I// Lltk22KuRIS8bSt0wlO1Ig2GmFWTigcFzwr7sPmrel7k8nYI5Op15TwUL6ZK7hoY iOzDVnpe9wMMNMi113Ed9As0UZyl6eE/F8vVa5+6sbl9k1nSeOeAzcJhx4jPdsyr YXWj60EhOFsiy/qcaaFDgA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1705618183; x= 1705704583; bh=XXS2dU1cZOWej46RDLNJKLrworaGA7sHiDYt36whYUY=; b=X XIKLvaW4H6TW9pWieWEUHJLUDQs5z4JPOLkmf042lEq46hAlRm7tse1sXexdvSzG olXQVwKzv5svjO8X80i7UnDlKxvr8ihO1lESRpsDPAPbWmY6QnEuJzg4bTvx+3UX hc+2tiONhhcJ+BuN3SX4NPWy+2agYnK3Ih1ha8xhV2Xycr2MVh+bxmm/pa71uJB6 2qZwx/5cZolgI5bDrfcKfbIyI3K5w96hI9KTDgo2CmeegVaX/55Cx3hbpQsZk1rE 6FilreQF1rygCvGccXG4nt2aNmlvNv4oF8AKGSaZVQMfL590B25ydhna7AouQoWu Hdd+kafX6ZuF5W2y8K89Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdejledgtdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfgggtgfesth ekredtredtjeenucfhrhhomhepvehlrohmvghnthcunfgrshhsihgvuhhruceotghlvghm vghntheslhgrshhsihgvuhhrrdhorhhgqeenucggtffrrghtthgvrhhnpeegtdefkedtve egueehkedukeffkeetieffleevudfggedvteekkedvveeujeekveenucffohhmrghinhep thhorhhprhhojhgvtghtrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrg hmpehmrghilhhfrhhomheptghlvghmvghntheslhgrshhsihgvuhhrrdhorhhg X-ME-Proxy: Feedback-ID: i4c21472a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 18 Jan 2024 17:49:41 -0500 (EST) From: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Date: Thu, 18 Jan 2024 23:46:49 +0100 Message-ID: <5134d59e3a0e6749baaff2581f12cffa1fd0f363.1705615319.git.clement@lassieur.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <3ac58217a296eea03f2709937526f7e0eab10d52.1705411299.git.clement@lassieur.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -1.79 X-Spam-Score: -1.79 X-Migadu-Queue-Id: 4DAAF730D0 X-TUID: a9nrfs9JkdV7 * gnu/packages/gnuzilla.scm (all-mozilla-locales): Export it. * gnu/packages/tor.scm (%torbrowser-locales, translation-base-browser, translation-tor-browser): New variables. (torbrowser)[arguments]: In ‘setenv’ phase, set MOZ_CHROME_MULTILOCALE. Add ‘copy-firefox-locales’, ‘copy-basebrowser-locales’, ‘copy-torbrowser-locales’ and ‘build-locales’ phases. Change-Id: Ia5b28fa5d885f24140893dc270e57e83b0250c67 --- gnu/packages/gnuzilla.scm | 3 +- gnu/packages/tor.scm | 112 +++++++++++++++++++++++++++++++++++++- 2 files changed, 113 insertions(+), 2 deletions(-) diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm index ea5de680e5d0..e3bc625bc0f5 100644 --- a/gnu/packages/gnuzilla.scm +++ b/gnu/packages/gnuzilla.scm @@ -98,7 +98,8 @@ (define-module (gnu packages gnuzilla) #:use-module (gnu packages xdisorg) #:use-module (gnu packages readline) #:use-module (gnu packages sqlite) - #:autoload (json parser) (json->scm)) + #:autoload (json parser) (json->scm) + #:export (all-mozilla-locales)) (define-public mozjs (package diff --git a/gnu/packages/tor.scm b/gnu/packages/tor.scm index b20e17e4cea8..fbd5f0a0af78 100644 --- a/gnu/packages/tor.scm +++ b/gnu/packages/tor.scm @@ -13,7 +13,7 @@ ;;; Copyright © 2021-2023 Danial Behzadi ;;; Copyright © 2022 Maxim Cournoyer ;;; Copyright © 2022 Jim Newsome -;;; Copyright © 2023 Clément Lassieur +;;; Copyright © 2023, 2024 Clément Lassieur ;;; ;;; This file is part of GNU Guix. ;;; @@ -503,6 +503,36 @@ (define %torbrowser-version "13.0.8") ;; "src-firefox-tor-browser-". (define %torbrowser-firefox-version "115.6.0esr-13.0-1-build2") +;; Use the list in tor-browser-build/rbm.conf. +(define %torbrowser-locales + '("ar" "ca" "cs" "da" "de" "el" "es-ES" "fa" "fi" "fr" "ga-IE" "he" "hu" + "id" "is" "it" "ja" "ka" "ko" "lt" "mk" "ms" "my" "nb-NO" "nl" "pl" + "pt-BR" "ro" "ru" "sq" "sv-SE" "th" "tr" "uk" "vi" "zh-CN" "zh-TW")) + +;; See tor-browser-build/projects/translation/config. +(define translation-base-browser + (origin + (method git-fetch) + (uri (git-reference + (url "https://gitlab.torproject.org/tpo/translation.git") + (commit "5490489a8d356a44d792300b4dfddba792d10f2e"))) + (file-name "translation-base-browser") + (sha256 + (base32 + "1knxary2zp2705xzzs76gpy37ri69yp32ajpmpxki3z5hp7mla7q")))) + +;; See tor-browser-build/projects/translation/config. +(define translation-tor-browser + (origin + (method git-fetch) + (uri (git-reference + (url "https://gitlab.torproject.org/tpo/translation.git") + (commit "e92772b4a11ced855c27eafd299cf972bef5cd8f"))) + (file-name "translation-tor-browser") + (sha256 + (base32 + "0q3gcq7s58110d9y4x8zyby6cn36msry6z3va7xw8sam3pp7p8nj")))) + (define torbrowser-assets ;; This is a prebuilt Torbrowser from which we take the assets we need. (package @@ -581,6 +611,8 @@ (define-public torbrowser ;; $HOME/.mozbuild). (setenv "MOZBUILD_STATE_PATH" (in-vicinity (getcwd) ".mozbuild")) + (setenv "MOZ_CHROME_MULTILOCALE" + (string-join '#$%torbrowser-locales)) ;; Make build reproducible. (setenv "MOZ_BUILD_DATE" #$%moz-build-date))) (add-before 'configure 'mozconfig @@ -594,6 +626,79 @@ (define-public torbrowser (replace 'configure (lambda _ (invoke "./mach" "configure"))) + ;; See tor-browser-build/projects/firefox/build. + (add-before 'configure 'copy-firefox-locales + (lambda _ + (let ((l10ncentral ".mozbuild/l10n-central")) + (mkdir-p l10ncentral) + (for-each + (lambda (lang) + (copy-recursively (find (lambda (path) + (string-suffix? lang path)) + '#$all-mozilla-locales) + (in-vicinity l10ncentral lang))) + '#$%torbrowser-locales)))) + (add-after 'copy-firefox-locales 'copy-basebrowser-locales + (lambda _ + (let ((l10ncentral ".mozbuild/l10n-central")) + ;; Temporary copy so that we can use ‘mv’ to mimic + ;; tor-browser-build/projects/firefox/build. + (copy-recursively #$translation-base-browser + "translation-base-browser") + (for-each + (lambda (lang) + (system + (format + #f (string-join + '("mv" + "translation-base-browser/~a/base-browser.ftl" + "~a/~a/browser/browser/")) + lang l10ncentral lang)) + (system + (format + #f (string-join + '("mv" + "translation-base-browser/~a/*" + "~a/~a/browser/chrome/browser/")) + lang l10ncentral lang))) + '#$%torbrowser-locales)))) + (add-after 'copy-basebrowser-locales 'copy-torbrowser-locales + (lambda _ + (let ((l10ncentral ".mozbuild/l10n-central")) + ;; Temporary copy so that we can use ‘mv’ to mimic + ;; tor-browser-build/projects/firefox/build. + (copy-recursively #$translation-tor-browser + "translation-tor-browser") + (for-each + (lambda (lang) + (system + (format + #f (string-join + '("mv" + "translation-tor-browser/~a/tor-browser.ftl" + "~a/~a/browser/browser/")) + lang l10ncentral lang)) + (system + (format + #f (string-join + '("mv" + "translation-tor-browser/~a/cryptoSafetyPrompt.properties" + "~a/~a/browser/chrome/browser/")) + lang l10ncentral lang)) + (system + (format + #f (string-join + '("mv" + "translation-tor-browser/~a" + "toolkit/torbutton/chrome/locale/")) + lang)) + (let ((port (open-file "toolkit/torbutton/jar.mn" "a"))) + (format port "% locale torbutton ~a %locale/~a/~%" + lang lang) + (format port " locale/~a/ (chrome/locale/~a/*)~%" + lang lang) + (close port))) + '#$%torbrowser-locales)))) (add-before 'build 'fix-addons-placeholder (lambda _ (substitute* @@ -607,6 +712,11 @@ (define-public torbrowser "#include ../../../tools/torbrowser/bridges.js" port) (newline port) (close port)))) + ;; See tor-browser-build/projects/firefox/build. + (add-after 'build 'build-locales + (lambda _ + (system (string-join '("./mach package-multi-locale --locales" + "en-US $MOZ_CHROME_MULTILOCALE"))))) (add-after 'install 'deploy-assets (lambda* (#:key inputs #:allow-other-keys) (let ((assets #$(this-package-input "torbrowser-assets")) base-commit: 551d013a56bf7d22bac80e0fd21d971973c3cf6f -- 2.41.0