all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#74190] [PATCH 0/3] install: Enable pt_BR translation.
@ 2024-11-03 15:14 Florian Pelz
  2024-11-03 15:25 ` [bug#74190] [PATCH 1/3] install: Open info manuals that have region codes Florian Pelz
                   ` (4 more replies)
  0 siblings, 5 replies; 19+ messages in thread
From: Florian Pelz @ 2024-11-03 15:14 UTC (permalink / raw)
  To: 74190; +Cc: Florian Pelz

Hello.  The goal of these patches is to make the pt_BR translation,
that had been expanded much on Weblate recently,
usable in the Guix System latest installer.

Florian Pelz (3):
  install: Open info manuals that have region codes.
  install: Change the territory when we have learned it.
  gnu: info-reader: Inherit from texinfo-7.

 gnu/installer/newt/locale.scm | 17 ++++++++++-------
 gnu/packages/texinfo.scm      |  2 +-
 gnu/system/install.scm        | 29 ++++++++++++++++++-----------
 3 files changed, 29 insertions(+), 19 deletions(-)


base-commit: 20c7b8dd04e421a139a02438cf1ddfdfe544a446
-- 
2.46.0





^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#74190] [PATCH 1/3] install: Open info manuals that have region codes.
  2024-11-03 15:14 [bug#74190] [PATCH 0/3] install: Enable pt_BR translation Florian Pelz
@ 2024-11-03 15:25 ` 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
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 19+ messages in thread
From: Florian Pelz @ 2024-11-03 15:25 UTC (permalink / raw)
  To: 74190; +Cc: Florian Pelz

Because pt_PT and pt_BR have many differences, such as how
the word “file” gets translated, Guix’ pt_BR info manual is
called (guix.pt_BR) instead of (guix.pt).

* gnu/system/install.scm (log-to-info): Try region coded manual
file names.
(%installation-node-names): Add node names for pt_BR and zh_CN.

Change-Id: I89beebd323ee69ca83c22321c9d9e664b32cf6f3
---
NOTE: This patch also causes the Chinese manual to be opened for zh_CN,
which is somewhat broken during installation, because Chinese characters
cannot be displayed on an ordinary TTY.  I have made only trivial
attempts to run kmscon from documentation-shepherd-service, which failed.
But including this patch still seems proper to me despite trouble with
zh_CN.

pt_BR is also troubled by the texinfo info-reader crashing, which is
addressed in patch 3/3.

 gnu/system/install.scm | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/gnu/system/install.scm b/gnu/system/install.scm
index 78a3cdaaec..4de903c59b 100644
--- a/gnu/system/install.scm
+++ b/gnu/system/install.scm
@@ -4,7 +4,7 @@
 ;;; Copyright © 2016 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
-;;; Copyright © 2020 Florian Pelz <pelzflorian@pelzflorian.de>
+;;; Copyright © 2020, 2024 Florian Pelz <pelzflorian@pelzflorian.de>
 ;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2022 Josselin Poiret <dev@jpoiret.xyz>
 ;;; Copyright © 2023 Herman Rimm <herman@rimm.ee>
@@ -31,11 +31,9 @@ (define-module (gnu system install)
   #:use-module (gnu bootloader u-boot)
   #:use-module (guix gexp)
   #:use-module (guix store)
-  #:use-module (guix monads)
   #:use-module (guix modules)
   #:use-module ((guix packages) #:select (package-version supported-package?))
   #:use-module (guix platform)
-  #:use-module ((guix store) #:select (%store-prefix))
   #:use-module (guix utils)
   #:use-module (gnu installer)
   #:use-module (gnu system locale)
@@ -47,7 +45,6 @@ (define-module (gnu system install)
   #:use-module (gnu packages admin)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages bootloaders)
-  #:use-module (gnu packages certs)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages cryptsetup)
   #:use-module (gnu packages disk)
@@ -60,7 +57,6 @@ (define-module (gnu system install)
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages xorg)
   #:use-module (ice-9 match)
-  #:use-module (srfi srfi-26)
   #:export (installation-os
             a20-olinuxino-lime-installation-os
             a20-olinuxino-lime2-emmc-installation-os
@@ -100,7 +96,9 @@ (define %installation-node-names
     ("en" . "System Installation")
     ("es" . "Instalación del sistema")
     ("fr" . "Installation du système")
-    ("ru" . "Установка системы")))
+    ("pt_BR" . "Instalação do sistema")
+    ("ru" . "Установка системы")
+    ("zh_CN" . "系统安装")))
 
 (define (log-to-info tty user)
   "Return a script that spawns the Info reader on the right section of the
@@ -111,13 +109,22 @@ (define (log-to-info tty user)
                          (locale   (cadr (command-line)))
                          (language (string-take locale
                                                 (string-index locale #\_)))
+                         (with-region (string-take locale
+                                                   (string-index
+                                                    locale
+                                                    (char-set #\. #\/ #\@))))
                          (infodir  "/run/current-system/profile/share/info")
-                         (per-lang (string-append infodir "/guix." language
-                                                  ".info.gz"))
-                         (file     (if (file-exists? per-lang)
-                                       per-lang
-                                       (string-append infodir "/guix.info")))
+                         (per-lang (lambda (code)
+                                     (string-append infodir "/guix." code
+                                                    ".info.gz")))
+                         (file ((@ (srfi srfi-1) find) file-exists?
+                                (list (per-lang with-region)
+                                      (per-lang language)
+                                      (string-append infodir
+                                                     "/guix.info.gz"))))
                          (node     (or (assoc-ref '#$%installation-node-names
+                                                  with-region)
+                                       (assoc-ref '#$%installation-node-names
                                                   language)
                                        "System Installation")))
                     (redirect-port tty (current-output-port))
-- 
2.46.0





^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [bug#74190] [PATCH 2/3] install: Change the territory when we have learned it.
  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-03 15:25 ` 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
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 19+ messages in thread
From: Florian Pelz @ 2024-11-03 15:25 UTC (permalink / raw)
  To: 74190; +Cc: Florian Pelz, Josselin Poiret, Ludovic Courtès,
	Mathieu Othacehe

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): Switch to
the territory before returning it.

Change-Id: Ie6308c359e0bdb2d37fac0c844cfd879e96e231a
---
 gnu/installer/newt/locale.scm | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/gnu/installer/newt/locale.scm b/gnu/installer/newt/locale.scm
index 01171e253f..1743e0d582 100644
--- a/gnu/installer/newt/locale.scm
+++ b/gnu/installer/newt/locale.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2024 Florian Pelz <pelzflorian@pelzflorian.de>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -22,11 +23,7 @@ (define-module (gnu installer newt locale)
   #:use-module (gnu installer steps)
   #:use-module (gnu installer newt page)
   #:use-module (guix i18n)
-  #:use-module (newt)
   #: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 +49,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





^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [bug#74190] [PATCH 3/3] gnu: info-reader: Inherit from texinfo-7.
  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-03 15:25 ` [bug#74190] [PATCH 2/3] install: Change the territory when we have learned it Florian Pelz
@ 2024-11-03 15:25 ` 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-17 23:47 ` [bug#74190] [PATCH v2 0/3] install: Enable pt_BR locale Florian Pelz
  4 siblings, 1 reply; 19+ messages in thread
From: Florian Pelz @ 2024-11-03 15:25 UTC (permalink / raw)
  To: 74190; +Cc: Florian Pelz

Otherwise `LC_ALL=pt_BR.utf8 info` crashes.

* gnu/packages/texinfo.scm (info-reader): Inherit from texinfo-7.

Change-Id: I9eb5873fbc115e0c45f96a16aa05dbca76b92c57
---
I have not carefully thought about the consequences of this change,
but it makes info work for the installer in pt_BR.

 gnu/packages/texinfo.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/packages/texinfo.scm b/gnu/packages/texinfo.scm
index 81afdaf7a7..e198581b52 100644
--- a/gnu/packages/texinfo.scm
+++ b/gnu/packages/texinfo.scm
@@ -194,7 +194,7 @@ (define-public texinfo-4
 (define-public info-reader
   ;; The idea of this package is to have the standalone Info reader without
   ;; the dependency on Perl that 'makeinfo' drags.
-  (package/inherit texinfo
+  (package/inherit texinfo-7
     (name "info-reader")
     (arguments
      `(,@(substitute-keyword-arguments (package-arguments texinfo)
-- 
2.46.0





^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [bug#74190] [PATCH 0/3] install: Enable pt_BR translation.
  2024-11-03 15:14 [bug#74190] [PATCH 0/3] install: Enable pt_BR translation Florian Pelz
                   ` (2 preceding siblings ...)
  2024-11-03 15:25 ` [bug#74190] [PATCH 3/3] gnu: info-reader: Inherit from texinfo-7 Florian Pelz
@ 2024-11-03 20:37 ` Krascovict Petrov
  2024-11-04  7:52   ` pelzflorian (Florian Pelz)
  2024-11-17 23:47 ` [bug#74190] [PATCH v2 0/3] install: Enable pt_BR locale Florian Pelz
  4 siblings, 1 reply; 19+ messages in thread
From: Krascovict Petrov @ 2024-11-03 20:37 UTC (permalink / raw)
  To: 74190@debbugs.gnu.org

[-- Attachment #1: Type: text/html, Size: 296 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#74190] [PATCH 0/3] install: Enable pt_BR translation.
  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
  0 siblings, 1 reply; 19+ messages in thread
From: pelzflorian (Florian Pelz) @ 2024-11-04  7:52 UTC (permalink / raw)
  To: Krascovict Petrov; +Cc: 74190@debbugs.gnu.org

Hello Krascovict and thank you for translating.

Note that I do not speak Portuguese.

Krascovict Petrov <krascovict@yandex.ru> writes:
> In this case I am in doubt about translations of functions (inside the
> parentheses) whether they can be translated or not?

Generally no, but you can look at the string in Weblate in other
languages like Spanish or French.  See if they have translated it.
For example, if a variable name is defined with (define), in a few
cases, it is possible to translate it, but it must be translated
everywhere the same way.

Alternatively you would have to test in Guix if it works.

Regards,
Florian




^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#74190] [PATCH 0/3] install: Enable pt_BR translation.
  2024-11-04  7:52   ` pelzflorian (Florian Pelz)
@ 2024-11-04 22:08     ` Krascovict Petrov
  2024-11-05  8:59       ` pelzflorian (Florian Pelz)
  0 siblings, 1 reply; 19+ messages in thread
From: Krascovict Petrov @ 2024-11-04 22:08 UTC (permalink / raw)
  To: pelzflorian (Florian Pelz); +Cc: 74190@debbugs.gnu.org

[-- Attachment #1: Type: text/html, Size: 1371 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#74190] [PATCH 0/3] install: Enable pt_BR translation.
  2024-11-04 22:08     ` Krascovict Petrov
@ 2024-11-05  8:59       ` pelzflorian (Florian Pelz)
  0 siblings, 0 replies; 19+ messages in thread
From: pelzflorian (Florian Pelz) @ 2024-11-05  8:59 UTC (permalink / raw)
  To: Krascovict Petrov; +Cc: 74190@debbugs.gnu.org

Krascovict Petrov <krascovict@yandex.ru> writes:
> I understand Florian Pelz, at first I will translate the texts, when I reach 100% translation I will test it on a virtual machine and do tests, thank
> you for the congratulations.

Yes, but I do recommend looking at Spanish or French for difficult,
ambiguous translations, particularly in some services’ ambiguous texts.
100% is a difficult goal for some of them, and correctness is more
important than having a translation.  For example, you and other
translators frequently translated a graph from graph theory like
gráfico, or the /gnu/store store like loja (shop), which I then changed
to the word armazém from Guix’ Portuguese glossary.

Regards,
Florian




^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#74190] [PATCH 1/3] install: Open info manuals that have region codes.
  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
  0 siblings, 0 replies; 19+ messages in thread
From: Ludovic Courtès @ 2024-11-17 17:06 UTC (permalink / raw)
  To: Florian Pelz; +Cc: 74190

Hi,

Florian Pelz <pelzflorian@pelzflorian.de> skribis:

> Because pt_PT and pt_BR have many differences, such as how
> the word “file” gets translated, Guix’ pt_BR info manual is
> called (guix.pt_BR) instead of (guix.pt).
>
> * gnu/system/install.scm (log-to-info): Try region coded manual
> file names.
> (%installation-node-names): Add node names for pt_BR and zh_CN.
>
> Change-Id: I89beebd323ee69ca83c22321c9d9e664b32cf6f3

LGTM!




^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#74190] [PATCH 2/3] install: Change the territory when we have learned it.
  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
  0 siblings, 0 replies; 19+ messages in thread
From: Ludovic Courtès @ 2024-11-17 17:08 UTC (permalink / raw)
  To: Florian Pelz; +Cc: Mathieu Othacehe, 74190, Josselin Poiret

Florian Pelz <pelzflorian@pelzflorian.de> skribis:

> 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): Switch to
  ^
Missing bullet (star).

> the territory before returning it.

Instead of “Switch to…”, I’d write “Call ‘setenv’ for the ‘LANGUAGE’
variable.”

>  (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))

Does that have an effect though: isn’t the Info reader already running
at this point?

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#74190] [PATCH 3/3] gnu: info-reader: Inherit from texinfo-7.
  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
  0 siblings, 0 replies; 19+ messages in thread
From: Ludovic Courtès @ 2024-11-17 17:10 UTC (permalink / raw)
  To: Florian Pelz; +Cc: 74190

Florian Pelz <pelzflorian@pelzflorian.de> skribis:

> Otherwise `LC_ALL=pt_BR.utf8 info` crashes.
>
> * gnu/packages/texinfo.scm (info-reader): Inherit from texinfo-7.
>
> Change-Id: I9eb5873fbc115e0c45f96a16aa05dbca76b92c57

[...]

>  (define-public info-reader
>    ;; The idea of this package is to have the standalone Info reader without
>    ;; the dependency on Perl that 'makeinfo' drags.
> -  (package/inherit texinfo
> +  (package/inherit texinfo-7

Please add a comment explaining why this particular version of Texinfo
is needed.

Any idea why the Info reader crashes specifically for this locale?  Does
it work with, say, de_DE.utf8?

Ludo’.




^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#74190] [PATCH v2 0/3] install: Enable pt_BR locale.
  2024-11-03 15:14 [bug#74190] [PATCH 0/3] install: Enable pt_BR translation Florian Pelz
                   ` (3 preceding siblings ...)
  2024-11-03 20:37 ` [bug#74190] [PATCH 0/3] install: Enable pt_BR translation Krascovict Petrov
@ 2024-11-17 23:47 ` Florian Pelz
  2024-11-17 23:48   ` [bug#74190] [PATCH v2 1/3] install: Open info manuals that have region codes Florian Pelz
                     ` (3 more replies)
  4 siblings, 4 replies; 19+ messages in thread
From: Florian Pelz @ 2024-11-17 23:47 UTC (permalink / raw)
  To: 74190; +Cc: Florian Pelz

Changes in patch 2/3 and 3/3 to add missing commentary found by Ludo.
Rebased onto current master.

Florian Pelz (3):
  install: Open info manuals that have region codes.
  install: Change the territory when we have learned it.
  gnu: info-reader: Inherit from texinfo-7.

 gnu/installer/newt/locale.scm | 16 ++++++++++------
 gnu/packages/texinfo.scm      |  4 +++-
 gnu/system/install.scm        | 29 ++++++++++++++++++-----------
 3 files changed, 31 insertions(+), 18 deletions(-)


base-commit: d108a7aac2c51f21c55cb8ea8801629a97f5242a
-- 
2.46.0





^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#74190] [PATCH v2 1/3] install: Open info manuals that have region codes.
  2024-11-17 23:47 ` [bug#74190] [PATCH v2 0/3] install: Enable pt_BR locale Florian Pelz
@ 2024-11-17 23:48   ` Florian Pelz
  2024-11-17 23:48   ` [bug#74190] [PATCH v2 2/3] install: Change the territory when we have learned it Florian Pelz
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 19+ messages in thread
From: Florian Pelz @ 2024-11-17 23:48 UTC (permalink / raw)
  To: 74190; +Cc: Florian Pelz

Because pt_PT and pt_BR have many differences, such as how
the word “file” gets translated, Guix’ pt_BR info manual is
called (guix.pt_BR) instead of (guix.pt).

* gnu/system/install.scm (log-to-info): Try region coded manual
file names.
(%installation-node-names): Add node names for pt_BR and zh_CN.

Change-Id: I89beebd323ee69ca83c22321c9d9e664b32cf6f3
---
 gnu/system/install.scm | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/gnu/system/install.scm b/gnu/system/install.scm
index 78a3cdaaec..4de903c59b 100644
--- a/gnu/system/install.scm
+++ b/gnu/system/install.scm
@@ -4,7 +4,7 @@
 ;;; Copyright © 2016 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
-;;; Copyright © 2020 Florian Pelz <pelzflorian@pelzflorian.de>
+;;; Copyright © 2020, 2024 Florian Pelz <pelzflorian@pelzflorian.de>
 ;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2022 Josselin Poiret <dev@jpoiret.xyz>
 ;;; Copyright © 2023 Herman Rimm <herman@rimm.ee>
@@ -31,11 +31,9 @@ (define-module (gnu system install)
   #:use-module (gnu bootloader u-boot)
   #:use-module (guix gexp)
   #:use-module (guix store)
-  #:use-module (guix monads)
   #:use-module (guix modules)
   #:use-module ((guix packages) #:select (package-version supported-package?))
   #:use-module (guix platform)
-  #:use-module ((guix store) #:select (%store-prefix))
   #:use-module (guix utils)
   #:use-module (gnu installer)
   #:use-module (gnu system locale)
@@ -47,7 +45,6 @@ (define-module (gnu system install)
   #:use-module (gnu packages admin)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages bootloaders)
-  #:use-module (gnu packages certs)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages cryptsetup)
   #:use-module (gnu packages disk)
@@ -60,7 +57,6 @@ (define-module (gnu system install)
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages xorg)
   #:use-module (ice-9 match)
-  #:use-module (srfi srfi-26)
   #:export (installation-os
             a20-olinuxino-lime-installation-os
             a20-olinuxino-lime2-emmc-installation-os
@@ -100,7 +96,9 @@ (define %installation-node-names
     ("en" . "System Installation")
     ("es" . "Instalación del sistema")
     ("fr" . "Installation du système")
-    ("ru" . "Установка системы")))
+    ("pt_BR" . "Instalação do sistema")
+    ("ru" . "Установка системы")
+    ("zh_CN" . "系统安装")))
 
 (define (log-to-info tty user)
   "Return a script that spawns the Info reader on the right section of the
@@ -111,13 +109,22 @@ (define (log-to-info tty user)
                          (locale   (cadr (command-line)))
                          (language (string-take locale
                                                 (string-index locale #\_)))
+                         (with-region (string-take locale
+                                                   (string-index
+                                                    locale
+                                                    (char-set #\. #\/ #\@))))
                          (infodir  "/run/current-system/profile/share/info")
-                         (per-lang (string-append infodir "/guix." language
-                                                  ".info.gz"))
-                         (file     (if (file-exists? per-lang)
-                                       per-lang
-                                       (string-append infodir "/guix.info")))
+                         (per-lang (lambda (code)
+                                     (string-append infodir "/guix." code
+                                                    ".info.gz")))
+                         (file ((@ (srfi srfi-1) find) file-exists?
+                                (list (per-lang with-region)
+                                      (per-lang language)
+                                      (string-append infodir
+                                                     "/guix.info.gz"))))
                          (node     (or (assoc-ref '#$%installation-node-names
+                                                  with-region)
+                                       (assoc-ref '#$%installation-node-names
                                                   language)
                                        "System Installation")))
                     (redirect-port tty (current-output-port))
-- 
2.46.0





^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [bug#74190] [PATCH v2 2/3] install: Change the territory when we have learned it.
  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
  2024-11-18 10:26     ` pelzflorian (Florian Pelz)
  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
  3 siblings, 1 reply; 19+ messages in thread
From: Florian Pelz @ 2024-11-17 23:48 UTC (permalink / raw)
  To: 74190; +Cc: Florian Pelz, Josselin Poiret, Ludovic Courtès,
	Mathieu Othacehe

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





^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [bug#74190] [PATCH v2 3/3] gnu: info-reader: Inherit from texinfo-7.
  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   ` [bug#74190] [PATCH v2 2/3] install: Change the territory when we have learned it Florian Pelz
@ 2024-11-17 23:49   ` Florian Pelz
  2024-11-20 12:08   ` [bug#74190] [PATCH v2 0/3] install: Enable pt_BR locale Ludovic Courtès
  3 siblings, 0 replies; 19+ messages in thread
From: Florian Pelz @ 2024-11-17 23:49 UTC (permalink / raw)
  To: 74190; +Cc: Florian Pelz

Otherwise `LC_ALL=pt_BR.utf8 info` crashes.

* gnu/packages/texinfo.scm (info-reader): Inherit from texinfo-7.

Change-Id: I9eb5873fbc115e0c45f96a16aa05dbca76b92c57
---
A Web search points at the cause of the Texinfo crash being a typo
in Texinfo’s own po file translations.  If so, Texinfo 6 could be
patched alternatively.
<https://www.linuxquestions.org/questions/slackware-14/curr
ent-texinfo-fails-with-pt_br-locale-4175703232/>

 gnu/packages/texinfo.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/texinfo.scm b/gnu/packages/texinfo.scm
index 81afdaf7a7..cd474bb566 100644
--- a/gnu/packages/texinfo.scm
+++ b/gnu/packages/texinfo.scm
@@ -194,7 +194,9 @@ (define-public texinfo-4
 (define-public info-reader
   ;; The idea of this package is to have the standalone Info reader without
   ;; the dependency on Perl that 'makeinfo' drags.
-  (package/inherit texinfo
+  ;; Texinfo version must be at least 7.0, which fixed crashes in a pt_BR
+  ;; locale; see <https://git.savannah.gnu.org/cgit/texinfo.git/plain/NEWS>.
+  (package/inherit texinfo-7
     (name "info-reader")
     (arguments
      `(,@(substitute-keyword-arguments (package-arguments texinfo)
-- 
2.46.0





^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [bug#74190] [PATCH v2 2/3] install: Change the territory when we have learned it.
  2024-11-17 23:48   ` [bug#74190] [PATCH v2 2/3] install: Change the territory when we have learned it Florian Pelz
@ 2024-11-18 10:26     ` pelzflorian (Florian Pelz)
  2024-11-20 12:07       ` Ludovic Courtès
  0 siblings, 1 reply; 19+ messages in thread
From: pelzflorian (Florian Pelz) @ 2024-11-18 10:26 UTC (permalink / raw)
  To: 74190

Florian Pelz <pelzflorian@pelzflorian.de> writes:
> 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.

Oh well, I’ve found this should not be true for српски (Serbian) when
pressing the back button from the Latin/Cyrillic codeset selection
sub-step.  In theory, it would set an invalid LANGUAGE like sr_RS_RS and
thus print messages in English.  But there is no Serb translation and
the back button does not even work (in current master and 1.4.0).

We could search for some other way to pass the country code to the
run-territory-page other than (getenv "LANGUAGE"), such as set! it in
some variable or strip the territory from (getenv "LANGUAGE").

Is this worth it?  Currently it does not make a difference anyway.

Regards,
Florian




^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#74190] [PATCH v2 2/3] install: Change the territory when we have learned it.
  2024-11-18 10:26     ` pelzflorian (Florian Pelz)
@ 2024-11-20 12:07       ` Ludovic Courtès
  0 siblings, 0 replies; 19+ messages in thread
From: Ludovic Courtès @ 2024-11-20 12:07 UTC (permalink / raw)
  To: pelzflorian (Florian Pelz); +Cc: 74190

"pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> skribis:

> Florian Pelz <pelzflorian@pelzflorian.de> writes:
>> 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.
>
> Oh well, I’ve found this should not be true for српски (Serbian) when
> pressing the back button from the Latin/Cyrillic codeset selection
> sub-step.  In theory, it would set an invalid LANGUAGE like sr_RS_RS and
> thus print messages in English.  But there is no Serb translation and
> the back button does not even work (in current master and 1.4.0).
>
> We could search for some other way to pass the country code to the
> run-territory-page other than (getenv "LANGUAGE"), such as set! it in
> some variable or strip the territory from (getenv "LANGUAGE").
>
> Is this worth it?  Currently it does not make a difference anyway.

Yeah, let’s not bother too much if it’s purely theoretical at this
point.

Ludo’.




^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#74190] [PATCH v2 0/3] install: Enable pt_BR locale.
  2024-11-17 23:47 ` [bug#74190] [PATCH v2 0/3] install: Enable pt_BR locale Florian Pelz
                     ` (2 preceding siblings ...)
  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   ` Ludovic Courtès
  2024-11-20 17:27     ` bug#74190: " pelzflorian (Florian Pelz)
  3 siblings, 1 reply; 19+ messages in thread
From: Ludovic Courtès @ 2024-11-20 12:08 UTC (permalink / raw)
  To: Florian Pelz; +Cc: 74190

Florian Pelz <pelzflorian@pelzflorian.de> skribis:

> Changes in patch 2/3 and 3/3 to add missing commentary found by Ludo.
> Rebased onto current master.
>
> Florian Pelz (3):
>   install: Open info manuals that have region codes.
>   install: Change the territory when we have learned it.
>   gnu: info-reader: Inherit from texinfo-7.

LGTM, thanks!




^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#74190: [PATCH v2 0/3] install: Enable pt_BR locale.
  2024-11-20 12:08   ` [bug#74190] [PATCH v2 0/3] install: Enable pt_BR locale Ludovic Courtès
@ 2024-11-20 17:27     ` pelzflorian (Florian Pelz)
  0 siblings, 0 replies; 19+ messages in thread
From: pelzflorian (Florian Pelz) @ 2024-11-20 17:27 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 74190-done

Pushed as 84d5948ee02f6d9aff11603492001eef9df27f95 and following.

Thank you Ludo for the opinions and noticing what was missing.

Soon the download latest images at
<https://guix.gnu.org/pt-BR/download/latest/>
will speak Brazilian Portuguese.

Regards,
Florian




^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2024-11-20 17:28 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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   ` [bug#74190] [PATCH v2 2/3] install: Change the territory when we have learned it Florian Pelz
2024-11-18 10:26     ` 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)

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.