Fixed problems in ubuntu
This commit is contained in:
parent
807a96c1a0
commit
743ebcd7d7
|
@ -41,7 +41,7 @@ MyPropertySheet::MyPropertySheet (
|
|||
bool expandInternalEntitiesParameter,
|
||||
bool showFullPathOnFrameParameter,
|
||||
int lang,
|
||||
const wxArrayString &translations,
|
||||
const std::set<const wxLanguageInfo *> &translations,
|
||||
wxWindowID id,
|
||||
wxString title,
|
||||
const wxPoint& position,
|
||||
|
@ -165,17 +165,18 @@ MyPropertySheet::MyPropertySheet (
|
|||
languageBox = new wxChoice (
|
||||
generalPanel,
|
||||
wxID_ANY );
|
||||
languageBox->SetExtraStyle ( languageBox->GetExtraStyle() | wxCB_SORT );
|
||||
|
||||
languageBox->Append ( _ ( "Default" ), ( void* ) wxLANGUAGE_ENGLISH_US );
|
||||
languageBox->SetSelection ( 0 );
|
||||
|
||||
int index;
|
||||
const wxLanguageInfo *info;
|
||||
wxArrayString::const_iterator trans = translations.begin();
|
||||
for ( ; trans != translations.end(); trans++ )
|
||||
std::set<const wxLanguageInfo *>::const_iterator t = translations.begin();
|
||||
for ( ; t != translations.end(); t++ )
|
||||
{
|
||||
info = wxLocale::FindLanguageInfo ( *trans );
|
||||
if ( info == NULL ) continue;
|
||||
|
||||
index = languageBox->Append ( info->Description, (void*)info->Language );
|
||||
if (lang == info->Language)
|
||||
index = languageBox->Append ( wxGetTranslation ( ( **t ).Description ),
|
||||
( void* )( **t ).Language );
|
||||
if (lang == ( **t ).Language)
|
||||
languageBox->SetSelection ( index );
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class MyPropertySheet : public wxPropertySheetDialog
|
|||
bool expandInternalEntities,
|
||||
bool showFullPathOnFrame,
|
||||
int lang,
|
||||
const wxArrayString &translations,
|
||||
const std::set<const wxLanguageInfo *> &translations,
|
||||
wxWindowID id = wxID_ANY,
|
||||
wxString title = _T ( "" ),
|
||||
const wxPoint& position = wxDefaultPosition,
|
||||
|
|
0
src/templates/Custom rule set.xml → src/templates/Custom_rule_set.xml
Executable file → Normal file
0
src/templates/Custom rule set.xml → src/templates/Custom_rule_set.xml
Executable file → Normal file
0
src/templates/DocBook 4.4 article.xml → src/templates/DocBook_4.4_article.xml
Executable file → Normal file
0
src/templates/DocBook 4.4 article.xml → src/templates/DocBook_4.4_article.xml
Executable file → Normal file
0
src/templates/DocBook 4.4 book.xml → src/templates/DocBook_4.4_book.xml
Executable file → Normal file
0
src/templates/DocBook 4.4 book.xml → src/templates/DocBook_4.4_book.xml
Executable file → Normal file
0
src/templates/DocBook 5.0b article.xml → src/templates/DocBook_5.0b_article.xml
Executable file → Normal file
0
src/templates/DocBook 5.0b article.xml → src/templates/DocBook_5.0b_article.xml
Executable file → Normal file
0
src/templates/DocBook 5.0b book.xml → src/templates/DocBook_5.0b_book.xml
Executable file → Normal file
0
src/templates/DocBook 5.0b book.xml → src/templates/DocBook_5.0b_book.xml
Executable file → Normal file
0
src/templates/Moodle glossary.xml → src/templates/Moodle_glossary.xml
Executable file → Normal file
0
src/templates/Moodle glossary.xml → src/templates/Moodle_glossary.xml
Executable file → Normal file
0
src/templates/OpenLearn document.xml → src/templates/OpenLearn_document.xml
Executable file → Normal file
0
src/templates/OpenLearn document.xml → src/templates/OpenLearn_document.xml
Executable file → Normal file
0
src/templates/RELAX NG grammar.rng → src/templates/RELAX_NG_grammar.rng
Executable file → Normal file
0
src/templates/RELAX NG grammar.rng → src/templates/RELAX_NG_grammar.rng
Executable file → Normal file
0
src/templates/WordprocessingML document.xml → src/templates/WordprocessingML_document.xml
Executable file → Normal file
0
src/templates/WordprocessingML document.xml → src/templates/WordprocessingML_document.xml
Executable file → Normal file
0
src/templates/XHTML 1.0 Strict document.html → src/templates/XHTML_1.0_Strict_document.html
Executable file → Normal file
0
src/templates/XHTML 1.0 Strict document.html → src/templates/XHTML_1.0_Strict_document.html
Executable file → Normal file
0
src/templates/XML Topic Map 1.0.xtm → src/templates/XML_Topic_Map_1.0.xtm
Executable file → Normal file
0
src/templates/XML Topic Map 1.0.xtm → src/templates/XML_Topic_Map_1.0.xtm
Executable file → Normal file
0
src/templates/XML Topic Map 2.0.xtm → src/templates/XML_Topic_Map_2.0.xtm
Executable file → Normal file
0
src/templates/XML Topic Map 2.0.xtm → src/templates/XML_Topic_Map_2.0.xtm
Executable file → Normal file
|
@ -212,7 +212,17 @@ MyApp::MyApp() : checker ( NULL ), server ( NULL ), connection ( NULL ),
|
|||
int fdnull = open ( "/dev/null", O_WRONLY, 0 );
|
||||
dup2 ( fdnull, STDERR_FILENO );
|
||||
#endif
|
||||
//myLocale.Init();
|
||||
}
|
||||
|
||||
MyApp::~MyApp()
|
||||
{
|
||||
delete checker;
|
||||
delete server;
|
||||
delete connection;
|
||||
}
|
||||
|
||||
bool MyApp::OnInit()
|
||||
{
|
||||
int systemLocale = myLocale.GetSystemLanguage();
|
||||
switch ( systemLocale )
|
||||
{
|
||||
|
@ -302,43 +312,6 @@ MyApp::MyApp() : checker ( NULL ), server ( NULL ), connection ( NULL ),
|
|||
#endif
|
||||
}
|
||||
|
||||
myLocale.Init ( lang, wxLOCALE_LOAD_DEFAULT );
|
||||
|
||||
wxArrayString prefixes;
|
||||
#ifdef __WXGTK__
|
||||
prefixes.Add ( wxT ( "/usr/share/locale" ) );
|
||||
prefixes.Add ( wxT ( "/usr/local/share/locale" ) );
|
||||
#endif
|
||||
wxString poDir = wxStandardPaths::Get().GetDataDir() +
|
||||
wxFileName::GetPathSeparator() + _T ( "po" ) + wxFileName::GetPathSeparator();
|
||||
prefixes.Add ( poDir );
|
||||
wxArrayString::const_iterator itr;
|
||||
for ( itr = prefixes.begin(); itr != prefixes.end(); itr++ )
|
||||
wxLocale::AddCatalogLookupPathPrefix ( *itr );
|
||||
|
||||
wxString catalog = _T ( "messages" );
|
||||
getAvailableTranslations ( &prefixes, &catalog );
|
||||
|
||||
if ( !myLocale.AddCatalog ( catalog ) )
|
||||
;
|
||||
|
||||
#ifndef __WXMSW__
|
||||
{
|
||||
wxLogNull noLog;
|
||||
myLocale.AddCatalog ( _T ( "fileutils" ) );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
MyApp::~MyApp()
|
||||
{
|
||||
delete checker;
|
||||
delete server;
|
||||
delete connection;
|
||||
}
|
||||
|
||||
bool MyApp::OnInit()
|
||||
{
|
||||
wxString name, service, hostName;
|
||||
name.Printf ( _T ( "xmlcopyeditor-%s" ), wxGetUserId().c_str() );
|
||||
service = IPC_SERVICE;
|
||||
|
@ -382,6 +355,38 @@ bool MyApp::OnInit()
|
|||
server = new MyServer;
|
||||
server->Create ( service );
|
||||
|
||||
myLocale.Init ( lang, wxLOCALE_LOAD_DEFAULT );
|
||||
|
||||
wxArrayString prefixes;
|
||||
#ifdef __WXGTK__
|
||||
prefixes.Add ( _T ( "/usr/share/locale" ) );
|
||||
prefixes.Add ( _T ( "/usr/share/locale-langpack" ) );
|
||||
prefixes.Add ( _T ( "/usr/local/share/locale" ) );
|
||||
#endif
|
||||
wxString poDir = wxStandardPaths::Get().GetDataDir() +
|
||||
wxFileName::GetPathSeparator() + _T ( "po" ) + wxFileName::GetPathSeparator();
|
||||
prefixes.Add ( poDir );
|
||||
for ( size_t i = 0; i < prefixes.Count(); )
|
||||
{
|
||||
if ( wxDirExists ( prefixes[i] ) )
|
||||
wxLocale::AddCatalogLookupPathPrefix ( prefixes[i++] );
|
||||
else
|
||||
prefixes.RemoveAt ( i );
|
||||
}
|
||||
|
||||
wxString catalog = _T ( "messages" );
|
||||
getAvailableTranslations ( &prefixes, &catalog );
|
||||
|
||||
if ( !myLocale.AddCatalog ( catalog ) )
|
||||
;
|
||||
|
||||
#ifndef __WXMSW__
|
||||
{
|
||||
wxLogNull noLog;
|
||||
myLocale.AddCatalog ( _T ( "coreutils" ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
MyFrame *frame;
|
||||
try
|
||||
{
|
||||
|
@ -572,7 +577,7 @@ void MyApp::HandleEvent ( wxEvtHandler *handler, wxEventFunction func, wxEvent&
|
|||
}
|
||||
#endif
|
||||
|
||||
const wxArrayString &MyApp::getAvailableTranslations (
|
||||
const std::set<const wxLanguageInfo *> &MyApp::getAvailableTranslations (
|
||||
const wxArrayString *catalogLookupPathPrefixes /*= NULL*/,
|
||||
const wxString *catalog /*= NULL*/ )
|
||||
{
|
||||
|
@ -587,10 +592,20 @@ const wxArrayString &MyApp::getAvailableTranslations (
|
|||
if ( catalog == NULL )
|
||||
throw std::invalid_argument ( "catelog" );
|
||||
|
||||
const wxLanguageInfo *info;
|
||||
#if wxCHECK_VERSION(2,9,0)
|
||||
wxTranslations *t = wxTranslations::Get();
|
||||
if ( t != NULL )
|
||||
{
|
||||
translations = t->GetAvailableTranslations ( *catalog );
|
||||
wxArrayString::const_iterator trans = translations.begin();
|
||||
for ( ; trans != translations.end(); trans++ )
|
||||
{
|
||||
info = wxLocale::FindLanguageInfo ( *trans );
|
||||
if ( info != NULL )
|
||||
translations.insert ( info );
|
||||
}
|
||||
}
|
||||
#else
|
||||
wxArrayString::const_iterator i = catalogLookupPathPrefixes->begin();
|
||||
for ( i = catalogLookupPathPrefixes->begin();
|
||||
|
@ -613,7 +628,9 @@ const wxArrayString &MyApp::getAvailableTranslations (
|
|||
if ( lang.EndsWith(".lproj", &rest) )
|
||||
lang = rest;
|
||||
#endif // __WXOSX__
|
||||
translations.push_back(lang);
|
||||
info = wxLocale::FindLanguageInfo ( lang );
|
||||
if ( info != NULL )
|
||||
translations.insert ( info );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -624,9 +641,9 @@ const wxArrayString &MyApp::getAvailableTranslations (
|
|||
return wxFileName ( dir, catelog, _T ( "mo" ) ).FileExists()
|
||||
|| wxFileName ( dir + wxFILE_SEP_PATH + _T ( "LC_MESSAGES" ), catelog, _T ( "mo" ) ).FileExists();
|
||||
}
|
||||
const wxArrayString &operator()() { return translations; }
|
||||
const std::set<const wxLanguageInfo *> &operator()() { return translations; }
|
||||
protected:
|
||||
wxArrayString translations;
|
||||
std::set<const wxLanguageInfo *> translations;
|
||||
} translations ( catalogLookupPathPrefixes, catalog );
|
||||
|
||||
return translations();
|
||||
|
@ -2573,7 +2590,6 @@ void MyFrame::OnOptions ( wxCommandEvent& WXUNUSED ( event ) )
|
|||
#else
|
||||
( _ ( "Preferences" ) );
|
||||
#endif
|
||||
MyApp *app = ( MyApp * ) wxTheApp;
|
||||
std::auto_ptr<MyPropertySheet> mpsd ( new MyPropertySheet (
|
||||
this,
|
||||
properties,
|
||||
|
@ -2587,7 +2603,7 @@ void MyFrame::OnOptions ( wxCommandEvent& WXUNUSED ( event ) )
|
|||
expandInternalEntities,
|
||||
showFullPathOnFrame,
|
||||
lang,
|
||||
app->getAvailableTranslations(),
|
||||
wxGetApp().getAvailableTranslations(),
|
||||
wxID_ANY,
|
||||
title ) );
|
||||
if ( mpsd->ShowModal() == wxID_OK )
|
||||
|
|
|
@ -176,7 +176,7 @@ class MyApp : public wxApp
|
|||
#ifndef __WXMSW__
|
||||
virtual void HandleEvent ( wxEvtHandler *handler, wxEventFunction func, wxEvent& event ) const;
|
||||
#endif
|
||||
const wxArrayString &getAvailableTranslations (
|
||||
const std::set<const wxLanguageInfo *> &getAvailableTranslations (
|
||||
const wxArrayString *catalogLookupPathPrefixes = NULL,
|
||||
const wxString *catelog = NULL );
|
||||
protected:
|
||||
|
|
Loading…
Reference in New Issue