Op 6-9-2011 11:50, Jean-Marc Lasgouttes schreef:
Le 03/09/11 21:25, Stephan Witt a écrit :
I had a go at it some time go, and it looks like the code that looks for existing translations (int Language initialization) loads all the .gmo files and after some point gettext refuses to load a new one. You can check whether removing the test for availability in Language loading fixes your problem

When I remove the test it works.
So we are in trouble, aren't we?

I think anyway that loading all gmo files just to know which ones exist is a broken concept. We have to find another way to detect which languages are supported.

JMarc

[Quietly repeating what I had already said]


The translation of the string languageTestString() is cached, so maybe we ask for the translation of this string before gettext is initialized with the correct locale ?


After further investigation: When testing for the language availability, we call "translated_ = getMessages(code()).available();". In Messages::available() we do:

    string const test = languageTestString();
    string const trans = to_utf8(get(test));

Now, this causes the translation of languageTestString() to be cached. If we try to load all languages to see whether they are available, the cached value is thus pretty much random.

When we call i18nLibFileSearch, we again try to translate languageTestString() and we return the cached value.

If you remove the above test for the translation, the translation doesn't cache the value for languageTestString() and no problems appear.


Vincent

Reply via email to