Cannot set locale to language Vietnamese Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Laurent22300
Knows some wx things
Knows some wx things
Posts: 30
Joined: Sun Sep 07, 2008 9:38 am
Contact:

Cannot set locale to language Vietnamese

Post by Laurent22300 » Mon May 11, 2009 5:56 pm

Hello,

I'm having a strange problem with the Vietnamese locale in my application. Whenever I try to switch to it, wxWidgets prints a log error: "Cannot set locale to language Vietnamese".

However, I've checked the file and it seems fine to me. It can be opened without a problem in poEdit. Also my app already supports 19 other languages and it's the first time I get this error, so I don't think there's something wrong with my code.

Do you know what this error means and how I can fix it?

I've uploaded the po and mo files at this address: http://app.etizer.org/vi.zip

Thanks,

Laurent
Appetizer - the wxWidgets dock for Windows.

Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria » Tue May 12, 2009 12:33 am

Hi,

can you show code? Which platform?
"Keyboard not detected. Press F1 to continue"
-- Windows

Laurent22300
Knows some wx things
Knows some wx things
Posts: 30
Joined: Sun Sep 07, 2008 9:38 am
Contact:

Post by Laurent22300 » Tue May 12, 2009 6:47 pm

Below is the code I'm using. In that case, the "localeCode" argument is "vi" for "vietnamese". The code fails at "locale_->Init(info->Language)"

Code: Select all

bool MiniLaunchBar::ChangeLocale(const wxString& localeCode) {
  const wxLanguageInfo* info = wxLocale::FindLanguageInfo(localeCode);
  if (!info) {
    ELOG(_T("Could not find language info for: ") + localeCode);
    return false;
  }

  wxDELETE(locale_);

  locale_ = new wxLocale();
  locale_->Init(info->Language);
  locale_->AddCatalogLookupPathPrefix(FilePaths::GetLocalesDirectory());
  locale_->AddCatalog(_T("appetizer"));

  return true;
}
Appetizer - the wxWidgets dock for Windows.

utelle
Moderator
Moderator
Posts: 993
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Re: Cannot set locale to language Vietnamese

Post by utelle » Tue May 12, 2009 8:11 pm

Laurent22300 wrote:I'm having a strange problem with the Vietnamese locale in my application. Whenever I try to switch to it, wxWidgets prints a log error: "Cannot set locale to language Vietnamese".

However, I've checked the file and it seems fine to me. It can be opened without a problem in poEdit. Also my app already supports 19 other languages and it's the first time I get this error, so I don't think there's something wrong with my code.

Do you know what this error means and how I can fix it?
wxLocale::Init tries (1) to set the locale of the operating system and (2) to load the message catalogs for the selected locale.

In your case step (1) fails with the given error message. The reason is that support for the requested locale is not installed in your operating system. In Windows you would have to select the option for "complex scripts and RTL languages" in the regional settings and language options dialog to install the required support files, and thus to solve the issue.

Regards,

Ulrich

Laurent22300
Knows some wx things
Knows some wx things
Posts: 30
Joined: Sun Sep 07, 2008 9:38 am
Contact:

Post by Laurent22300 » Thu May 14, 2009 6:36 pm

That was it! Thanks utelle :)
Appetizer - the wxWidgets dock for Windows.

Post Reply