From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id kB8jCnCFpmUiTAEAqHPOHw:P1 (envelope-from ) for ; Tue, 16 Jan 2024 14:32:32 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id kB8jCnCFpmUiTAEAqHPOHw (envelope-from ) for ; Tue, 16 Jan 2024 14:32:32 +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=EqKEqfXz; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm3 header.b="Z YHgEtJ"; 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"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1705411952; 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=uE35jKLbKYx0v7Uz9x0lzAbPx6fnuXsakCo5dSs7qdY=; b=Ku3HITWlhk4IABs1SuVPj8PoIEWIarpl9c5tJZJGBxbU1xfTMMcF8a2P+LB+HjIl3Cub5t Su2Jozv1GUpSTdR42T6o+LoZGiT1tu7TPPpeuMAHQFuTxcLORJb3R7cGj1CmSOMTOKOGmv Er22twNz51QDRjXg2aOgjVQ4kG+2Bo4yu6YO2LB8DoCbYoP/7HkPMVNI+uLHxuIdBjlmX5 DJzTQDawNUQplZC1rW1zGTHlHzUkWCG5TS7BhwDA69AR4du896HT5vwczgoBEKghU6B9Iz +ao0LkNv9sbM0BNqhyFoCFLq4LlpXdWn5JK01C50QiXE99z6JDFhwCrLtWa3mA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lassieur.org header.s=fm2 header.b=EqKEqfXz; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm3 header.b="Z YHgEtJ"; 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"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1705411952; a=rsa-sha256; cv=none; b=qt0bAy72N76JS5irmiE000nhQUQ0N0f+XAlW97bN0m/DN0zGsONDYccFcnwPzqAi5mA5go NVu+VDcRdsslZ2svlyLFDfPFpFtxHgw8PDR4pI+Q6jx08FDNCh5nYGlIJFku8OqBxjtrbu /YeDm7MAiNaQ4V5F4bOHnAZJCb/FzJ7ULBYeDdSE0K/P22bhdyod2u6y+e8xrkLKn60iEi g08kfERXHfqpNYmjmtEIAogqPHTAPLWFuv2RYjZgM06PmjWuN56EdGK0vSjDPvad9NVrS7 Yc/xohQxhTsO7B1Z3NOXHWJg576xq1j/QRyZczcvq8yWAXOLMfuyRn3I3gq8CQ== 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 2F50B51C75 for ; Tue, 16 Jan 2024 14:32:30 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rPjY8-0004Dq-6k; Tue, 16 Jan 2024 08:32:16 -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 1rPjXu-00046N-GP for guix-patches@gnu.org; Tue, 16 Jan 2024 08:32:04 -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 1rPjXt-0004u3-PY for guix-patches@gnu.org; Tue, 16 Jan 2024 08:32:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rPjXu-0005IQ-0d; Tue, 16 Jan 2024 08:32:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68503] [PATCH v2] gnu: torbrowser: Add support or language localisation. Resent-From: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Original-Sender: "Debbugs-submit" Resent-CC: nandre@riseup.net, guix-patches@gnu.org Resent-Date: Tue, 16 Jan 2024 13:32: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 , =?UTF-8?Q?Andr=C3=A9?= Batista X-Debbugs-Original-Xcc: =?UTF-8?Q?Andr=C3=A9?= Batista Received: via spool by 68503-submit@debbugs.gnu.org id=B68503.170541191920349 (code B ref 68503); Tue, 16 Jan 2024 13:32:01 +0000 Received: (at 68503) by debbugs.gnu.org; 16 Jan 2024 13:31:59 +0000 Received: from localhost ([127.0.0.1]:48157 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rPjXq-0005I8-Es for submit@debbugs.gnu.org; Tue, 16 Jan 2024 08:31:59 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:36881) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rPjXl-0005Ed-7H for 68503@debbugs.gnu.org; Tue, 16 Jan 2024 08:31:56 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 4A0B55C0211; Tue, 16 Jan 2024 08:31:47 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 16 Jan 2024 08:31:47 -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=1705411907; x=1705498307; bh=uE35jKLbKYx0v7Uz9x0lzAbPx6fnuXsakCo5dSs7qdY=; b= EqKEqfXzBnuP7L/oj3Na935uyEkpyENXn1GligVrM+ErgvM6+LScK3ZAC2U/C/Ss uSKJp6iqyMrISFJWeQosFT6OHaXnvE0SywcmtF5WgIBn4eVpKGaOLJLHGEVzF7pB LW51yI0/ShBDg3fT7LJLCHEaKgT2pThLnXB/U2qO96WtsYoco1bCKsZkYAHoaX4q Ssetd7Z2diMkkiPC9aIRu3lK80u+y2MGmO0jKvRTghe7V0EGeH9w6wtY6uk868Cb AdL2vcSNF8uFlORSLbNBRPQvv56t1k3YI985AhZJ/s0VRhCfG6tWvdmISQ9JNo3Q cgYm9FgMSuwHAUIoS0FnYw== 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=1705411907; x= 1705498307; bh=uE35jKLbKYx0v7Uz9x0lzAbPx6fnuXsakCo5dSs7qdY=; b=Z YHgEtJfKx3GP4GA+Dfzp/cFURa17KriJIw4gEAzgSQLPZiP3t6dMXrGiV7J8SqmK rCe7mRIIhlE0ZJJcxUSyqsfgFoDkUc1eGw3L+v0jTpE49w2KTLvmSP541G+3Em9v K5xVK9gLRyFJKzIbSqVMaJk8ySudxZSc/bNSa8hCn/IwQW8z2KkZbzqANjbvl7AD by3CizMTb83/wHOa8PQcyg+VBTIqVntctaKo0Fle9C9frmaER09GgTNIp0Pe9H4z 4TNSWNpj7vsDgf/SkIjulDW7PDROtsrVUKColc1ixvsheRXXpC66JdMVvhavzGGk kklqQ1IB7d2MBAHz1+OTA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdejfedgheefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfgggtgfesth ekredtredtjeenucfhrhhomhepvehlrohmvghnthcunfgrshhsihgvuhhruceotghlvghm vghntheslhgrshhsihgvuhhrrdhorhhgqeenucggtffrrghtthgvrhhnpeegtdefkedtve egueehkedukeffkeetieffleevudfggedvteekkedvveeujeekveenucffohhmrghinhep thhorhhprhhojhgvtghtrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrg hmpehmrghilhhfrhhomheptghlvghmvghntheslhgrshhsihgvuhhrrdhorhhg X-ME-Proxy: Feedback-ID: i4c21472a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 16 Jan 2024 08:31:45 -0500 (EST) From: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Date: Tue, 16 Jan 2024 14:31:17 +0100 Message-ID: <3ac58217a296eea03f2709937526f7e0eab10d52.1705411299.git.clement@lassieur.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: 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-Spam-Score: -1.78 X-Migadu-Scanner: mx13.migadu.com X-Spam-Score: -1.78 X-Migadu-Queue-Id: 2F50B51C75 X-TUID: MWh707qQce6y * 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]: Add ‘copy-locales’ and ‘build-locales’ phases. Change-Id: Ia5b28fa5d885f24140893dc270e57e83b0250c67 --- gnu/packages/gnuzilla.scm | 3 +- gnu/packages/tor.scm | 101 +++++++++++++++++++++++++++++++++++++- 2 files changed, 102 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..8752cd67ef37 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 @@ -591,6 +621,68 @@ (define-public torbrowser (for-each (lambda (flag) (format #t "ac_add_options ~a~%" flag)) configure-flags))))) + ;; See tor-browser-build/projects/firefox/build. + (add-before 'configure 'copy-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") + (copy-recursively #$translation-tor-browser + "translation-tor-browser") + (mkdir-p l10ncentral) + (for-each + (lambda (lang) + ;; Firefox locales + (copy-recursively (find (lambda (path) + (string-suffix? lang path)) + '#$all-mozilla-locales) + (in-vicinity l10ncentral lang)) + ;; Base Browser locales + (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)) + ;; Tor Browser locales + (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)))) (replace 'configure (lambda _ (invoke "./mach" "configure"))) @@ -607,6 +699,13 @@ (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 _ + (setenv "MOZ_CHROME_MULTILOCALE" + (string-join '#$%torbrowser-locales)) + (apply invoke "./mach" "package-multi-locale" "--locales" + "en-US" '#$%torbrowser-locales))) (add-after 'install 'deploy-assets (lambda* (#:key inputs #:allow-other-keys) (let ((assets #$(this-package-input "torbrowser-assets")) base-commit: 551d013a56bf7d22bac80e0fd21d971973c3cf6f -- 2.41.0