From unknown Sun Aug 10 00:26:36 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#52736 <52736@debbugs.gnu.org> To: bug#52736 <52736@debbugs.gnu.org> Subject: Status: [PATCH] home: services: Make strings in Gexps translateble. Reply-To: bug#52736 <52736@debbugs.gnu.org> Date: Sun, 10 Aug 2025 07:26:36 +0000 retitle 52736 [PATCH] home: services: Make strings in Gexps translateble. reassign 52736 guix-patches submitter 52736 Xinglu Chen severity 52736 normal tag 52736 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 22 10:37:30 2021 Received: (at submit) by debbugs.gnu.org; 22 Dec 2021 15:37:31 +0000 Received: from localhost ([127.0.0.1]:59554 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n03gI-0000AV-Be for submit@debbugs.gnu.org; Wed, 22 Dec 2021 10:37:30 -0500 Received: from lists.gnu.org ([209.51.188.17]:40682) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n03gH-0000AO-CZ for submit@debbugs.gnu.org; Wed, 22 Dec 2021 10:37:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45806) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n03gD-000161-J6 for guix-patches@gnu.org; Wed, 22 Dec 2021 10:37:29 -0500 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:49264 helo=mail.yoctocell.xyz) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n03gA-0002sv-NL for guix-patches@gnu.org; Wed, 22 Dec 2021 10:37:25 -0500 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yoctocell.xyz; s=mail; t=1640187438; bh=tIjgewu1okVz/b1F2Pu1SSoLo0wMF5KhgyQW7JRHgqM=; h=From:To:Subject:Date; b=CvfZqIWtcTXTq8NVwSsrOxT+nju2xnFfU+vUOrS8hDQ0j67fP12gJowADiT3m9Wec mQOg47NTvkmJzVmG2gMbWwSvMUVsYKdo8tLdCL/iO5YCtuOayc1Js2kPtGHyIlXCp0 beGdgwQ3CKV3FmlyHegtuAXyZHuZbqRZi5rd2HHA= To: guix-patches@gnu.org Subject: [PATCH] home: services: Make strings in Gexps translateble. X-Debbugs-CC: Ludovic =?utf-8?Q?Court=C3=A8s?= Message-Id: Date: Wed, 22 Dec 2021 16:37:09 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=87.96.130.155; envelope-from=public@yoctocell.xyz; helo=mail.yoctocell.xyz X-Spam_score_int: 18 X-Spam_score: 1.8 X-Spam_bar: + X-Spam_report: (1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, FROM_SUSPICIOUS_NTLD_FP=0.397, PDS_OTHER_BAD_TLD=1.999, PDS_RDNS_DYNAMIC_FP=0.01, RDNS_DYNAMIC=0.982, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, TO_NO_BRKTS_DYNIP=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.7 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: * gnu/home/services.scm (%initialize-gettext): New variable. (compute-on-first-login-script): Use it. (compute-on-change-gexp): Likewise. * gnu/home/services/symlink-manager.scm (update-symlinks-scrip [...] Content analysis details: (1.7 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [209.51.188.17 listed in list.dnswl.org] 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.51.188.17 listed in wl.mailspike.net] 0.5 FROM_SUSPICIOUS_NTLD_FP From abused NTLD 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.1 (/) * gnu/home/services.scm (%initialize-gettext): New variable. (compute-on-first-login-script): Use it. (compute-on-change-gexp): Likewise. * gnu/home/services/symlink-manager.scm (update-symlinks-script): Likewise. * po/guix/POTFILES.in: Add gnu/home-services.scm and gnu/home/services/symlink-manager.scm. Suggested-by: Ludovic Court=C3=A8s Link: --- Is there a way to test if these strings are actually translatable without pushing this to the Git repo and going to Weblate to check? gnu/home/services.scm | 66 ++++++++++++++++++--------- gnu/home/services/symlink-manager.scm | 42 +++++++++-------- po/guix/POTFILES.in | 2 + 3 files changed, 69 insertions(+), 41 deletions(-) diff --git a/gnu/home/services.scm b/gnu/home/services.scm index 1aeca95e5a..2a3cb44952 100644 --- a/gnu/home/services.scm +++ b/gnu/home/services.scm @@ -19,6 +19,7 @@ =20 (define-module (gnu home services) #:use-module (gnu services) + #:use-module ((gnu packages package-management) #:select (guix)) #:use-module (guix channels) #:use-module (guix monads) #:use-module (guix store) @@ -28,7 +29,7 @@ (define-module (gnu home services) #:use-module (guix ui) #:use-module (guix discovery) #:use-module (guix diagnostics) - + #:use-module (guix i18n) #:use-module (srfi srfi-1) #:use-module (ice-9 match) =20 @@ -41,7 +42,9 @@ (define-module (gnu home services) home-run-on-change-service-type home-provenance-service-type =20 - fold-home-service-types) + fold-home-service-types + + %initialize-gettext) =20 #:re-export (service service-type @@ -274,25 +277,38 @@ (define home-files-service-type (description "Configuration files for programs that will be put in @file{~/.guix-home/files}."))) =20 +(define %initialize-gettext + #~(begin + (bindtextdomain %gettext-domain + (string-append #$guix "/share/locale")) + (textdomain %gettext-domain) + (setlocale LC_ALL ""))) + (define (compute-on-first-login-script _ gexps) (program-file "on-first-login" - #~(let* ((xdg-runtime-dir (or (getenv "XDG_RUNTIME_DIR") - (format #f "/run/user/~a" (getuid)))) - (flag-file-path (string-append - xdg-runtime-dir "/on-first-login-executed")) - (touch (lambda (file-name) - (call-with-output-file file-name (const #t))))) - ;; XDG_RUNTIME_DIR dissapears on logout, that means such trick - ;; allows to launch on-first-login script on first login only - ;; after complete logout/reboot. - (if (file-exists? xdg-runtime-dir) - (unless (file-exists? flag-file-path) - (begin #$@gexps (touch flag-file-path))) - (display "XDG_RUNTIME_DIR doesn't exists, on-first-login script + #~(begin + (use-modules (guix i18n)) + #$%initialize-gettext + + (let* ((xdg-runtime-dir (or (getenv "XDG_RUNTIME_DIR") + (format #f "/run/user/~a" (getuid)))) + (flag-file-path (string-append + xdg-runtime-dir "/on-first-login-executed")) + (touch (lambda (file-name) + (call-with-output-file file-name (const #t))))) + ;; XDG_RUNTIME_DIR dissapears on logout, that means such trick + ;; allows to launch on-first-login script on first login only + ;; after complete logout/reboot. + (if (file-exists? xdg-runtime-dir) + (unless (file-exists? flag-file-path) + (begin #$@gexps (touch flag-file-path))) + ;; TRANSLATORS: 'on-first-login' is the name of a service and + ;; shouldn't be translated + (display (G_ "XDG_RUNTIME_DIR doesn't exists, on-first-login = script won't execute anything. You can check if xdg runtime directory exists, XDG_RUNTIME_DIR variable is set to appropriate value and manually execute = the -script by running '$HOME/.guix-home/on-first-login'"))))) +script by running '$HOME/.guix-home/on-first-login'"))))))) =20 (define (on-first-login-script-entry on-first-login) "Return, as a monadic value, an entry for the on-first-login script @@ -385,6 +401,10 @@ (define home-activation-service-type =20 (define (compute-on-change-gexp eval-gexps? pattern-gexp-tuples) #~(begin + (use-modules (guix i18n)) + + #$%initialize-gettext + (define (equal-regulars? file1 file2) "Check if FILE1 and FILE2 are bit for bit identical." (let* ((cmp-binary #$(file-append @@ -449,21 +469,23 @@ (define expressions-to-eval "/gnu/store/non-existing-generation") "/" (car x))) (file2 (string-append (getenv "GUIX_NEW_HOME") "/" (car = x))) - (_ (format #t "Comparing ~a and\n~10t~a..." file1 file2)) + (_ (format #t (G_ "Comparing ~a and\n~10t~a...") file1 f= ile2)) (any-changes? (something-changed? file1 file2)) - (_ (format #t " done (~a)\n" + (_ (format #t (G_ " done (~a)\n") (if any-changes? "changed" "same")))) (if any-changes? (cadr x) ""))) '#$pattern-gexp-tuples)) =20 (if #$eval-gexps? (begin - (display "Evaling on-change gexps.\n\n") + ;;; TRANSLATORS: 'on-change' is the name of a service type, it + ;;; probably shouldn't be translated. + (display (G_ "Evaluating on-change gexps.\n\n")) (for-each primitive-eval expressions-to-eval) - (display "On-change gexps evaluation finished.\n\n")) + (display (G_ "On-change gexps evaluation finished.\n\n"))) (display "\ -On-change gexps won't be evaluated, disabled by service -configuration.\n")))) +On-change gexps won't be evaluated; evaluation has been disabled in the +service configuration")))) =20 (define home-run-on-change-service-type (service-type (name 'home-run-on-change) diff --git a/gnu/home/services/symlink-manager.scm b/gnu/home/services/syml= ink-manager.scm index f4251e1e6a..314da3ba3e 100644 --- a/gnu/home/services/symlink-manager.scm +++ b/gnu/home/services/symlink-manager.scm @@ -41,7 +41,9 @@ (define (update-symlinks-script) (use-modules (ice-9 ftw) (ice-9 curried-definitions) (ice-9 match) - (srfi srfi-1)) + (srfi srfi-1) + (guix i18n)) + #$%initialize-gettext (define ((simplify-file-tree parent) file) "Convert the result produced by `file-system-tree' to less verbose and more suitable for further processing format. @@ -139,20 +141,21 @@ (define ((file-tree-traverse preordering) node) (backup-file (lambda (path) (mkdir-p backup-dir) - (format #t "Backing up ~a..." (get-target-path path)) + (format #t (G_ "Backing up ~a...") (get-target-path path)) (mkdir-p (dirname (get-backup-path path))) (rename-file (get-target-path path) (get-backup-path path= )) - (display " done\n"))) + (display (G_ " done\n")))) =20 (cleanup-symlinks (lambda () (let ((to-delete ((file-tree-traverse #f) old-tree))) (display - "Cleaning up symlinks from previous home-environment.\= n\n") + (G_ + "Cleaning up symlinks from previous home-environment.\= n\n")) (map (match-lambda (('dir . ".") - (display "Cleanup finished.\n\n")) + (display (G_ "Cleanup finished.\n\n"))) =20 (('dir . path) (if (and @@ -160,12 +163,13 @@ (define ((file-tree-traverse preordering) node) (directory? (get-target-path path)) (empty-directory? (get-target-path path))) (begin - (format #t "Removing ~a..." + (format #t (G_ "Removing ~a...") (get-target-path path)) (rmdir (get-target-path path)) - (display " done\n")) + (display (G_ " done\n"))) (format - #t "Skipping ~a (not an empty directory)... do= ne\n" + #t + (G_ "Skipping ~a (not an empty directory)... d= one\n") (get-target-path path)))) =20 (('file . path) @@ -175,12 +179,12 @@ (define ((file-tree-traverse preordering) node) ;; up later during create-symlinks phase. (if (symlink-to-store? (get-target-path path)) (begin - (format #t "Removing ~a..." (get-target-pat= h path)) + (format #t (G_ "Removing ~a...") (get-targe= t-path path)) (delete-file (get-target-path path)) - (display " done\n")) + (display (G_ " done\n"))) (format #t - "Skipping ~a (not a symlink to store)... don= e\n" + (G_ "Skipping ~a (not a symlink to store)...= done\n") (get-target-path path)))))) to-delete)))) =20 @@ -191,9 +195,9 @@ (define ((file-tree-traverse preordering) node) (match-lambda (('dir . ".") (display - "New symlinks to home-environment will be created = soon.\n") + (G_ "New symlinks to home-environment will be crea= ted soon.\n")) (format - #t "All conflicting files will go to ~a.\n\n" back= up-dir)) + #t (G_ "All conflicting files will go to ~a.\n\n")= backup-dir)) =20 (('dir . path) (let ((target-path (get-target-path path))) @@ -203,20 +207,20 @@ (define ((file-tree-traverse preordering) node) =20 (if (file-exists? target-path) (format - #t "Skipping ~a (directory already exists)= ... done\n" + #t (G_ "Skipping ~a (directory already exi= sts)... done\n") target-path) (begin - (format #t "Creating ~a..." target-path) + (format #t (G_ "Creating ~a...") target-p= ath) (mkdir target-path) - (display " done\n"))))) + (display (G_ " done\n")))))) =20 (('file . path) (when (file-exists? (get-target-path path)) (backup-file path)) - (format #t "Symlinking ~a -> ~a..." + (format #t (G_ "Symlinking ~a -> ~a...") (get-target-path path) (get-source-path pat= h)) (symlink (get-source-path path) (get-target-path pa= th)) - (display " done\n"))) + (display (G_ " done\n")))) to-create))))) =20 (when old-tree @@ -227,7 +231,7 @@ (define ((file-tree-traverse preordering) node) (symlink new-home new-he-path) (rename-file new-he-path he-path) =20 - (display " done\nFinished updating symlinks.\n\n"))))) + (display (G_" done\nFinished updating symlinks.\n\n")))))) =20 =20 (define (update-symlinks-gexp _) diff --git a/po/guix/POTFILES.in b/po/guix/POTFILES.in index a8ce6c3e8f..ee77bb7317 100644 --- a/po/guix/POTFILES.in +++ b/po/guix/POTFILES.in @@ -5,6 +5,8 @@ gnu/packages.scm gnu/services.scm gnu/system.scm gnu/services/shepherd.scm +gnu/services/home.scm +gnu/services/home/symlink-manager.scm gnu/system/file-systems.scm gnu/system/image.scm gnu/system/linux-container.scm base-commit: 5b8ae331f73d970e29566b82c9fe36aa0d77ccb7 --=20 2.33.1 From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 03 09:11:03 2022 Received: (at 52736-done) by debbugs.gnu.org; 3 Jan 2022 14:11:04 +0000 Received: from localhost ([127.0.0.1]:34458 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n4O3D-0004VK-Ov for submit@debbugs.gnu.org; Mon, 03 Jan 2022 09:11:03 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:58520) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n4O3B-0004Ul-JI for 52736-done@debbugs.gnu.org; Mon, 03 Jan 2022 09:11:02 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 260A8363; Mon, 3 Jan 2022 15:10:55 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5YGQA8nQNKj8; Mon, 3 Jan 2022 15:10:54 +0100 (CET) Received: from ribbon (91-160-117-201.subs.proxad.net [91.160.117.201]) by hera.aquilenet.fr (Postfix) with ESMTPSA id A7716120; Mon, 3 Jan 2022 15:10:53 +0100 (CET) From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Xinglu Chen Subject: Re: [bug#52736] [PATCH] home: services: Make strings in Gexps translateble. References: X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 14 =?utf-8?Q?Niv=C3=B4se?= an 230 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Mon, 03 Jan 2022 15:10:52 +0100 In-Reply-To: (Xinglu Chen's message of "Wed, 22 Dec 2021 16:37:09 +0100") Message-ID: <87bl0slxjn.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: / Authentication-Results: hera.aquilenet.fr; none X-Rspamd-Server: hera X-Rspamd-Queue-Id: 260A8363 X-Spamd-Result: default: False [-0.10 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-Spam-Score: 3.0 (+++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hello, Xinglu Chen skribis: > * gnu/home/services.scm (%initialize-gettext): New variable. > (compute-on-first-login-script): Use it. > (compute-on-change-gexp): Likewise. > * gnu/home/services/symlink-manager.scm (update-symlin [...] Content analysis details: (3.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-Debbugs-Envelope-To: 52736-done Cc: 52736-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hello, Xinglu Chen skribis: > * gnu/home/services.scm (%initialize-gettext): New variable. > (compute-on-first-login-script): Use it. > (compute-on-change-gexp): Likewise. > * gnu/home/services/symlink-manager.scm (update-symlin [...] Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager Hello, Xinglu Chen skribis: > * gnu/home/services.scm (%initialize-gettext): New variable. > (compute-on-first-login-script): Use it. > (compute-on-change-gexp): Likewise. > * gnu/home/services/symlink-manager.scm (update-symlinks-script): Likewis= e. > * po/guix/POTFILES.in: Add gnu/home-services.scm and > gnu/home/services/symlink-manager.scm. > > Suggested-by: Ludovic Court=C3=A8s > Link: Applied with a fix in POTFILES.in (the file names were incorrect). > Is there a way to test if these strings are actually translatable > without pushing this to the Git repo and going to Weblate to check? Yes, you can run: # Regenerate the =E2=80=9CPO template=E2=80=9D. make -C po/guix guix.pot-update # Check whether it contains the new strings. grep "XDG_RUNTIME_DIR does" po/guix/guix.pot Thank you! Ludo=E2=80=99. From unknown Sun Aug 10 00:26:36 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 01 Feb 2022 12:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator