- const wxString langs[] =
- {
- _T("(System default)"),
- _T("French"),
- _T("German"),
- _T("Russian"),
- _T("English"),
- _T("English (U.S.)")
- };
-
- SetExitOnFrameDelete(FALSE);
- int lng = wxGetSingleChoiceIndex(_T("Please choose language:"), _T("Language"),
- WXSIZEOF(langs), langs);
- SetExitOnFrameDelete(TRUE);
-
- switch (lng)
- {
- case 0 : m_locale.Init(wxLANGUAGE_DEFAULT); break;
- case 1 : m_locale.Init(wxLANGUAGE_FRENCH); break;
- case 2 : m_locale.Init(wxLANGUAGE_GERMAN); break;
- case 3 : m_locale.Init(wxLANGUAGE_RUSSIAN); break;
- case 4 : m_locale.Init(wxLANGUAGE_ENGLISH); break;
- case -1:
- case 5 : m_locale.Init(wxLANGUAGE_ENGLISH_US); break;
- }
-
- // Initialize the catalogs we'll be using
- /* not needed any more, done in wxLocale ctor
- m_locale.AddCatalog("wxstd"); // 1) for library messages
- */
- m_locale.AddCatalog(wxT("internat")); // 2) our private one
- /* this catalog is installed in standard location on Linux systems,
- it might not be installed on yours - just ignore the errrors
- or comment out this line then */
+ long lng = -1;
+
+ if ( argc == 2 )
+ {
+ // the parameter must be the lang index
+ wxString(argv[1]).ToLong(&lng);
+ }
+
+ static const wxLanguage langIds[] =
+ {
+ wxLANGUAGE_DEFAULT,
+ wxLANGUAGE_FRENCH,
+ wxLANGUAGE_GERMAN,
+ wxLANGUAGE_RUSSIAN,
+ wxLANGUAGE_JAPANESE,
+ wxLANGUAGE_ENGLISH,
+ wxLANGUAGE_ENGLISH_US,
+ };
+
+ if ( lng == -1 )
+ {
+ // note that it makes no sense to translate these strings, they are
+ // shown before we set the locale anyhow
+ const wxString langNames[] =
+ {
+ _T("System default"),
+ _T("French"),
+ _T("German"),
+ _T("Russian"),
+ _T("Japanese"),
+ _T("English"),
+ _T("English (U.S.)")
+ };
+
+ // the arrays should be in sync
+ wxCOMPILE_TIME_ASSERT( WXSIZEOF(langNames) == WXSIZEOF(langIds),
+ LangArraysMismatch );
+
+ lng = wxGetSingleChoiceIndex
+ (
+ _T("Please choose language:"),
+ _T("Language"),
+ WXSIZEOF(langNames),
+ langNames
+ );
+ }
+
+ if ( lng != -1 )
+ m_locale.Init(langIds[lng]);
+
+
+ // Initialize the catalogs we'll be using
+ m_locale.AddCatalog(wxT("internat"));
+
+ // this catalog is installed in standard location on Linux systems and
+ // shows that you may make use of the standard message catalogs as well
+ //
+ // if it's not installed on your system, it is just silently ignored