Re: Lyx is overrideing Layout-Preferences

2004-02-10 Thread Georg Baum
Jean-Marc Lasgouttes wrote:
 -137??? What kind of change have they done to the xforms package they
  ship?

For example they use the following line to determine the current locale (can
be found in patch xforms-1.0-i18n.patch in the .src.rpm):

char * loc = setlocale(LC_ALL, );

According to 'man setlocale' this should be

char * loc = setlocale(LC_ALL, NULL);

Maybe this is the problem. This line is inside a function use_fonset() that
seems to be called very often, so a workaround in LyX might not be easy. 


Georg




Re: Lyx is overrideing Layout-Preferences

2004-02-10 Thread Juergen Spitzmueller
Jean-Marc Lasgouttes wrote:
 Could you (and Juergen?) try the attached patch. On my machine, I get
 the following debug info:

 schuss: LC_ALL=de_DE src/lyx
 parse_init: [1] LC_NUMERIC=C
 parse_init: [2] LC_NUMERIC=de_DE
 parse_init: [3] LC_NUMERIC=C

 As you see, xforms sets the locale to de_DE, but this is fixed on 3rd
 step.

I get the same (but the bug is still there).

Jürgen.

 JMarc


Re: Lyx is overrideing Layout-Preferences

2004-02-10 Thread Juergen Spitzmueller
Georg Baum wrote:
 For example they use the following line to determine the current locale
 (can be found in patch xforms-1.0-i18n.patch in the .src.rpm):

 char * loc = setlocale(LC_ALL, );

 According to 'man setlocale' this should be

 char * loc = setlocale(LC_ALL, NULL);

 Maybe this is the problem. This line is inside a function use_fonset() that
 seems to be called very often, so a workaround in LyX might not be easy.

Well spotted, Georg. This seems to be the problem indeed. I have changed 
setlocale(LC_ALL, ) to setlocale(LC_ALL, NULL) and rebuilt the xforms rpm. 
Now the problem has disappeared.
I have attached the original suse xforms-i18n.patch (without my changes). The 
changelog says that this patch is needed for cjk-lyx.

Should I submit a bug report to the package author?

Jürgen.


xforms-1.0-i18n.patch.gz
Description: GNU Zip compressed data


Re: Lyx is overrideing Layout-Preferences

2004-02-10 Thread Jean-Marc Lasgouttes
 Juergen == Juergen Spitzmueller [EMAIL PROTECTED] writes:

Juergen Georg Baum wrote:
 Maybe this is the problem. This line is inside a function
 use_fonset() that seems to be called very often, so a workaround in
 LyX might not be easy.

I do not really see how we could do that.

Juergen Well spotted, Georg. This seems to be the problem indeed. I
Juergen have changed setlocale(LC_ALL, ) to setlocale(LC_ALL, NULL)
Juergen and rebuilt the xforms rpm. Now the problem has disappeared.

That seems completely wrong indeed.

Juergen I have attached the original suse xforms-i18n.patch (without
Juergen my changes). The changelog says that this patch is needed for
Juergen cjk-lyx.

Juergen Should I submit a bug report to the package author?

Yes, please. It would be interesting to know where they took the patch
from, I do not see any CJK patch for xforms on the CJK-LyX page, and
as far as far as I can remember nothing of the sort was sent to the
xforms mailing list.

It would be nice to ascertain quickly whether we have to do something
about it in 1.3.4.

JMarc


Re: Lyx is overrideing Layout-Preferences

2004-02-10 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:
 Yes, please. It would be interesting to know where they took the
 patch from, I do not see any CJK patch for xforms on the CJK-LyX
 page, and as far as far as I can remember nothing of the sort was
 sent to the xforms mailing list.

I think it was. Attached is a something pretty close to the thing that 
CG Han used to make cjk-lyx 1.3.x. This diff contains only the 
changes that he made to xforms. It expands to 110kB...

-- 
Angus

cjk-xforms-1.0.diff.bz2
Description: BZip2 compressed data


Re: Lyx is overrideing Layout-Preferences

2004-02-10 Thread Juergen Spitzmueller
Jean-Marc Lasgouttes wrote:
 Juergen Should I submit a bug report to the package author?

 Yes, please. 

Done.

 It would be interesting to know where they took the patch 
 from, I do not see any CJK patch for xforms on the CJK-LyX page, and
 as far as far as I can remember nothing of the sort was sent to the
 xforms mailing list.

The patch author seems to be Mike Fabian, the i18n guy from SuSE 
(http://www.suse.de/~mfabian/).

Jürgen.


Re: Lyx is overrideing Layout-Preferences

2004-02-10 Thread Juergen Spitzmueller
Angus Leeming wrote:
 I think it was. Attached is a something pretty close to the thing that
 CG Han used to make cjk-lyx 1.3.x. This diff contains only the
 changes that he made to xforms. It expands to 110kB...

Hmm at least it contains the same error (L. 268) -- if this is an error.

Jürgen.


Re: Lyx is overrideing Layout-Preferences

2004-02-10 Thread Angus Leeming
Juergen Spitzmueller wrote:

 Angus Leeming wrote:
 I think it was. Attached is a something pretty close to the thing
 that CG Han used to make cjk-lyx 1.3.x. This diff contains only the
 changes that he made to xforms. It expands to 110kB...
 
 Hmm at least it contains the same error (L. 268) -- if this is an
 error.

I think that it is fair to say that CG was hacking the xforms sources 
to get something useable. Given that I acted as 'consultant' to this 
hack and given that my knowledge of X is minimal, I'm amazed that the 
thing got off the ground at all.

-- 
Angus



Re: Lyx is overrideing Layout-Preferences

2004-02-10 Thread Juergen Spitzmueller
Angus Leeming wrote:
 I think that it is fair to say that CG was hacking the xforms sources
 to get something useable. Given that I acted as 'consultant' to this
 hack and given that my knowledge of X is minimal, I'm amazed that the
 thing got off the ground at all.

Angus, it was not my intention to limit CG's effort. We are just trying to 
find the source of the l10n bug. So my comment was rather a question (if that 
line is the error we are looking for).

Regards,
Jürgen.


Re: Lyx is overrideing Layout-Preferences

2004-02-10 Thread Angus Leeming
Juergen Spitzmueller wrote:
 I think that it is fair to say that CG was hacking the xforms
 sources to get something useable. Given that I acted as
 'consultant' to this hack and given that my knowledge of X is
 minimal, I'm amazed that the thing got off the ground at all.
 
 Angus, it was not my intention to limit CG's effort. We are just
 trying to find the source of the l10n bug. So my comment was rather
 a question (if that line is the error we are looking for).

I think that we have crossed wires. I didn't mean to sound touchy; I'm 
not. I'm just saying that I'm not surprised that you're finding bugs 
in this code, given the lack of real understanding behind its 
implementation.

If the man pages say use NULL, then use NULL. If you tell CG 
[EMAIL PROTECTED], then he'll be able to correct his 
sources too, or at least explain why he made the change.

Regards,
-- 
Angus



Re: Lyx is overrideing Layout-Preferences

2004-02-10 Thread Jean-Marc Lasgouttes
 Angus == Angus Leeming [EMAIL PROTECTED] writes:

Angus If the man pages say use NULL, then use NULL. If you tell CG
Angus [EMAIL PROTECTED], then he'll be able to
Angus correct his sources too, or at least explain why he made the
Angus change.

Could you do it, or do you want me to?

JMarc


Re: Lyx is overrideing Layout-Preferences

2004-02-10 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:
 Angus If the man pages say use NULL, then use NULL. If you tell CG
 Angus [EMAIL PROTECTED], then he'll be able to
 Angus correct his sources too, or at least explain why he made the
 Angus change.
 
 Could you do it, or do you want me to?

You please. Deadlines loom here and I haven't really been following 
the details of this discussion too closely.

-- 
Angus



Re: Lyx is overrideing Layout-Preferences

2004-02-10 Thread Georg Baum
Jean-Marc Lasgouttes wrote:
> -137??? What kind of change have they done to the xforms package they
>  ship?

For example they use the following line to determine the current locale (can
be found in patch xforms-1.0-i18n.patch in the .src.rpm):

char * loc = setlocale(LC_ALL, "");

According to 'man setlocale' this should be

char * loc = setlocale(LC_ALL, NULL);

Maybe this is the problem. This line is inside a function use_fonset() that
seems to be called very often, so a workaround in LyX might not be easy. 


Georg




Re: Lyx is overrideing Layout-Preferences

2004-02-10 Thread Juergen Spitzmueller
Jean-Marc Lasgouttes wrote:
> Could you (and Juergen?) try the attached patch. On my machine, I get
> the following debug info:
>
> schuss: LC_ALL=de_DE src/lyx
> parse_init: [1] LC_NUMERIC=C
> parse_init: [2] LC_NUMERIC=de_DE
> parse_init: [3] LC_NUMERIC=C
>
> As you see, xforms sets the locale to de_DE, but this is fixed on 3rd
> step.

I get the same (but the bug is still there).

Jürgen.

> JMarc


Re: Lyx is overrideing Layout-Preferences

2004-02-10 Thread Juergen Spitzmueller
Georg Baum wrote:
> For example they use the following line to determine the current locale
> (can be found in patch xforms-1.0-i18n.patch in the .src.rpm):
>
> char * loc = setlocale(LC_ALL, "");
>
> According to 'man setlocale' this should be
>
> char * loc = setlocale(LC_ALL, NULL);
>
> Maybe this is the problem. This line is inside a function use_fonset() that
> seems to be called very often, so a workaround in LyX might not be easy.

Well spotted, Georg. This seems to be the problem indeed. I have changed 
setlocale(LC_ALL, "") to setlocale(LC_ALL, NULL) and rebuilt the xforms rpm. 
Now the problem has disappeared.
I have attached the original suse xforms-i18n.patch (without my changes). The 
changelog says that this patch is needed for cjk-lyx.

Should I submit a bug report to the package author?

Jürgen.


xforms-1.0-i18n.patch.gz
Description: GNU Zip compressed data


Re: Lyx is overrideing Layout-Preferences

2004-02-10 Thread Jean-Marc Lasgouttes
> "Juergen" == Juergen Spitzmueller <[EMAIL PROTECTED]> writes:

Juergen> Georg Baum wrote:
>> Maybe this is the problem. This line is inside a function
>> use_fonset() that seems to be called very often, so a workaround in
>> LyX might not be easy.

I do not really see how we could do that.

Juergen> Well spotted, Georg. This seems to be the problem indeed. I
Juergen> have changed setlocale(LC_ALL, "") to setlocale(LC_ALL, NULL)
Juergen> and rebuilt the xforms rpm. Now the problem has disappeared.

That seems completely wrong indeed.

Juergen> I have attached the original suse xforms-i18n.patch (without
Juergen> my changes). The changelog says that this patch is needed for
Juergen> cjk-lyx.

Juergen> Should I submit a bug report to the package author?

Yes, please. It would be interesting to know where they took the patch
from, I do not see any CJK patch for xforms on the CJK-LyX page, and
as far as far as I can remember nothing of the sort was sent to the
xforms mailing list.

It would be nice to ascertain quickly whether we have to do something
about it in 1.3.4.

JMarc


Re: Lyx is overrideing Layout-Preferences

2004-02-10 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:
> Yes, please. It would be interesting to know where they took the
> patch from, I do not see any CJK patch for xforms on the CJK-LyX
> page, and as far as far as I can remember nothing of the sort was
> sent to the xforms mailing list.

I think it was. Attached is a something pretty close to the thing that 
CG Han used to make cjk-lyx 1.3.x. This diff contains only the 
changes that he made to xforms. It expands to 110kB...

-- 
Angus

cjk-xforms-1.0.diff.bz2
Description: BZip2 compressed data


Re: Lyx is overrideing Layout-Preferences

2004-02-10 Thread Juergen Spitzmueller
Jean-Marc Lasgouttes wrote:
> Juergen> Should I submit a bug report to the package author?
>
> Yes, please. 

Done.

> It would be interesting to know where they took the patch 
> from, I do not see any CJK patch for xforms on the CJK-LyX page, and
> as far as far as I can remember nothing of the sort was sent to the
> xforms mailing list.

The patch author seems to be Mike Fabian, the i18n guy from SuSE 
(http://www.suse.de/~mfabian/).

Jürgen.


Re: Lyx is overrideing Layout-Preferences

2004-02-10 Thread Juergen Spitzmueller
Angus Leeming wrote:
> I think it was. Attached is a something pretty close to the thing that
> CG Han used to make cjk-lyx 1.3.x. This diff contains only the
> changes that he made to xforms. It expands to 110kB...

Hmm at least it contains the same error (L. 268) -- if this is an error.

Jürgen.


Re: Lyx is overrideing Layout-Preferences

2004-02-10 Thread Angus Leeming
Juergen Spitzmueller wrote:

> Angus Leeming wrote:
>> I think it was. Attached is a something pretty close to the thing
>> that CG Han used to make cjk-lyx 1.3.x. This diff contains only the
>> changes that he made to xforms. It expands to 110kB...
> 
> Hmm at least it contains the same error (L. 268) -- if this is an
> error.

I think that it is fair to say that CG was hacking the xforms sources 
to get something useable. Given that I acted as 'consultant' to this 
hack and given that my knowledge of X is minimal, I'm amazed that the 
thing got off the ground at all.

-- 
Angus



Re: Lyx is overrideing Layout-Preferences

2004-02-10 Thread Juergen Spitzmueller
Angus Leeming wrote:
> I think that it is fair to say that CG was hacking the xforms sources
> to get something useable. Given that I acted as 'consultant' to this
> hack and given that my knowledge of X is minimal, I'm amazed that the
> thing got off the ground at all.

Angus, it was not my intention to limit CG's effort. We are just trying to 
find the source of the l10n bug. So my comment was rather a question (if that 
line is the error we are looking for).

Regards,
Jürgen.


Re: Lyx is overrideing Layout-Preferences

2004-02-10 Thread Angus Leeming
Juergen Spitzmueller wrote:
>> I think that it is fair to say that CG was hacking the xforms
>> sources to get something useable. Given that I acted as
>> 'consultant' to this hack and given that my knowledge of X is
>> minimal, I'm amazed that the thing got off the ground at all.
> 
> Angus, it was not my intention to limit CG's effort. We are just
> trying to find the source of the l10n bug. So my comment was rather
> a question (if that line is the error we are looking for).

I think that we have crossed wires. I didn't mean to sound touchy; I'm 
not. I'm just saying that I'm not surprised that you're finding bugs 
in this code, given the lack of real understanding behind its 
implementation.

If the man pages say use NULL, then use NULL. If you tell CG 
<[EMAIL PROTECTED]>, then he'll be able to correct his 
sources too, or at least explain why he made the change.

Regards,
-- 
Angus



Re: Lyx is overrideing Layout-Preferences

2004-02-10 Thread Jean-Marc Lasgouttes
> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

Angus> If the man pages say use NULL, then use NULL. If you tell CG
Angus> <[EMAIL PROTECTED]>, then he'll be able to
Angus> correct his sources too, or at least explain why he made the
Angus> change.

Could you do it, or do you want me to?

JMarc


Re: Lyx is overrideing Layout-Preferences

2004-02-10 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:
> Angus> If the man pages say use NULL, then use NULL. If you tell CG
> Angus> <[EMAIL PROTECTED]>, then he'll be able to
> Angus> correct his sources too, or at least explain why he made the
> Angus> change.
> 
> Could you do it, or do you want me to?

You please. Deadlines loom here and I haven't really been following 
the details of this discussion too closely.

-- 
Angus



Re: Lyx is overrideing Layout-Preferences

2004-02-09 Thread Jean-Marc Lasgouttes
 Georg == Georg Baum [EMAIL PROTECTED] writes:

Georg Jean-Marc Lasgouttes wrote:
Juergen I have glibc 2.3.2 (shipped with SuSE, probably updated by
Juergen SuSE online update once or more). No idea. Maybe I'll try
Juergen with SuSE 9.0 (which I have on my laptop).
  Might be nice.

Georg I just tried on SuSE 9.0 with packages:

Georg glibc-2.3.2-88 xforms-1.0-137

-137??? What kind of change have they done to the xforms package they
 ship?

Georg Both show the same behaviour that Jürgen has: export
Georg LC_NUMERIC=C works, and it does not work without it.

Could you (and Juergen?) try the attached patch. On my machine, I get
the following debug info:

schuss: LC_ALL=de_DE src/lyx
parse_init: [1] LC_NUMERIC=C
parse_init: [2] LC_NUMERIC=de_DE
parse_init: [3] LC_NUMERIC=C

As you see, xforms sets the locale to de_DE, but this is fixed on 3rd
step.

JMarc

Index: src/gettext.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/gettext.C,v
retrieving revision 1.15
diff -u -p -r1.15 gettext.C
--- src/gettext.C	22 May 2002 01:16:35 -	1.15
+++ src/gettext.C	9 Feb 2004 14:56:14 -
@@ -59,7 +59,6 @@ void locale_init()
 	setlocale(LC_MESSAGES, );
 #  endif
 	setlocale(LC_CTYPE, );
-	setlocale(LC_NUMERIC, C);
 }
 
 
Index: src/frontends/xforms/lyx_gui.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/lyx_gui.C,v
retrieving revision 1.31.2.1
diff -u -p -r1.31.2.1 lyx_gui.C
--- src/frontends/xforms/lyx_gui.C	4 Nov 2003 11:52:04 -	1.31.2.1
+++ src/frontends/xforms/lyx_gui.C	9 Feb 2004 14:56:14 -
@@ -141,11 +141,12 @@ void lyx_gui::parse_init(int  argc, cha
 
 	const int num_res = sizeof(res)/sizeof(FL_resource);
 
+	lyxerr  parse_init: [1] LC_NUMERIC=  setlocale(LC_NUMERIC, NULL) endl;
+	string const lc_num = setlocale(LC_NUMERIC, NULL);
 	fl_initialize(argc, argv, LyX, cmdopt, num_res);
-
-	// It appears that, in xforms =0.89.5, fl_initialize()
-	// calls setlocale() and ruins our LC_NUMERIC setting.
-	locale_init();
+	lyxerr  parse_init: [2] LC_NUMERIC=  setlocale(LC_NUMERIC, NULL) endl;
+	setlocale(LC_NUMERIC, lc_num.c_str());
+	lyxerr  parse_init: [3] LC_NUMERIC=  setlocale(LC_NUMERIC, NULL) endl;
 
 	fl_get_app_resources(res, num_res);
 


Re: Lyx is overrideing Layout-Preferences

2004-02-09 Thread Georg Baum
Jean-Marc Lasgouttes wrote:
 -137??? What kind of change have they done to the xforms package they
  ship?

Don't know. Maybe some automatic rebuilds?

 Could you (and Juergen?) try the attached patch. On my machine, I get
 the following debug info:
 
 schuss: LC_ALL=de_DE src/lyx
 parse_init: [1] LC_NUMERIC=C
 parse_init: [2] LC_NUMERIC=de_DE
 parse_init: [3] LC_NUMERIC=C

I get the same both on SuSE 8.2 and 9.0. The output is also the same if I
don't set LC_NUMERIC at all but only LANG. So this means it does work now?


Georg




Re: Lyx is overrideing Layout-Preferences

2004-02-09 Thread Jean-Marc Lasgouttes
> "Georg" == Georg Baum <[EMAIL PROTECTED]> writes:

Georg> Jean-Marc Lasgouttes wrote:
Juergen> I have glibc 2.3.2 (shipped with SuSE, probably updated by
Juergen> SuSE online update once or more). No idea. Maybe I'll try
Juergen> with SuSE 9.0 (which I have on my laptop).
>>  Might be nice.

Georg> I just tried on SuSE 9.0 with packages:

Georg> glibc-2.3.2-88 xforms-1.0-137

-137??? What kind of change have they done to the xforms package they
 ship?

Georg> Both show the same behaviour that Jürgen has: export
Georg> LC_NUMERIC=C works, and it does not work without it.

Could you (and Juergen?) try the attached patch. On my machine, I get
the following debug info:

schuss: LC_ALL=de_DE src/lyx
parse_init: [1] LC_NUMERIC=C
parse_init: [2] LC_NUMERIC=de_DE
parse_init: [3] LC_NUMERIC=C

As you see, xforms sets the locale to de_DE, but this is fixed on 3rd
step.

JMarc

Index: src/gettext.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/gettext.C,v
retrieving revision 1.15
diff -u -p -r1.15 gettext.C
--- src/gettext.C	22 May 2002 01:16:35 -	1.15
+++ src/gettext.C	9 Feb 2004 14:56:14 -
@@ -59,7 +59,6 @@ void locale_init()
 	setlocale(LC_MESSAGES, "");
 #  endif
 	setlocale(LC_CTYPE, "");
-	setlocale(LC_NUMERIC, "C");
 }
 
 
Index: src/frontends/xforms/lyx_gui.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/lyx_gui.C,v
retrieving revision 1.31.2.1
diff -u -p -r1.31.2.1 lyx_gui.C
--- src/frontends/xforms/lyx_gui.C	4 Nov 2003 11:52:04 -	1.31.2.1
+++ src/frontends/xforms/lyx_gui.C	9 Feb 2004 14:56:14 -
@@ -141,11 +141,12 @@ void lyx_gui::parse_init(int & argc, cha
 
 	const int num_res = sizeof(res)/sizeof(FL_resource);
 
+	lyxerr << "parse_init: [1] LC_NUMERIC=" << setlocale(LC_NUMERIC, NULL) <=0.89.5, fl_initialize()
-	// calls setlocale() and ruins our LC_NUMERIC setting.
-	locale_init();
+	lyxerr << "parse_init: [2] LC_NUMERIC=" << setlocale(LC_NUMERIC, NULL) <Re: Lyx is overrideing Layout-Preferences

Jean-Marc Lasgouttes wrote:
> -137??? What kind of change have they done to the xforms package they
>  ship?

Don't know. Maybe some automatic rebuilds?

> Could you (and Juergen?) try the attached patch. On my machine, I get
> the following debug info:
> 
> schuss: LC_ALL=de_DE src/lyx
> parse_init: [1] LC_NUMERIC=C
> parse_init: [2] LC_NUMERIC=de_DE
> parse_init: [3] LC_NUMERIC=C

I get the same both on SuSE 8.2 and 9.0. The output is also the same if I
don't set LC_NUMERIC at all but only LANG. So this means it does work now?


Georg




Re: Lyx is overrideing Layout-Preferences

 Angus == Angus Leeming [EMAIL PROTECTED] writes:

Angus However, not changing the existing default behaviour is always
Angus a good thing, no?

Except that this was introduced in 0.89.5 to support input methods,
and I think that it was a bad decision at the time.

 What kind of flag do you have in mind? A parameter to the function,
 or a resource?

Angus All existing xforms flags can be set by either passing the flag
Angus through fl_initialize or by setting the approriate xresource.
Angus After both these data sets (argv, xresource) are parsed, the
Angus variables are stored in a global FL_RESOURCE variable. This
Angus data is therefore visible to the whole of the xforms library.

That could be good indeed.

Of course, this does not change the problem we have with current
xforms in LyX...

JMarc


Re: Lyx is overrideing Layout-Preferences

 Juergen == Juergen Spitzmueller [EMAIL PROTECTED] writes:

Juergen OK, I have added a debug message to xforms_helpers which
Juergen outputs the current LC_NUMERIC setting (setlocale
Juergen (LC_NUMERIC,NULL)) while running LyX. This is indeeed
Juergen [EMAIL PROTECTED], so the setlocale(LC_NUMERIC, C) call in
Juergen gettext.C seems to have no effect (or seems to be overridden
Juergen by xforms).

That's very strange... Using your patch, I get a german interface with
the following command and correct debug output:

schuss: LC_ALL=de_DE LC_NUMERIC=de_DE src/lyx
locale (Numeric): C
locale (Numeric): C
locale (Numeric): C
locale (Numeric): C
locale (Numeric): C
locale (Numeric): C
locale (Numeric): C
locale (Numeric): C
locale (Numeric): C


How come setlocale does not behave in the same way on your box? Do you
have the latest glibc updates?

JMarc


Re: Lyx is overrideing Layout-Preferences

Jean-Marc Lasgouttes wrote:
 That's very strange... Using your patch, I get a german interface with
 the following command and correct debug output:

 schuss: LC_ALL=de_DE LC_NUMERIC=de_DE src/lyx
 locale (Numeric): C
 locale (Numeric): C
 locale (Numeric): C
 locale (Numeric): C
 locale (Numeric): C
 locale (Numeric): C
 locale (Numeric): C
 locale (Numeric): C
 locale (Numeric): C

Same xforms version?

 How come setlocale does not behave in the same way on your box? Do you
 have the latest glibc updates?

I have glibc 2.3.2 (shipped with SuSE, probably updated by SuSE online update 
once or more). No idea. Maybe I'll try with SuSE 9.0 (which I have on my 
laptop).

What do the other SuSE people get?

Jürgen.

 JMarc


Re: Lyx is overrideing Layout-Preferences

 Juergen == Juergen Spitzmueller [EMAIL PROTECTED] writes:

Juergen Jean-Marc Lasgouttes wrote:
 That's very strange... Using your patch, I get a german interface
 with the following command and correct debug output:
 
 schuss: LC_ALL=de_DE LC_NUMERIC=de_DE src/lyx locale (Numeric): C
 locale (Numeric): C locale (Numeric): C locale (Numeric): C locale
 (Numeric): C locale (Numeric): C locale (Numeric): C locale
 (Numeric): C locale (Numeric): C

Juergen Same xforms version?

No, this is something like latest cvs. But I am almost sure that there
have been no changes related to locale since 1.0.0.

 How come setlocale does not behave in the same way on your box? Do
 you have the latest glibc updates?

Juergen I have glibc 2.3.2 (shipped with SuSE, probably updated by
Juergen SuSE online update once or more). No idea. Maybe I'll try
Juergen with SuSE 9.0 (which I have on my laptop).

Might be nice.

Juergen What do the other SuSE people get?

I have another report which seems to come form a german fellow:
http://bugzilla.lyx.org/show_bug.cgi?id=1483

Maybe he's a suse user too.

JMarc


Re: Lyx is overrideing Layout-Preferences

Jean-Marc Lasgouttes wrote:

 Juergen I have glibc 2.3.2 (shipped with SuSE, probably updated by
 Juergen SuSE online update once or more). No idea. Maybe I'll try
 Juergen with SuSE 9.0 (which I have on my laptop).
 
 Might be nice.

I just tried on SuSE 9.0 with packages:

glibc-2.3.2-88
xforms-1.0-137

and on 8.2 with packages:

glibc-2.3.2-6
xforms-1.0-34

Both show the same behaviour that Jürgen has: export LC_NUMERIC=C works, and
it does not work without it.


Georg




Re: Lyx is overrideing Layout-Preferences

> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

Angus> However, not changing the existing default behaviour is always
Angus> a good thing, no?

Except that this was introduced in 0.89.5 to support input methods,
and I think that it was a bad decision at the time.

>> What kind of flag do you have in mind? A parameter to the function,
>> or a resource?

Angus> All existing xforms flags can be set by either passing the flag
Angus> through fl_initialize or by setting the approriate xresource.
Angus> After both these data sets (argv, xresource) are parsed, the
Angus> variables are stored in a global FL_RESOURCE variable. This
Angus> data is therefore visible to the whole of the xforms library.

That could be good indeed.

Of course, this does not change the problem we have with current
xforms in LyX...

JMarc


Re: Lyx is overrideing Layout-Preferences

> "Juergen" == Juergen Spitzmueller <[EMAIL PROTECTED]> writes:

Juergen> OK, I have added a debug message to xforms_helpers which
Juergen> outputs the current LC_NUMERIC setting (setlocale
Juergen> (LC_NUMERIC,NULL)) while running LyX. This is indeeed
Juergen> [EMAIL PROTECTED], so the setlocale(LC_NUMERIC, "C") call in
Juergen> gettext.C seems to have no effect (or seems to be overridden
Juergen> by xforms).

That's very strange... Using your patch, I get a german interface with
the following command and correct debug output:

schuss: LC_ALL=de_DE LC_NUMERIC=de_DE src/lyx
locale (Numeric): C
locale (Numeric): C
locale (Numeric): C
locale (Numeric): C
locale (Numeric): C
locale (Numeric): C
locale (Numeric): C
locale (Numeric): C
locale (Numeric): C


How come setlocale does not behave in the same way on your box? Do you
have the latest glibc updates?

JMarc


Re: Lyx is overrideing Layout-Preferences

Jean-Marc Lasgouttes wrote:
> That's very strange... Using your patch, I get a german interface with
> the following command and correct debug output:
>
> schuss: LC_ALL=de_DE LC_NUMERIC=de_DE src/lyx
> locale (Numeric): C
> locale (Numeric): C
> locale (Numeric): C
> locale (Numeric): C
> locale (Numeric): C
> locale (Numeric): C
> locale (Numeric): C
> locale (Numeric): C
> locale (Numeric): C

Same xforms version?

> How come setlocale does not behave in the same way on your box? Do you
> have the latest glibc updates?

I have glibc 2.3.2 (shipped with SuSE, probably updated by SuSE online update 
once or more). No idea. Maybe I'll try with SuSE 9.0 (which I have on my 
laptop).

What do the other SuSE people get?

Jürgen.

> JMarc


Re: Lyx is overrideing Layout-Preferences

> "Juergen" == Juergen Spitzmueller <[EMAIL PROTECTED]> writes:

Juergen> Jean-Marc Lasgouttes wrote:
>> That's very strange... Using your patch, I get a german interface
>> with the following command and correct debug output:
>> 
>> schuss: LC_ALL=de_DE LC_NUMERIC=de_DE src/lyx locale (Numeric): C
>> locale (Numeric): C locale (Numeric): C locale (Numeric): C locale
>> (Numeric): C locale (Numeric): C locale (Numeric): C locale
>> (Numeric): C locale (Numeric): C

Juergen> Same xforms version?

No, this is something like latest cvs. But I am almost sure that there
have been no changes related to locale since 1.0.0.

>> How come setlocale does not behave in the same way on your box? Do
>> you have the latest glibc updates?

Juergen> I have glibc 2.3.2 (shipped with SuSE, probably updated by
Juergen> SuSE online update once or more). No idea. Maybe I'll try
Juergen> with SuSE 9.0 (which I have on my laptop).

Might be nice.

Juergen> What do the other SuSE people get?

I have another report which seems to come form a german fellow:
http://bugzilla.lyx.org/show_bug.cgi?id=1483

Maybe he's a suse user too.

JMarc


Re: Lyx is overrideing Layout-Preferences

Jean-Marc Lasgouttes wrote:

> Juergen> I have glibc 2.3.2 (shipped with SuSE, probably updated by
> Juergen> SuSE online update once or more). No idea. Maybe I'll try
> Juergen> with SuSE 9.0 (which I have on my laptop).
> 
> Might be nice.

I just tried on SuSE 9.0 with packages:

glibc-2.3.2-88
xforms-1.0-137

and on 8.2 with packages:

glibc-2.3.2-6
xforms-1.0-34

Both show the same behaviour that Jürgen has: export LC_NUMERIC=C works, and
it does not work without it.


Georg




Re: Lyx is overrideing Layout-Preferences

Jean-Marc Lasgouttes wrote:
 In gettext.C:locale_init, we do a
   setlocale(LC_NUMERIC, C);
 which is supposed to reset LC_NUMERIC to a good value. Might it be the
 C is not a valid locale for your glibc version? Maybe POSIX is
 better? What does 'man setlocale' say?

SuSE seems to prefer POSIX, but I don't think that this is the problem.
export LC_NUMERIC=C before starting LyX solves the problem (as does export 
LC_NUMERIC=POSIX).
I wonder if xforms is overriding the setlocale call somewhere. There is a 
comment in xforms/lyx_gui.C:

// It appears that, in xforms =0.89.5, fl_initialize()
// calls setlocale() and ruins our LC_NUMERIC setting.
then follows a locale_init(); call. 

OK, I have added a debug message to xforms_helpers which outputs the current 
LC_NUMERIC setting (setlocale (LC_NUMERIC,NULL)) while running LyX. This is 
indeeed [EMAIL PROTECTED], so the setlocale(LC_NUMERIC, C) call in gettext.C seems 
to have no effect (or seems to be overridden by xforms).

HTH,
Jürgen.



Re: Lyx is overrideing Layout-Preferences

 Juergen == Juergen Spitzmueller [EMAIL PROTECTED] writes:

Juergen OK, I have added a debug message to xforms_helpers which
Juergen outputs the current LC_NUMERIC setting (setlocale
Juergen (LC_NUMERIC,NULL)) while running LyX. 

Could you give me the exact patch, so that I can try here in the same
conditions? 

Juergen This is indeeed [EMAIL PROTECTED], so the setlocale(LC_NUMERIC, C)
Juergen call in gettext.C seems to have no effect (or seems to be
Juergen overridden by xforms).

Which version of xforms?

Here is the code flow:

1/ main() calls locale_init(), which does 
setlocale(LC_NUMERIC, C);

2/ lyx_gui::parse_init calls fl_initialize, which calls
setlocale(LC_ALL,);

3/ lyx_gui::parse_init calls locale_init() again, in an effort to undo
   what xforms has done.

This used to work, but we have now reports that it does not, at least
on some systems. I guess that the problem is the precedence of LC_ALL
on the other locale settings. Once LC_ALL has been set, does setting
LC_NUMERIC override the value? Is that different for different glibc
implementations?

A workaround could be to replace the locale_init call in
lyx_gui::parse_init by something like

char * lc_all = setlocale(LC_ALL, NULL);
fl_initialize(argc, argv, LyX, cmdopt, num_res);
setlocale(LC_ALL, lc_all.c_str());

Note that this is probably equivalent to just doing
fl_initialize(argc, argv, LyX, cmdopt, num_res);
setlocale(LC_ALL, C);
but it feels safer.

Could you try that?


Actually, the call to setlocale(LC_ALL,) in xforms is IMO an error,
since a library should never set the locale like that. I wonder though
whether removing it would break some apps relying on that. Angus, what
do you think of that?

JMarc


Re: Lyx is overrideing Layout-Preferences

Jean-Marc Lasgouttes wrote:
 Could you give me the exact patch, so that I can try here in the same
 conditions?

Yes. attached (against 1.3.4cvs).

 Juergen This is indeeed [EMAIL PROTECTED], so the setlocale(LC_NUMERIC, C)
 Juergen call in gettext.C seems to have no effect (or seems to be
 Juergen overridden by xforms).

 Which version of xforms?

1.0.0 (shipped with SuSE 8.2 AFAIR).

 A workaround could be to replace the locale_init call in
 lyx_gui::parse_init by something like

 char * lc_all = setlocale(LC_ALL, NULL);
         fl_initialize(argc, argv, LyX, cmdopt, num_res);
         setlocale(LC_ALL, lc_all.c_str());

 Note that this is probably equivalent to just doing
         fl_initialize(argc, argv, LyX, cmdopt, num_res);
         setlocale(LC_ALL, C);
 but it feels safer.

 Could you try that?

I tried the former. Seems to have no effect.

Jürgen.
Index: src/frontends/xforms/xforms_helpers.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/xforms_helpers.C,v
retrieving revision 1.54.2.1
diff -u -r1.54.2.1 xforms_helpers.C
--- src/frontends/xforms/xforms_helpers.C	29 Dec 2003 13:22:12 -	1.54.2.1
+++ src/frontends/xforms/xforms_helpers.C	5 Feb 2004 13:33:22 -
@@ -14,6 +14,8 @@
 #pragma implementation
 #endif
 
+#include locale.h
+
 #include xforms_helpers.h
 
 #include debug.h
@@ -150,6 +152,8 @@
 		// No need to check for its presence in the choice, therefore.
 		fl_set_choice_text(choice, default_unit.c_str());
 	} else {
+		lyxerr  locale (Numeric): 
+		setlocale (LC_NUMERIC,NULL)  std::endl;
 		updateWidgetsFromLength(input, choice,
 LyXLength(str), default_unit);
 	}


Re: Lyx is overrideing Layout-Preferences

Jean-Marc Lasgouttes wrote:
 Actually, the call to setlocale(LC_ALL,) in xforms is IMO an
 error, since a library should never set the locale like that. I
 wonder though whether removing it would break some apps relying on
 that. Angus, what do you think of that?

Why not make it configurable, passing a --dont_set_locale flag to 
fl_initialize, so that default behaviour is unchanged?

-- 
Angus



Re: Lyx is overrideing Layout-Preferences

 Angus == Angus Leeming [EMAIL PROTECTED] writes:

Angus Jean-Marc Lasgouttes wrote:
 Actually, the call to setlocale(LC_ALL,) in xforms is IMO an
 error, since a library should never set the locale like that. I
 wonder though whether removing it would break some apps relying on
 that. Angus, what do you think of that?

Angus Why not make it configurable, passing a --dont_set_locale
Angus flag to fl_initialize, so that default behaviour is unchanged?

I would be interested to know whether any library does such a thing.

What kind of flag do you have in mind? A parameter to the function, or
a resource?

JMarc



Re: Lyx is overrideing Layout-Preferences

Jean-Marc Lasgouttes wrote:
 Actually, the call to setlocale(LC_ALL,) in xforms is IMO an
 error, since a library should never set the locale like that. I
 wonder though whether removing it would break some apps relying on
 that. Angus, what do you think of that?
 
 Angus Why not make it configurable, passing a --dont_set_locale
 Angus flag to fl_initialize, so that default behaviour is
 unchanged?
 
 I would be interested to know whether any library does such a thing.

How can I answer that? 

However, not changing the existing default behaviour is always a good 
thing, no?

 What kind of flag do you have in mind? A parameter to the function,
 or a resource?

All existing xforms flags can be set by either passing the flag 
through fl_initialize or by setting the approriate xresource. After 
both these data sets (argv, xresource) are parsed, the variables are 
stored in a global FL_RESOURCE variable. This data is therefore 
visible to the whole of the xforms library. 

The world outside doesn't get to see the definition of this struct, 
so can't change its contents.

Seems like a well thought out scheme, no?

-- 
Angus



Re: Lyx is overrideing Layout-Preferences

Jean-Marc Lasgouttes wrote:
> In gettext.C:locale_init, we do a
>   setlocale(LC_NUMERIC, "C");
> which is supposed to reset LC_NUMERIC to a good value. Might it be the
> "C" is not a valid locale for your glibc version? Maybe POSIX is
> better? What does 'man setlocale' say?

SuSE seems to prefer POSIX, but I don't think that this is the problem.
export LC_NUMERIC=C before starting LyX solves the problem (as does export 
LC_NUMERIC=POSIX).
I wonder if xforms is overriding the setlocale call somewhere. There is a 
comment in xforms/lyx_gui.C:

// It appears that, in xforms >=0.89.5, fl_initialize()
// calls setlocale() and ruins our LC_NUMERIC setting.
then follows a locale_init(); call. 

OK, I have added a debug message to xforms_helpers which outputs the current 
LC_NUMERIC setting (setlocale (LC_NUMERIC,NULL)) while running LyX. This is 
indeeed [EMAIL PROTECTED], so the setlocale(LC_NUMERIC, "C") call in gettext.C seems 
to have no effect (or seems to be overridden by xforms).

HTH,
Jürgen.



Re: Lyx is overrideing Layout-Preferences

> "Juergen" == Juergen Spitzmueller <[EMAIL PROTECTED]> writes:

Juergen> OK, I have added a debug message to xforms_helpers which
Juergen> outputs the current LC_NUMERIC setting (setlocale
Juergen> (LC_NUMERIC,NULL)) while running LyX. 

Could you give me the exact patch, so that I can try here in the same
conditions? 

Juergen> This is indeeed [EMAIL PROTECTED], so the setlocale(LC_NUMERIC, "C")
Juergen> call in gettext.C seems to have no effect (or seems to be
Juergen> overridden by xforms).

Which version of xforms?

Here is the code flow:

1/ main() calls locale_init(), which does 
setlocale(LC_NUMERIC, "C");

2/ lyx_gui::parse_init calls fl_initialize, which calls
setlocale(LC_ALL,"");

3/ lyx_gui::parse_init calls locale_init() again, in an effort to undo
   what xforms has done.

This used to work, but we have now reports that it does not, at least
on some systems. I guess that the problem is the precedence of LC_ALL
on the other locale settings. Once LC_ALL has been set, does setting
LC_NUMERIC override the value? Is that different for different glibc
implementations?

A workaround could be to replace the locale_init call in
lyx_gui::parse_init by something like

char * lc_all = setlocale(LC_ALL, NULL);
fl_initialize(, argv, "LyX", cmdopt, num_res);
setlocale(LC_ALL, lc_all.c_str());

Note that this is probably equivalent to just doing
fl_initialize(, argv, "LyX", cmdopt, num_res);
setlocale(LC_ALL, "C");
but it feels safer.

Could you try that?


Actually, the call to setlocale(LC_ALL,"") in xforms is IMO an error,
since a library should never set the locale like that. I wonder though
whether removing it would break some apps relying on that. Angus, what
do you think of that?

JMarc


Re: Lyx is overrideing Layout-Preferences

Jean-Marc Lasgouttes wrote:
> Could you give me the exact patch, so that I can try here in the same
> conditions?

Yes. attached (against 1.3.4cvs).

> Juergen> This is indeeed [EMAIL PROTECTED], so the setlocale(LC_NUMERIC, "C")
> Juergen> call in gettext.C seems to have no effect (or seems to be
> Juergen> overridden by xforms).
>
> Which version of xforms?

1.0.0 (shipped with SuSE 8.2 AFAIR).

> A workaround could be to replace the locale_init call in
> lyx_gui::parse_init by something like
>
> char * lc_all = setlocale(LC_ALL, NULL);
>         fl_initialize(, argv, "LyX", cmdopt, num_res);
>         setlocale(LC_ALL, lc_all.c_str());
>
> Note that this is probably equivalent to just doing
>         fl_initialize(, argv, "LyX", cmdopt, num_res);
>         setlocale(LC_ALL, "C");
> but it feels safer.
>
> Could you try that?

I tried the former. Seems to have no effect.

Jürgen.
Index: src/frontends/xforms/xforms_helpers.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/xforms_helpers.C,v
retrieving revision 1.54.2.1
diff -u -r1.54.2.1 xforms_helpers.C
--- src/frontends/xforms/xforms_helpers.C	29 Dec 2003 13:22:12 -	1.54.2.1
+++ src/frontends/xforms/xforms_helpers.C	5 Feb 2004 13:33:22 -
@@ -14,6 +14,8 @@
 #pragma implementation
 #endif
 
+#include 
+
 #include "xforms_helpers.h"
 
 #include "debug.h"
@@ -150,6 +152,8 @@
 		// No need to check for its presence in the choice, therefore.
 		fl_set_choice_text(choice, default_unit.c_str());
 	} else {
+		lyxerr << "locale (Numeric): "
+		   << setlocale (LC_NUMERIC,NULL) << std::endl;
 		updateWidgetsFromLength(input, choice,
 LyXLength(str), default_unit);
 	}


Re: Lyx is overrideing Layout-Preferences

Jean-Marc Lasgouttes wrote:
> Actually, the call to setlocale(LC_ALL,"") in xforms is IMO an
> error, since a library should never set the locale like that. I
> wonder though whether removing it would break some apps relying on
> that. Angus, what do you think of that?

Why not make it configurable, passing a "--dont_set_locale" flag to 
fl_initialize, so that default behaviour is unchanged?

-- 
Angus



Re: Lyx is overrideing Layout-Preferences

> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

Angus> Jean-Marc Lasgouttes wrote:
>> Actually, the call to setlocale(LC_ALL,"") in xforms is IMO an
>> error, since a library should never set the locale like that. I
>> wonder though whether removing it would break some apps relying on
>> that. Angus, what do you think of that?

Angus> Why not make it configurable, passing a "--dont_set_locale"
Angus> flag to fl_initialize, so that default behaviour is unchanged?

I would be interested to know whether any library does such a thing.

What kind of flag do you have in mind? A parameter to the function, or
a resource?

JMarc



Re: Lyx is overrideing Layout-Preferences

Jean-Marc Lasgouttes wrote:
>>> Actually, the call to setlocale(LC_ALL,"") in xforms is IMO an
>>> error, since a library should never set the locale like that. I
>>> wonder though whether removing it would break some apps relying on
>>> that. Angus, what do you think of that?
> 
> Angus> Why not make it configurable, passing a "--dont_set_locale"
> Angus> flag to fl_initialize, so that default behaviour is
> unchanged?
> 
> I would be interested to know whether any library does such a thing.

How can I answer that? 

However, not changing the existing default behaviour is always a good 
thing, no?

> What kind of flag do you have in mind? A parameter to the function,
> or a resource?

All existing xforms flags can be set by either passing the flag 
through fl_initialize or by setting the approriate xresource. After 
both these data sets (argv, xresource) are parsed, the variables are 
stored in a global FL_RESOURCE variable. This data is therefore 
visible to the whole of the xforms library. 

The world outside doesn't get to see the definition of this struct, 
so can't change its contents.

Seems like a well thought out scheme, no?

-- 
Angus



Re: Lyx is overrideing Layout-Preferences

 Juergen == Juergen Spitzmueller [EMAIL PROTECTED] writes:

Juergen Juergen Spitzmueller wrote:
  I saw it too late! Could you experiment with those variables
 (also  LC_MONETARY, maybe)? I cannot find any reference about what
  LC_MEASUREMENT does...
 
 Not very much ATM.

Juergen Well I did it nevertheless. 

Thanks :)

Juergen LC_NUMERIC is to blame AFAICS. Setting this variable to en_US
Juergen solves the problem. All of the others I have tried do not
Juergen change anything.

In gettext.C:locale_init, we do a
setlocale(LC_NUMERIC, C);
which is supposed to reset LC_NUMERIC to a good value. Might it be the
C is not a valid locale for your glibc version? Maybe POSIX is
better? What does 'man setlocale' say?

JMarc


Re: Lyx is overrideing Layout-Preferences

Jean-Marc Lasgouttes [EMAIL PROTECTED] writes:

 Juergen == Juergen Spitzmueller [EMAIL PROTECTED] writes:

| Juergen Juergen Spitzmueller wrote:
  I saw it too late! Could you experiment with those variables
 (also  LC_MONETARY, maybe)? I cannot find any reference about what
  LC_MEASUREMENT does...
 
 Not very much ATM.

| Juergen Well I did it nevertheless. 

| Thanks :)

| Juergen LC_NUMERIC is to blame AFAICS. Setting this variable to en_US
| Juergen solves the problem. All of the others I have tried do not
| Juergen change anything.

| In gettext.C:locale_init, we do a
|   setlocale(LC_NUMERIC, C);
| which is supposed to reset LC_NUMERIC to a good value. Might it be the
| C is not a valid locale for your glibc version? Maybe POSIX is
| better? What does 'man setlocale' say?

I thought 'C' was requried to exits by the standard.

-- 
Lgb



Re: Lyx is overrideing Layout-Preferences

 Lars == Lars Gullik Bjønnes [EMAIL PROTECTED] writes:

Lars I thought 'C' was requried to exits by the standard.

I thought so too, but I do not have a better guess currently.

JMarc



Re: Lyx is overrideing Layout-Preferences

> "Juergen" == Juergen Spitzmueller <[EMAIL PROTECTED]> writes:

Juergen> Juergen Spitzmueller wrote:
>> > I saw it too late! Could you experiment with those variables
>> (also > LC_MONETARY, maybe)? I cannot find any reference about what
>> > LC_MEASUREMENT does...
>> 
>> Not very much ATM.

Juergen> Well I did it nevertheless. 

Thanks :)

Juergen> LC_NUMERIC is to blame AFAICS. Setting this variable to en_US
Juergen> solves the problem. All of the others I have tried do not
Juergen> change anything.

In gettext.C:locale_init, we do a
setlocale(LC_NUMERIC, "C");
which is supposed to reset LC_NUMERIC to a good value. Might it be the
"C" is not a valid locale for your glibc version? Maybe POSIX is
better? What does 'man setlocale' say?

JMarc


Re: Lyx is overrideing Layout-Preferences

Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes:

>> "Juergen" == Juergen Spitzmueller <[EMAIL PROTECTED]> writes:
>
| Juergen> Juergen Spitzmueller wrote:
>>> > I saw it too late! Could you experiment with those variables
>>> (also > LC_MONETARY, maybe)? I cannot find any reference about what
>>> > LC_MEASUREMENT does...
>>> 
>>> Not very much ATM.
>
| Juergen> Well I did it nevertheless. 
>
| Thanks :)
>
| Juergen> LC_NUMERIC is to blame AFAICS. Setting this variable to en_US
| Juergen> solves the problem. All of the others I have tried do not
| Juergen> change anything.
>
| In gettext.C:locale_init, we do a
|   setlocale(LC_NUMERIC, "C");
| which is supposed to reset LC_NUMERIC to a good value. Might it be the
| "C" is not a valid locale for your glibc version? Maybe POSIX is
| better? What does 'man setlocale' say?

I thought 'C' was requried to exits by the standard.

-- 
Lgb



Re: Lyx is overrideing Layout-Preferences

> "Lars" == Lars Gullik Bjønnes <[EMAIL PROTECTED]> writes:

Lars> I thought 'C' was requried to exits by the standard.

I thought so too, but I do not have a better guess currently.

JMarc



Re: Lyx is overrideing Layout-Preferences

Juergen Spitzmueller wrote:
 OK, this is a bug in the xforms frontend. The problem is that the length
 widgets in the xforms frontend strip all values behind the dot (while
 applying). I suspect that the bug is in xforms_helpers.C
 (getLengthFromWidgets), but it didn't find it.
 Any ideas?

More debugging showed that the problem is in updateWidgetsFromLengthString. 
This function passes a string const  str as LyXLength(str) to update 
WidgetsFromLength. 
But if I have a string str = 3.2cm, LyXLength(str).asString() returns 3cm. Now 
the question is: why?

Jürgen.


Re: Lyx is overrideing Layout-Preferences

Juergen Spitzmueller wrote:

 More debugging showed that the problem is in
 updateWidgetsFromLengthString. This function passes a string const  str
 as LyXLength(str) to update WidgetsFromLength.
 But if I have a string str = 3.2cm, LyXLength(str).asString() returns 3cm.
 Now the question is: why?

Could it be a locale problem? It seems that lyx uses atof to convert a
string to a number (so I presume the locale is used there), but I think
there are some harcoded . as decimal separators in the frontends
validators.

Alfredo




Re: Lyx is overrideing Layout-Preferences

Alfredo Braunstein wrote:
 Could it be a locale problem?

Yes, seems so. The problem disappears when I switch LANG to en_US.

Jürgen.


Re: Lyx is overrideing Layout-Preferences

 Juergen == Juergen Spitzmueller [EMAIL PROTECTED] writes:

Juergen Alfredo Braunstein wrote:
 Could it be a locale problem?

Juergen Yes, seems so. The problem disappears when I switch LANG to
Juergen en_US.

What are the environment variables that are set when you change your
environment? I do not understand how LANG can change the writing of
numbers?

What Linux is that? SUSE?

JMarc


Re: Lyx is overrideing Layout-Preferences

Jean-Marc Lasgouttes wrote:
 What are the environment variables that are set when you change your
 environment? 

Which ones? Default LANG is [EMAIL PROTECTED]

 I do not understand how LANG can change the writing of 
 numbers?

Me neither. Note that this is an xforms specific problem.

 What Linux is that? SUSE?

Yes. SuSE 8.2

Jürgen.


Re: Lyx is overrideing Layout-Preferences

Am Montag, 02. Februar 2004 15:57 schrieb Juergen Spitzmueller:
  What are the environment variables that are set when you change your
  environment?

 Which ones?

OK, this is the output of locale before switching LANG to en_US:

[EMAIL PROTECTED]
LC_CTYPE=[EMAIL PROTECTED]
LC_NUMERIC=[EMAIL PROTECTED]
LC_TIME=[EMAIL PROTECTED]
LC_COLLATE=POSIX
LC_MONETARY=[EMAIL PROTECTED]
LC_MESSAGES=[EMAIL PROTECTED]
LC_PAPER=[EMAIL PROTECTED]
LC_NAME=[EMAIL PROTECTED]
LC_ADDRESS=[EMAIL PROTECTED]
LC_TELEPHONE=[EMAIL PROTECTED]
LC_MEASUREMENT=[EMAIL PROTECTED]
LC_IDENTIFICATION=[EMAIL PROTECTED]
LC_ALL=

and after:

LANG=en_US
LC_CTYPE=en_US
LC_NUMERIC=en_US
LC_TIME=en_US
LC_COLLATE=POSIX
LC_MONETARY=en_US
LC_MESSAGES=en_US
LC_PAPER=en_US
LC_NAME=en_US
LC_ADDRESS=en_US
LC_TELEPHONE=en_US
LC_MEASUREMENT=en_US
LC_IDENTIFICATION=en_US
LC_ALL=

HTH,
Jürgen.


Re: Lyx is overrideing Layout-Preferences

 Juergen == Juergen Spitzmueller [EMAIL PROTECTED] writes:

Juergen Jean-Marc Lasgouttes wrote:
 What are the environment variables that are set when you change
 your environment?

Juergen Which ones? Default LANG is [EMAIL PROTECTED]

Do you have any LC_* variables set?

 I do not understand how LANG can change the writing of numbers?

Juergen Me neither. Note that this is an xforms specific problem.

Yes, we had some of these in the past with xforms... It does the
setting of locales, which IMO is a big mistake.

JMarc


Re: Lyx is overrideing Layout-Preferences

Jean-Marc Lasgouttes wrote:
 Do you have any LC_* variables set?

Yes, see my previous mail (i guess either LC_NUMERIC or LC_MEASUREMENT are to 
blame).

Jürgen


Re: Lyx is overrideing Layout-Preferences

 Juergen == Juergen Spitzmueller [EMAIL PROTECTED] writes:

Juergen Jean-Marc Lasgouttes wrote:
 Do you have any LC_* variables set?

Juergen Yes, see my previous mail (i guess either LC_NUMERIC or
Juergen LC_MEASUREMENT are to blame).

I saw it too late! Could you experiment with those variables (also
LC_MONETARY, maybe)? I cannot find any reference about what
LC_MEASUREMENT does...



Re: Lyx is overrideing Layout-Preferences

Am Montag, 02. Februar 2004 17:36 schrieb Jean-Marc Lasgouttes:
 Juergen Yes, see my previous mail (i guess either LC_NUMERIC or
 Juergen LC_MEASUREMENT are to blame).

 I saw it too late! Could you experiment with those variables (also
 LC_MONETARY, maybe)? I cannot find any reference about what
 LC_MEASUREMENT does...

Not very much ATM. I have to prepare a talk. But I can have a look after this 
week. What should I do? just set those variables to en_US and see which one 
triggers the bug? (I have no idea what we are looking for).

Jürgen.


Re: Lyx is overrideing Layout-Preferences

Juergen Spitzmueller wrote:
  I saw it too late! Could you experiment with those variables (also
  LC_MONETARY, maybe)? I cannot find any reference about what
  LC_MEASUREMENT does...

 Not very much ATM.

Well I did it nevertheless. LC_NUMERIC is to blame AFAICS. Setting this 
variable to en_US solves the problem. All of the others I have tried do not 
change anything.

Jürgen.


Re: Lyx is overrideing Layout-Preferences

Juergen Spitzmueller wrote:
> OK, this is a bug in the xforms frontend. The problem is that the length
> widgets in the xforms frontend strip all values behind the dot (while
> applying). I suspect that the bug is in xforms_helpers.C
> (getLengthFromWidgets), but it didn't find it.
> Any ideas?

More debugging showed that the problem is in updateWidgetsFromLengthString. 
This function passes a string const & str as LyXLength(str) to update 
WidgetsFromLength. 
But if I have a string str = 3.2cm, LyXLength(str).asString() returns 3cm. Now 
the question is: why?

Jürgen.


Re: Lyx is overrideing Layout-Preferences

Juergen Spitzmueller wrote:

> More debugging showed that the problem is in
> updateWidgetsFromLengthString. This function passes a string const & str
> as LyXLength(str) to update WidgetsFromLength.
> But if I have a string str = 3.2cm, LyXLength(str).asString() returns 3cm.
> Now the question is: why?

Could it be a locale problem? It seems that lyx uses atof to convert a
string to a number (so I presume the locale is used there), but I think
there are some harcoded "." as decimal separators in the frontends
validators.

Alfredo




Re: Lyx is overrideing Layout-Preferences

Alfredo Braunstein wrote:
> Could it be a locale problem?

Yes, seems so. The problem disappears when I switch LANG to en_US.

Jürgen.


Re: Lyx is overrideing Layout-Preferences

> "Juergen" == Juergen Spitzmueller <[EMAIL PROTECTED]> writes:

Juergen> Alfredo Braunstein wrote:
>> Could it be a locale problem?

Juergen> Yes, seems so. The problem disappears when I switch LANG to
Juergen> en_US.

What are the environment variables that are set when you change your
environment? I do not understand how LANG can change the writing of
numbers?

What Linux is that? SUSE?

JMarc


Re: Lyx is overrideing Layout-Preferences

Jean-Marc Lasgouttes wrote:
> What are the environment variables that are set when you change your
> environment? 

Which ones? Default LANG is [EMAIL PROTECTED]

> I do not understand how LANG can change the writing of 
> numbers?

Me neither. Note that this is an xforms specific problem.

> What Linux is that? SUSE?

Yes. SuSE 8.2

Jürgen.


Re: Lyx is overrideing Layout-Preferences

Am Montag, 02. Februar 2004 15:57 schrieb Juergen Spitzmueller:
> > What are the environment variables that are set when you change your
> > environment?
>
> Which ones?

OK, this is the output of locale before switching LANG to en_US:

[EMAIL PROTECTED]
LC_CTYPE="[EMAIL PROTECTED]"
LC_NUMERIC="[EMAIL PROTECTED]"
LC_TIME="[EMAIL PROTECTED]"
LC_COLLATE=POSIX
LC_MONETARY="[EMAIL PROTECTED]"
LC_MESSAGES="[EMAIL PROTECTED]"
LC_PAPER="[EMAIL PROTECTED]"
LC_NAME="[EMAIL PROTECTED]"
LC_ADDRESS="[EMAIL PROTECTED]"
LC_TELEPHONE="[EMAIL PROTECTED]"
LC_MEASUREMENT="[EMAIL PROTECTED]"
LC_IDENTIFICATION="[EMAIL PROTECTED]"
LC_ALL=

and after:

LANG=en_US
LC_CTYPE="en_US"
LC_NUMERIC="en_US"
LC_TIME="en_US"
LC_COLLATE=POSIX
LC_MONETARY="en_US"
LC_MESSAGES="en_US"
LC_PAPER="en_US"
LC_NAME="en_US"
LC_ADDRESS="en_US"
LC_TELEPHONE="en_US"
LC_MEASUREMENT="en_US"
LC_IDENTIFICATION="en_US"
LC_ALL=

HTH,
Jürgen.


Re: Lyx is overrideing Layout-Preferences

> "Juergen" == Juergen Spitzmueller <[EMAIL PROTECTED]> writes:

Juergen> Jean-Marc Lasgouttes wrote:
>> What are the environment variables that are set when you change
>> your environment?

Juergen> Which ones? Default LANG is [EMAIL PROTECTED]

Do you have any LC_* variables set?

>> I do not understand how LANG can change the writing of numbers?

Juergen> Me neither. Note that this is an xforms specific problem.

Yes, we had some of these in the past with xforms... It does the
setting of locales, which IMO is a big mistake.

JMarc


Re: Lyx is overrideing Layout-Preferences

Jean-Marc Lasgouttes wrote:
> Do you have any LC_* variables set?

Yes, see my previous mail (i guess either LC_NUMERIC or LC_MEASUREMENT are to 
blame).

Jürgen


Re: Lyx is overrideing Layout-Preferences

> "Juergen" == Juergen Spitzmueller <[EMAIL PROTECTED]> writes:

Juergen> Jean-Marc Lasgouttes wrote:
>> Do you have any LC_* variables set?

Juergen> Yes, see my previous mail (i guess either LC_NUMERIC or
Juergen> LC_MEASUREMENT are to blame).

I saw it too late! Could you experiment with those variables (also
LC_MONETARY, maybe)? I cannot find any reference about what
LC_MEASUREMENT does...



Re: Lyx is overrideing Layout-Preferences

Am Montag, 02. Februar 2004 17:36 schrieb Jean-Marc Lasgouttes:
> Juergen> Yes, see my previous mail (i guess either LC_NUMERIC or
> Juergen> LC_MEASUREMENT are to blame).
>
> I saw it too late! Could you experiment with those variables (also
> LC_MONETARY, maybe)? I cannot find any reference about what
> LC_MEASUREMENT does...

Not very much ATM. I have to prepare a talk. But I can have a look after this 
week. What should I do? just set those variables to en_US and see which one 
triggers the bug? (I have no idea what we are looking for).

Jürgen.


Re: Lyx is overrideing Layout-Preferences

Juergen Spitzmueller wrote:
> > I saw it too late! Could you experiment with those variables (also
> > LC_MONETARY, maybe)? I cannot find any reference about what
> > LC_MEASUREMENT does...
>
> Not very much ATM.

Well I did it nevertheless. LC_NUMERIC is to blame AFAICS. Setting this 
variable to en_US solves the problem. All of the others I have tried do not 
change anything.

Jürgen.


Re: Lyx is overrideing Layout-Preferences

Anca Tibor- Attila wrote:
 I have a quite big file (dissertation), with my own layout preferences:
 top margin: 2.5cm
 bottom margin: 2.5cm

 Lyx is always changing these parameters. If I open the Document and go
 to Layout-Document, there is always 2cm. The file is not
 write-protected, anything else is working and would be accepted. I
 already tried to modify the settings with kate and then open the file in
 lyx, but it did not help.

OK, this is a bug in the xforms frontend. The problem is that the length 
widgets in the xforms frontend strip all values behind the dot (while 
applying). I suspect that the bug is in xforms_helpers.C 
(getLengthFromWidgets), but it didn't find it.
Any ideas?

Jürgen.


Re: Lyx is overrideing Layout-Preferences

Anca Tibor- Attila wrote:
> I have a quite big file (dissertation), with my own layout preferences:
> top margin: 2.5cm
> bottom margin: 2.5cm
>
> Lyx is always changing these parameters. If I open the Document and go
> to Layout->Document, there is always 2cm. The file is not
> write-protected, anything else is working and would be accepted. I
> already tried to modify the settings with kate and then open the file in
> lyx, but it did not help.

OK, this is a bug in the xforms frontend. The problem is that the length 
widgets in the xforms frontend strip all values behind the dot (while 
applying). I suspect that the bug is in xforms_helpers.C 
(getLengthFromWidgets), but it didn't find it.
Any ideas?

Jürgen.