[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: LANG=..., currency in Gnumeric


Hugo van der Merwe écrivait :
> Now, looking at currency, it does British pounds when one sets en_GB, but
> it appears it sticks with $ when one sets en_ZA, instead of using South
> African "R" - would this be a Gnumeric-specific thing, or a system-wide
> i18n thing, to do with locales, etc?

I don't know much about en_ZA, but I found this :

  root@virus:~# grep cur /usr/share/i18n/locales/en_ZA 
  int_curr_symbol         "<U005A><U0041><U0052><U0020>"
  currency_symbol         "<U0052>"

As you can see, currency symbol is ok (U0052 = 'R') in your locale.

  root@virus:~# dpkg -S /usr/share/i18n/locales/en_ZA
  locales: /usr/share/i18n/locales/en_ZA
  root@virus:~# dpkg -l locales
  ii  locales        2.2.5-11.1     GNU C Library: National Language (locale)

First check if you have the same version...
And also that you have en_ZA locales generated (dpkg-reconfigure locales).

Then you may try this you it works (from man pages):

  cat <<__EOF__ >/tmp/currency.c
  #include <stdio.h>
  #include <locale.h>
  #include <monetary.h>
  int main(void) {
    char buffer[80];
    setlocale(LC_ALL, "");
    strfmon(buffer, sizeof(buffer), "[%^=*#6n] [%=*#6i]", 1234.567, 1234.567);
    printf("Amount is (national / international): %s\n", buffer);
    return 0;
  make /tmp/currency
  LC_MONETARY=en_ZA /tmp/currency

Running this (after having generated the en_ZA locale on my computer),
I can get this:

  root@virus:~# LC_MONETARY=en_ZA /tmp/currency
  Amount is (national / international): [ R**1234.57] [ ZAR **1,234.57]

So locales is ok. If any program doesn't display it, it can be because your
locale environment is not good (bad LANG value, not propagated or locale not
generated) or because the program (often) doesn't mind about monetary locale!

> I noticed that the KDE i18n settings don't carry over to other apps.

I don't know about KDE... I don't use it. ;-)

> Where would be the *correct* place to define LANG? /etc/profile?

Debian puts it in /etc/environment when you use "dpkg-reconfigure locales".

> But that's only for shells... ?

Nope: when you define a variable, it's put in your environment. If you don't
do anything more, then only the current processus will have access to it.
But if you do export it (using: export LANG) then all the children will be
able to read it. But even if *you* do well, it's not sufficient: the program
you are interested in also has to use the "setlocale" and "strfmon" libc
functions to give you what you want!

Regards, J.C.

Reply to: