Georg Baum wrote:

I had a very short look at the code this evening. AFAICS we need all the

stuff because we want to control the translation based on the language of the current document. In other words, you can have a Finnish UI with German layout styles (labels). The code in messages.C seems to do the right thing.

Nevertheless, my patch changes it in two ways:

- It checks a couple of environment variables to determine lang_. This is needed for MinGW on the Windows platform.

- It moves a couple of checks out of the getter method and into the constructor. This is more efficient but not necessary in principle.

But, of course, it would be nice if someone with more gettext experience could have a look at the code as well.

I am wondering whether we need to work around a broken setlocale() on windows. Isn't it possible to fix it?
Well, actually there are two problems:

1. setlocale returns NULL which makes LyX crash. I think this is valid behaviour of setlocale and we definitely have to check for NULL in our code.

2. AFAICS setlocale returns NULL on Windows/MinGW even if it shouldn't. However, querying the environment variables via getEnv() works. You could say that this is a bug in MinGW but please note that we also check for (multiple!) environment variables at a different place in the code! I don't understand we do it once this way and once the other way. The patch that I proposed does all the checks in the constructor in a single way (actually in both ways).

This said I think/hope that my patch fixes a real problem without introducing a complicated workaround. However, my knowledge in this particular area is limited. If you have a better, more reasonable solution - fine!

Michael

Reply via email to