delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2012/11/13/16:14:36

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
X-Mailer: exmh version 2.7.2 01/07/2005 (debian 1:2.7.2-18) with nmh-1.3
X-Exmh-Isig-CompType: comp
X-Exmh-Isig-Folder: inbox
To: geda-user AT delorie DOT com
Subject: [geda-user] Bug #903129 Translations don't work on Windows
Mime-Version: 1.0
Message-Id: <20121113211401.20747813A49B@turkos.aspodata.se>
Date: Tue, 13 Nov 2012 22:14:00 +0100 (CET)
From: karl AT aspodata DOT se (Karl Hammar)
X-Virus-Scanned: ClamAV using ClamSMTP
Reply-To: geda-user AT delorie DOT com

Peter Brett:
> libgeda, gattrib and gschem all contain the call:
> 
>  bindtextdomain (<domain>, LOCALEDIR);
>
> This will not work for Windows cross-compilation with MinGW.
> The value of LOCALEDIR that gets baked into the binaries is fixed,
> but a Windows user might try to install gEDA to any aribitrary directory.

///
Background.

bindtextdomain is the first thing that is done in libgeda_init():

$ grep -C 4 bindtextdomain libgeda.c 
void libgeda_init(void)
{
#ifdef ENABLE_NLS
  /* Initialise gettext */
  bindtextdomain (LIBGEDA_GETTEXT_DOMAIN, LOCALEDIR);
  bind_textdomain_codeset(LIBGEDA_GETTEXT_DOMAIN, "UTF-8");
#endif

  /* Initialise gobject */
$

The macro LOCALEDIR is set by the Makefile and not by any .h file:
$ grep LOCALEDIR Makefile.am 
libgeda_la_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\"  $(DATADIR_DEFS) \

And localedir is one of the standard variables in gnu autoconf system,
see [1].

You can (manually) set it to a value when configuring the system:

$ ./configure --help | grep localedir
  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]

where the default is DATAROOTDIR/locale, and:

$ ./configure --help | grep -i datarootdir
  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
  --infodir=DIR           info documentation [DATAROOTDIR/info]
  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
  --mandir=DIR            man documentation [DATAROOTDIR/man]
  --docdir=DIR            documentation root [DATAROOTDIR/doc/geda-gaf]
                          install XDG desktop files in DIR [[DIR=DATAROOTDIR]]
                          [[DIR=DATAROOTDIR]]
  --with-pcb-datadir=DIR  search for PCB libraries in DIR [[DATAROOTDIR/pcb]]
$

the default is for DATAROOTDIR is PREFIX/share.

All of the above is about where to place the language files. In Linux
localedir is typically /usr/share/locale or /usr/local/share/locale
and the en_GB files on my system are at:

$ ls -l /usr/local/share/locale/en_GB/LC_MESSAGES
total 84
-rw-r--r-- 1 karl users 33928 2012-05-11 12:45 geda-gschem.mo
-rw-r--r-- 1 karl users 14688 2010-12-21 23:20 libgeda38.mo
-rw-r--r-- 1 karl users 13794 2011-11-27 13:38 libgeda40.mo
-rw-r--r-- 1 karl users 13164 2012-05-11 12:44 libgeda41.mo
$

For cross-compilation the problem is that the person compiling the 
source doesn't know where the the person downloading the binary will 
put the language files.

///

I see the following solutions:

a, Tell the user he must install the binary in <dir> if he wants locale 
   support, or just install it there without user intervention

b, binary patch the lib at install time

c, replace LOCALEDIR with value from a config file, e.g. ~/.gEDA/locale

d, since libgeda isn't really a freestanding lib, and the caller could
   possible also need some language files, push the problem to caller.
   E.g. by a parameter: libgeda_int(char *localedir);

Regards,
/Karl Hammar

[1] http://www.gnu.org/software/make/manual/html_node/Directory-Variables.html

-----------------------------------------------------------------------
Aspö Data
Lilla Aspö 148
S-742 94 Östhammar
Sweden
+46 173 140 57


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019