unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Florian Pelz <pelzflorian@pelzflorian.de>
To: 74190@debbugs.gnu.org
Cc: "Florian Pelz" <pelzflorian@pelzflorian.de>,
	"Josselin Poiret" <dev@jpoiret.xyz>,
	"Ludovic Courtès" <ludo@gnu.org>,
	"Mathieu Othacehe" <othacehe@gnu.org>
Subject: [bug#74190] [PATCH v2 2/3] install: Change the territory when we have learned it.
Date: Mon, 18 Nov 2024 00:48:46 +0100	[thread overview]
Message-ID: <03b8e561289d30b4af84ff1392eb27a51609dba3.1731881786.git.pelzflorian@pelzflorian.de> (raw)
In-Reply-To: <cover.1731881786.git.pelzflorian@pelzflorian.de>

Typically, the LANGUAGE has already been set in the run-language-page
step.  But for languages like pt, we must know the territory.

* gnu/installer/newt/locale.scm (run-territory-page): Call ‘setenv’ for
the ‘LANGUAGE’ variable.

Change-Id: Ie6308c359e0bdb2d37fac0c844cfd879e96e231a
---
Note: I’ve tested this in QEMU and with it, a zh_CN, pt_BR locale gets
applied visibly.  Also, it repeats exactly what was done in
‘run-language-page’.  Context: when the installer enters the
encompassing ‘run-locale-page’ procedure, it runs the installer
sub-steps ‘run-language-page’ and ‘run-territory-page’ in
immediate succession with no way to go back just one sub-step.
Esperanto does not go through ‘run-territory-page’ and is not broken
by this change.

 gnu/installer/newt/locale.scm | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/gnu/installer/newt/locale.scm b/gnu/installer/newt/locale.scm
index 0be9db449e..df168baca9 100644
--- a/gnu/installer/newt/locale.scm
+++ b/gnu/installer/newt/locale.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2024 Florian Pelz <pelzflorian@pelzflorian.de>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -24,9 +25,6 @@ (define-module (gnu installer newt locale)
   #:use-module (gnu installer newt page)
   #:use-module (guix i18n)
   #:use-module (srfi srfi-1)
-  #:use-module (srfi srfi-26)
-  #:use-module (srfi srfi-34)
-  #:use-module (srfi srfi-35)
   #:use-module (ice-9 match)
   #:export (run-locale-page))
 
@@ -52,16 +50,22 @@ (define (run-language-page languages language->text)
   result)
 
 (define (run-territory-page territories territory->text)
-  (let ((title (G_ "Locale location")))
+  (define result
     (run-listbox-selection-page
-     #:title title
+     #:title (G_ "Locale location")
      #:info-text (G_ "Choose a territory for this language.")
      #:listbox-items territories
      #:listbox-item->text territory->text
      #:button-text (G_ "Back")
      #:button-callback-procedure
      (lambda _
-       (abort-to-prompt 'installer-step 'abort)))))
+       (abort-to-prompt 'installer-step 'abort))))
+
+  ;; Some languages, such as pt, cannot be installed early in the
+  ;; run-language-page step.  Install them now, when we know the territory.
+  (setenv "LANGUAGE" (string-append (getenv "LANGUAGE") "_" result))
+
+  result)
 
 (define (run-codeset-page codesets)
   (let ((title (G_ "Locale codeset")))
-- 
2.46.0





  parent reply	other threads:[~2024-11-17 23:49 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-03 15:14 [bug#74190] [PATCH 0/3] install: Enable pt_BR translation Florian Pelz
2024-11-03 15:25 ` [bug#74190] [PATCH 1/3] install: Open info manuals that have region codes Florian Pelz
2024-11-17 17:06   ` Ludovic Courtès
2024-11-03 15:25 ` [bug#74190] [PATCH 2/3] install: Change the territory when we have learned it Florian Pelz
2024-11-17 17:08   ` Ludovic Courtès
2024-11-03 15:25 ` [bug#74190] [PATCH 3/3] gnu: info-reader: Inherit from texinfo-7 Florian Pelz
2024-11-17 17:10   ` Ludovic Courtès
2024-11-03 20:37 ` [bug#74190] [PATCH 0/3] install: Enable pt_BR translation Krascovict Petrov
2024-11-04  7:52   ` pelzflorian (Florian Pelz)
2024-11-04 22:08     ` Krascovict Petrov
2024-11-05  8:59       ` pelzflorian (Florian Pelz)
2024-11-17 23:47 ` [bug#74190] [PATCH v2 0/3] install: Enable pt_BR locale Florian Pelz
2024-11-17 23:48   ` [bug#74190] [PATCH v2 1/3] install: Open info manuals that have region codes Florian Pelz
2024-11-17 23:48   ` Florian Pelz [this message]
2024-11-18 10:26     ` [bug#74190] [PATCH v2 2/3] install: Change the territory when we have learned it pelzflorian (Florian Pelz)
2024-11-20 12:07       ` Ludovic Courtès
2024-11-17 23:49   ` [bug#74190] [PATCH v2 3/3] gnu: info-reader: Inherit from texinfo-7 Florian Pelz
2024-11-20 12:08   ` [bug#74190] [PATCH v2 0/3] install: Enable pt_BR locale Ludovic Courtès
2024-11-20 17:27     ` bug#74190: " pelzflorian (Florian Pelz)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=03b8e561289d30b4af84ff1392eb27a51609dba3.1731881786.git.pelzflorian@pelzflorian.de \
    --to=pelzflorian@pelzflorian.de \
    --cc=74190@debbugs.gnu.org \
    --cc=dev@jpoiret.xyz \
    --cc=ludo@gnu.org \
    --cc=othacehe@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).