On Friday 25 March 2005 20:02, Dimitri wrote:
Hi,
> It's also mentinoned there:
> "It is initialized with a country/language pair in its constructor..."
> Shouldn't this better be:
> "It is initialized with a language/country pair in its constructor..."?
Yes, that would be better.
> Also in that same page:
> void setDefault ( const QLocale & locale )
> ...
> QLocale::setDefault(QLocale::Hebrew, QLocale::Israel);
>
> I believe
> setDefault needs a 'const QLocale&' not a 'QLocale::Language,
> QLocale::Country', am I wrong?
That's true, but a QLocale is implicitly constructed from the
language/country pair:
http://doc.trolltech.com/4.0/qlocale.html#QLocale.3
I will the explanation to you but if I call it like in the doc example it will
generate an error of:
error: no matching function for call to
`QLocale::setDefault(QLocale::Language, QLocale::Country)'
/usr/local/qt-new/include/QtCore/qlocale.h:472: note: candidates are: static
void QLocale::setDefault(const QLocale&)
make: *** [qlocale.o] Error 1
> Finally, it's also mentioned that:
> "If a QLocale object is constructed with the default constructor, it will
> use the default locale's settings"
>
> I thought the default locale should be that stored on LC_ALL, but calling
> LC_ALL=xx ./myapp seems to ignore it, am I missing something?
What is the actual value of 'xx'? To get the list of supported locales:
locale -a
I tried LC_ALL=en_US
For example on a Fedora Core 3 system LC_ALL usually needs to be set
to
a language/country pair:
Then I would consider this a bug in es locale in Fedora. For Arabic it works
properly (without the country part) with my Fedora 3 installation
# LC_ALL=ar date
س مار 26 01:38:25 AST 2005
$ export LC_ALL=es
$ date
Fri Mar 25 11:11:11 CET 2005
$
# uname -a
Linux localhost 2.6.10-1mdk #1 Fri Jan 14 14:31:03 CET 2005 i686 AMD
Athlon(tm) 64 Processor 3200+ unknown GNU/Linux
# locale
LANG=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
LC_NUMERIC=ar_SA.UTF-8
LC_TIME=en_US.UTF-8
LC_COLLATE=en_US.UTF-8
LC_MONETARY=ar_SA.UTF-8
LC_MESSAGES=en_US.UTF-8
LC_PAPER=ar_SA.UTF-8
LC_NAME=ar_SA.UTF-8
LC_ADDRESS=ar_SA.UTF-8
LC_TELEPHONE=ar_SA.UTF-8
LC_MEASUREMENT=ar_SA.UTF-8
LC_IDENTIFICATION=ar_SA.UTF-8
LC_ALL=
With
QLocale ar;
QString s1 = ar.toString(1.571429E+07, 'e');
QLabel *label = new QLabel(s1);
label->show();
Calling this code with LC_ALL=en, LC_ALL=en_US, and LC_ALL=en_US.UTF-8, all
still give the same result => an Arabic localazied numbers!
Calling with LC_NUMERIC=en_US.UTF-8 did the trick but I understand that LC_ALL
should overwrite LC_NUMERIC.
--
Munzir Taha PGP Key available
gpg --recv-keys --keyserver
www.mandrakesecure.net F0671821
Telecommunications and Electronics Engineer
Mandrake Club Member
Maintainer of the OpenBugs project page at
http://www.arabic-fedora.org/munzir/OpenBugs.html
Maintainer of Fedora Arabic Translation Project
https://listman.redhat.com/mailman/listinfo/fedora-trans-ar
CIW Designer, ICDL, MOUS, Linux+, LPI 101
New Horizons CLC, Riyadh, SA