wxLocale Errors

15 views
Skip to first unread message

The Devils Jester

unread,
Jan 30, 2012, 8:18:45 PM1/30/12
to wx-u...@googlegroups.com
My system is not set up to use German as checked with "locale -a" but I have a complete translation file for my application in German, and I can load it just fine (and my app is translated), however I get a warning popup every time saying that the locale could not be set.  Other than installing support for German (which shouldnt be needed as my app is fully translated) is there a way to get rid of (or hide) this error message?  This is on Linux.

Vadim Zeitlin

unread,
Jan 31, 2012, 7:48:03 AM1/31/12
to wx-u...@googlegroups.com
On Mon, 30 Jan 2012 19:18:45 -0600 The Devils Jester <thedevi...@gmail.com> wrote:

TDJ> My system is not set up to use German as checked with "locale -a" but I
TDJ> have a complete translation file for my application in German, and I can
TDJ> load it just fine (and my app is translated), however I get a warning popup
TDJ> every time saying that the locale could not be set. Other than installing
TDJ> support for German (which shouldnt be needed as my app is fully translated)

It is needed as locale affects other things, such as date and time or
monetary formats, that are not taken care of by translations.

TDJ> is there a way to get rid of (or hide) this error message?

You can use wxTranslations::AddCatalog() in 2.9 if you only want to add a
catalog and not change the locale.

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/

Dion Whittaker

unread,
Jan 31, 2012, 7:56:31 AM1/31/12
to wx-u...@googlegroups.com
On 31/01/12 9:18 AM, The Devils Jester wrote:
My system is not set up to use German as checked with "locale -a" but I have a complete translation file for my application in German, and I can load it just fine (and my app is translated), however I get a warning popup every time saying that the locale could not be set.  Other than installing support for German (which shouldnt be needed as my app is fully translated) is there a way to get rid of (or hide) this error message?  This is on Linux.
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
 
To unsubscribe, send email to wx-users+u...@googlegroups.com
or visit http://groups.google.com/group/wx-users
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
I encountered a similar message using locales that aren't support by the OS X c-runtime and use something like the following to supress them

bool openLocale(int language)
{
    {
        wxLogNull    nolog;
        wxLocale locale = new wxLocale(language, 0);
    }
    ...
}   

The Devils Jester

unread,
Jan 31, 2012, 8:06:11 AM1/31/12
to wx-u...@googlegroups.com
That is not the behavior I want VZ.  I want them to load correctly when they are available on the platform, but if they are not, then it should silently fail, or at worst, output a warning to the console, not a nasty popup.

Does adding a "wxLogNull    nolog;" to the function prevent wxWidgets from showing their error message?
--
If you make something that any idiot can use, only idiots will use it.

Dion Whittaker

unread,
Jan 31, 2012, 8:42:39 AM1/31/12
to wx-u...@googlegroups.com
On 31/01/12 9:06 PM, The Devils Jester wrote:
That is not the behavior I want VZ.  I want them to load correctly when they are available on the platform, but if they are not, then it should silently fail, or at worst, output a warning to the console, not a nasty popup.

Does adding a "wxLogNull    nolog;" to the function prevent wxWidgets from showing their error message?
Yes. It's explained in the logging overview in the documentation - it will suppress output from wxLogXXX() functions.

On Tue, Jan 31, 2012 at 6:48 AM, Vadim Zeitlin <va...@wxwidgets.org> wrote:
On Mon, 30 Jan 2012 19:18:45 -0600 The Devils Jester <thedevi...@gmail.com> wrote:

TDJ> My system is not set up to use German as checked with "locale -a" but I
TDJ> have a complete translation file for my application in German, and I can
TDJ> load it just fine (and my app is translated), however I get a warning popup
TDJ> every time saying that the locale could not be set.  Other than installing
TDJ> support for German (which shouldnt be needed as my app is fully translated)

 It is needed as locale affects other things, such as date and time or
monetary formats, that are not taken care of by translations.

TDJ> is there a way to get rid of (or hide) this error message?

 You can use wxTranslations::AddCatalog() in 2.9 if you only want to add a
catalog and not change the locale.

 Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
              http://www.tt-solutions.com/



--
If you make something that any idiot can use, only idiots will use it.

The Devils Jester

unread,
Jan 31, 2012, 9:07:44 AM1/31/12
to wx-u...@googlegroups.com
That works perfectly thanks.  BTW is there any way to get the language name (without setting it as the active language), if all I have is the two letter code?  (I just need the human readable name, like "German" and I have "de").
Reply all
Reply to author
Forward
0 new messages