all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Cc: mhw@netris.org, 32026@debbugs.gnu.org,
	Jonathan Brielmaier <jonathan.brielmaier@web.de>
Subject: bug#32026: LibreOffice locales
Date: Wed, 22 Feb 2023 10:19:21 +0100	[thread overview]
Message-ID: <87mt569hwm.fsf_-_@gnu.org> (raw)
In-Reply-To: <87y1osl58k.fsf@gmail.com> (Maxim Cournoyer's message of "Mon, 20 Feb 2023 10:35:23 -0500")

[-- Attachment #1: Type: text/plain, Size: 626 bytes --]

Hi!

Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:

[...]

>> (A couple of years ago I started working on that for the LibreOffice
>> package.  I got quite far but didn’t complete it.  I can dig that from
>> my stashes if there’s interest in giving a hand.)
>
> I'd be interested to pick it up, yes!  Perhaps not in the coming 2
> weeks, which will be very busy for me, but afterward.

Here’s the WIP patch and associated LibreOffice patch (which didn’t
quite work for some reason: LO wouldn’t look for locales where I wanted
it to.)

Ludo’.


[-- Attachment #2: Type: text/x-patch, Size: 6515 bytes --]

Unstaged
modified   gnu/packages/libreoffice.scm
@@ -6,7 +6,7 @@
 ;;; Copyright © 2017 Thomas Danckaert <post@thomasdanckaert.be>
 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2017 Andy Wingo <wingo@igalia.com>
-;;; Copyright © 2017, 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2017, 2018, 2019 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com>
 ;;; Copyright © 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
@@ -53,6 +53,7 @@ (define-module (gnu packages libreoffice)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages fontutils)
+  #:use-module (gnu packages gettext)
   #:use-module (gnu packages ghostscript)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
@@ -969,7 +970,8 @@ (define-public libreoffice
                           "0apbmammmp4pk473xiv5vk50r4c5gjvqzf9jkficksvz58q6114f"))))
                 (search-patches "libreoffice-boost.patch"
                                 "libreoffice-icu.patch"
-                                "libreoffice-glm.patch")))
+                                "libreoffice-glm.patch"
+                                "libreoffice-locale-directory.patch")))
        (modules '((guix build utils)))
        (snippet
         '(begin
@@ -1164,6 +1166,16 @@ (define (install-appdata app)
           "--disable-pdfium"
           "--disable-gtk" ; disable use of GTK+ 2
           "--without-doxygen")))
+
+    (native-search-paths
+     ;; This Guix-specific environment variable tells LibreOffice where to
+     ;; find locale data as provided by the 'libreoffice-translation-*'
+     ;; packages.
+     (list (search-path-specification
+            (variable "LO_LOCALE_DIRECTORY")
+            (separator #f)
+            (files '("share/libreoffice/locale")))))
+
     (home-page "https://www.libreoffice.org/")
     (synopsis "Office suite")
     (description "LibreOffice is a comprehensive office suite.  It contains
@@ -1172,3 +1184,84 @@ (define (install-appdata app)
 flowcharting application; Base, a database and database frontend;
 Math for editing mathematics.")
     (license mpl2.0)))
+
+(define (libreoffice-translation language)
+  (package
+    (inherit libreoffice)
+    (name (string-append "libreoffice-translation-" language))
+    (version (package-version libreoffice))
+    (build-system gnu-build-system)
+    (arguments
+     (substitute-keyword-arguments (package-arguments libreoffice)
+       ((#:phases phases '%standard-phases)
+        `(modify-phases ,phases
+           (add-after 'unpack 'unpack-translations
+             (lambda* (#:key inputs #:allow-other-keys)
+               (let ((translations (assoc-ref inputs "translations")))
+                 (mkdir "src")
+                 (symlink translations
+                          (string-append "src/libreoffice-translations-"
+                                         ,version ".tar.xz"))
+                 #t)))
+           (replace 'build
+             (lambda _
+               (invoke "make" "build-l10n-only"
+                       "-j" (number->string (parallel-job-count)))))
+           (replace 'install
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out"))
+                      (locale (string-append out
+                                             ,(string-append
+                                               "/share/libreoffice/locale/"
+                                               language
+                                               "/LC_MESSAGES")))
+                      (registry (string-append out
+                                               "/lib/libreoffice/share/registry")))
+                 (for-each (lambda (mo)
+                             (install-file mo locale))
+                           (find-files "." "\\.mo$"))
+                 (for-each (lambda (xcd)
+                             (install-file xcd registry))
+                           (find-files "." "^Langpack-.*\\.xcd$"))
+                 (for-each (lambda (xcd)
+                             (install-file xcd
+                                           (string-append registry "/res")))
+                           (find-files "."
+                                       ,(string-append language "\\.xcd$")))
+                 #t)))
+           (delete 'bin-and-desktop-install)))
+       ((#:configure-flags flags '())
+        `(cons ,(string-append "--with-lang=" language) ,flags))
+       ((#:tests? _ #f)
+        #f)))
+    (native-inputs
+     `(("gettext" ,gnu-gettext)
+       ("translations" ,(origin
+                          (method url-fetch)
+                          (uri (string-append
+                                "https://download.documentfoundation.org/libreoffice/src/"
+                                (version-prefix version 3) "/libreoffice-translations-"
+                                version ".tar.xz"))
+                          (sha256
+                           (base32
+                            "15fdni68b3kyl6115v0d24cl0dp1hdjhkx571w086lrpz0fk9mfi"))))
+       ,@(package-native-inputs libreoffice)))
+    (synopsis "Translation of the LibreOffice user interface")))
+
+(define %libreoffice-translations
+  ;; List of available translations.  Obtained by calling 'scandir' on the
+  ;; contents of 'translations/source' from the "libreoffice-translations"
+  ;; tarball.
+  '("ab" "af" "am" "an" "ar" "as" "ast" "az" "be" "bg" "bn" "bn-IN" "bo" "br"
+    "brx" "bs" "ca" "ca-valencia" "cs" "cy" "da" "de" "dgo" "dz" "el" "en-GB"
+    "en-ZA" "eo" "es" "et" "eu" "fa" "fi" "fr" "fy" "ga" "gd" "gl" "gu" "gug"
+    "he" "hi" "hr" "hsb" "hu" "id" "is" "it" "ja" "jv" "ka" "kab" "kk" "kl"
+    "km" "kmr-Latn" "kn" "ko" "kok" "ks" "ky" "lb" "lo" "lt" "lv" "mai" "mk"
+    "ml" "mn" "mni" "mr" "my" "nb" "ne" "nl" "nn" "nr" "nso" "oc" "om" "or"
+    "pa-IN" "pl" "pt" "pt-BR" "ro" "ru" "rw" "sah" "sa-IN" "sat" "sd" "si"
+    "sid" "sk" "sl" "sq" "sr" "sr-Latn" "ss" "st" "sv" "sw-TZ" "szl" "ta" "te"
+    "tg" "th" "ti" "tn" "tr" "ts" "tt" "ug" "uk" "ur" "uz" "ve" "vec" "vi"
+    "xh" "zh-CN" "zh-TW" "zu"))
+
+(define-public libreoffice-l10n-fr
+  (libreoffice-translation "fr"))


[-- Attachment #3: the LO patch --]
[-- Type: text/x-patch, Size: 1048 bytes --]

Define a new environment variable to determine the directory where
message catalogs ('.mo' files) are to be be looked up.

LibreOffice already has environment variables such as 'BRAND_BASE_DIR'
and 'BRAND_SHARE_RESOURCE_SUBDIR' but these are not helpful in this
case.

Patch by Ludovic Courtès <ludo@gnu.org>.

--- libreoffice-6.1.5.2/unotools/source/i18n/resmgr.cxx	2019-03-10 16:22:21.352963608 +0100
+++ libreoffice-6.1.5.2/unotools/source/i18n/resmgr.cxx	2019-03-10 16:30:20.090848346 +0100
@@ -144,6 +144,11 @@ namespace Translate
         rtl::Bootstrap::expandMacros(uri);
         OUString path;
         osl::File::getSystemPathFromFileURL(uri, path);
+
+        const char *cLocaleDir = ::getenv("LO_LOCALE_DIRECTORY");
+        if (cLocaleDir != NULL)
+            path = OUString::createFromAscii(cLocaleDir);
+
         OString sPath(OUStringToOString(path, osl_getThreadTextEncoding()));
         gen.add_messages_path(sPath.getStr());
 #if defined UNX && !defined MACOSX && !defined IOS && !defined ANDROID


      reply	other threads:[~2023-02-22  9:20 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-01 20:23 bug#32026: IceCat locales are missing? Ludovic Courtès
2023-02-14  1:55 ` bug#32026: [PATCH 00/10] Add proper locale support to IceCat and Icedove Maxim Cournoyer
2023-02-14  1:55   ` bug#32026: [PATCH 01/10] gnu: Add a 'update-mozilla-locales' helper for maintenance Maxim Cournoyer
2023-02-14  1:55   ` bug#32026: [PATCH 02/10] gnu: icedove: Compute a self-contained source Maxim Cournoyer
2023-02-14 21:32     ` Jonathan Brielmaier
2023-02-16  0:55       ` Maxim Cournoyer
2023-02-14  1:55   ` bug#32026: [PATCH 03/10] gnu: Define UPSTREAM-FIREFOX-SOURCE at the top level Maxim Cournoyer
2023-02-14  1:55   ` bug#32026: [PATCH 04/10] gnu: icecat: Update the "ach" locale Maxim Cournoyer
2023-02-15  6:39     ` Mark H Weaver
2023-02-14  1:55   ` bug#32026: [PATCH 05/10] gnu: icecat: Add a patch that makes building language packs reproducible Maxim Cournoyer
2023-02-14  7:58     ` Mark H Weaver
2023-02-14 13:58       ` Maxim Cournoyer
2023-02-14 21:06         ` Mark H Weaver
2023-02-15 21:32           ` Maxim Cournoyer
2023-02-14  1:55   ` bug#32026: [PATCH 06/10] gnu: Add icecat-l10n and icedove-l10n Maxim Cournoyer
2023-02-14  1:55   ` bug#32026: [PATCH 07/10] gnu: icedove: Automatically load system-provided extensions Maxim Cournoyer
2023-02-14  1:55   ` bug#32026: [PATCH 08/10] gnu: Add language packs to icecat and icedove Maxim Cournoyer
2023-02-14  1:55   ` bug#32026: [PATCH 09/10] gnu: icedove: Use the locale of the system Maxim Cournoyer
2023-02-14  1:55   ` bug#32026: [PATCH 10/10] gnu: icecat: " Maxim Cournoyer
2023-02-14  9:23     ` Mark H Weaver
2023-02-14 14:00       ` Maxim Cournoyer
2023-02-16  4:36 ` bug#32026: [PATCH 01/10] gnu: Add a 'update-mozilla-locales' helper for maintenance Maxim Cournoyer
2023-02-16  4:36   ` bug#32026: [PATCH 02/10] gnu: icedove: Compute a self-contained source Maxim Cournoyer
2023-02-16  4:36   ` bug#32026: [PATCH 03/10] gnu: Define UPSTREAM-FIREFOX-SOURCE at the top level Maxim Cournoyer
2023-02-16 22:26     ` Mark H Weaver
2023-02-17  2:55       ` Maxim Cournoyer
2023-02-18 20:46         ` Mark H Weaver
2023-02-19 17:43           ` Maxim Cournoyer
2023-02-20  1:06           ` Maxim Cournoyer
2023-02-16  4:36   ` bug#32026: [PATCH 04/10] gnu: icecat: Make language packs reproducible Maxim Cournoyer
2023-02-16  4:36   ` bug#32026: [PATCH 05/10] gnu: Add icecat-l10n and icedove-l10n Maxim Cournoyer
2023-02-16 22:45     ` Mark H Weaver
2023-02-17  3:37       ` Maxim Cournoyer
2023-02-18 20:22         ` Mark H Weaver
2023-02-18 20:42           ` Maxim Cournoyer
2023-02-16  4:36   ` bug#32026: [PATCH 06/10] gnu: icedove: Automatically load system-provided extensions Maxim Cournoyer
2023-02-16  4:36   ` bug#32026: [PATCH 07/10] gnu: Add language packs to icecat and icedove Maxim Cournoyer
2023-02-16  4:36   ` bug#32026: [PATCH 08/10] gnu: icedove: Use the locale of the system Maxim Cournoyer
2023-02-16  4:36   ` bug#32026: [PATCH 09/10] gnu: icecat: Remove gtk+-2 input Maxim Cournoyer
2023-02-16 22:50     ` Mark H Weaver
2023-02-16  4:36   ` bug#32026: [PATCH 10/10] gnu: icecat: Unbundle nss and nspr Maxim Cournoyer
2023-02-16 22:14     ` Mark H Weaver
2023-02-17 19:44       ` Maxim Cournoyer
2023-02-18  1:02         ` Mark H Weaver
2023-02-18 14:09           ` Maxim Cournoyer
2023-02-16 22:05   ` bug#32026: [PATCH 01/10] gnu: Add a 'update-mozilla-locales' helper for maintenance Mark H Weaver
2023-02-17  2:25     ` Maxim Cournoyer
2023-02-17 12:55 ` bug#32026: [PATCH v3 01/11] " Maxim Cournoyer
2023-02-17 12:55   ` bug#32026: [PATCH v3 02/11] gnu: icedove: Compute a self-contained source Maxim Cournoyer
2023-02-17 12:55   ` bug#32026: [PATCH v3 03/11] gnu: Define UPSTREAM-FIREFOX-SOURCE at the top level Maxim Cournoyer
2023-02-17 12:55   ` bug#32026: [PATCH v3 04/11] gnu: icecat: Make language packs reproducible Maxim Cournoyer
2023-02-18 21:02     ` Mark H Weaver
2023-02-19 17:35       ` Maxim Cournoyer
2023-02-17 12:55   ` bug#32026: [PATCH v3 05/11] gnu: Add icecat-l10n and icedove-l10n Maxim Cournoyer
2023-02-17 12:55   ` bug#32026: [PATCH v3 06/11] gnu: icedove: Automatically load system-provided extensions Maxim Cournoyer
2023-02-17 12:55   ` bug#32026: [PATCH v3 07/11] gnu: Add language packs to icecat and icedove Maxim Cournoyer
2023-02-17 12:55   ` bug#32026: [PATCH v3 08/11] gnu: icedove: Use the locale of the system Maxim Cournoyer
2023-02-17 12:55   ` bug#32026: [PATCH v3 09/11] gnu: icecat: Remove gtk+-2 input Maxim Cournoyer
2023-02-17 12:55   ` bug#32026: [PATCH v3 10/11] gnu: nss-next: Update to 3.88.1 [fixes CVE-2023-0767] Maxim Cournoyer
2023-02-17 21:38     ` Mark H Weaver
2023-02-18 17:27       ` Maxim Cournoyer
2023-02-18 19:49         ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
2023-02-18 20:45           ` Maxim Cournoyer
2023-02-17 12:55   ` bug#32026: [PATCH v3 11/11] gnu: icecat: Unbundle nss and nspr Maxim Cournoyer
2023-02-19 19:23 ` bug#32026: [PATCH v4 1/9] gnu: Add a 'update-mozilla-locales' helper for maintenance Maxim Cournoyer
2023-02-19 19:23   ` bug#32026: [PATCH v4 2/9] gnu: icedove: Compute a self-contained source Maxim Cournoyer
2023-02-19 19:23   ` bug#32026: [PATCH v4 3/9] gnu: Define %icecat-base-version at the top level Maxim Cournoyer
2023-02-19 20:13     ` Mark H Weaver
2023-02-19 22:14       ` Maxim Cournoyer
2023-02-19 19:24   ` bug#32026: [PATCH v4 4/9] gnu: Add icecat-l10n and icedove-l10n Maxim Cournoyer
2023-02-19 19:24   ` bug#32026: [PATCH v4 5/9] gnu: icedove: Automatically load system-provided extensions Maxim Cournoyer
2023-02-19 19:24   ` bug#32026: [PATCH v4 6/9] gnu: Add language packs to icecat and icedove Maxim Cournoyer
2023-02-19 19:24   ` bug#32026: [PATCH v4 7/9] gnu: icedove: Use the locale of the system Maxim Cournoyer
2023-02-19 19:24   ` bug#32026: [PATCH v4 8/9] gnu: icecat: Remove gtk+-2 input Maxim Cournoyer
2023-02-19 19:24   ` bug#32026: [PATCH v4 9/9] gnu: icecat: Unbundle nss and nspr Maxim Cournoyer
2023-02-19 20:17   ` bug#32026: [PATCH v4 1/9] gnu: Add a 'update-mozilla-locales' helper for maintenance Mark H Weaver
2023-02-19 23:17     ` Maxim Cournoyer
2023-02-20 11:06   ` Ludovic Courtès
2023-02-20 15:35     ` Maxim Cournoyer
2023-02-22  9:19       ` Ludovic Courtès [this message]

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

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

  git send-email \
    --in-reply-to=87mt569hwm.fsf_-_@gnu.org \
    --to=ludo@gnu.org \
    --cc=32026@debbugs.gnu.org \
    --cc=jonathan.brielmaier@web.de \
    --cc=maxim.cournoyer@gmail.com \
    --cc=mhw@netris.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 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.