Fixed problems in ubuntu
This commit is contained in:
parent
807a96c1a0
commit
743ebcd7d7
|
@ -41,7 +41,7 @@ MyPropertySheet::MyPropertySheet (
|
||||||
bool expandInternalEntitiesParameter,
|
bool expandInternalEntitiesParameter,
|
||||||
bool showFullPathOnFrameParameter,
|
bool showFullPathOnFrameParameter,
|
||||||
int lang,
|
int lang,
|
||||||
const wxArrayString &translations,
|
const std::set<const wxLanguageInfo *> &translations,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
wxString title,
|
wxString title,
|
||||||
const wxPoint& position,
|
const wxPoint& position,
|
||||||
|
@ -165,17 +165,18 @@ MyPropertySheet::MyPropertySheet (
|
||||||
languageBox = new wxChoice (
|
languageBox = new wxChoice (
|
||||||
generalPanel,
|
generalPanel,
|
||||||
wxID_ANY );
|
wxID_ANY );
|
||||||
|
languageBox->SetExtraStyle ( languageBox->GetExtraStyle() | wxCB_SORT );
|
||||||
|
|
||||||
|
languageBox->Append ( _ ( "Default" ), ( void* ) wxLANGUAGE_ENGLISH_US );
|
||||||
|
languageBox->SetSelection ( 0 );
|
||||||
|
|
||||||
int index;
|
int index;
|
||||||
const wxLanguageInfo *info;
|
std::set<const wxLanguageInfo *>::const_iterator t = translations.begin();
|
||||||
wxArrayString::const_iterator trans = translations.begin();
|
for ( ; t != translations.end(); t++ )
|
||||||
for ( ; trans != translations.end(); trans++ )
|
|
||||||
{
|
{
|
||||||
info = wxLocale::FindLanguageInfo ( *trans );
|
index = languageBox->Append ( wxGetTranslation ( ( **t ).Description ),
|
||||||
if ( info == NULL ) continue;
|
( void* )( **t ).Language );
|
||||||
|
if (lang == ( **t ).Language)
|
||||||
index = languageBox->Append ( info->Description, (void*)info->Language );
|
|
||||||
if (lang == info->Language)
|
|
||||||
languageBox->SetSelection ( index );
|
languageBox->SetSelection ( index );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ class MyPropertySheet : public wxPropertySheetDialog
|
||||||
bool expandInternalEntities,
|
bool expandInternalEntities,
|
||||||
bool showFullPathOnFrame,
|
bool showFullPathOnFrame,
|
||||||
int lang,
|
int lang,
|
||||||
const wxArrayString &translations,
|
const std::set<const wxLanguageInfo *> &translations,
|
||||||
wxWindowID id = wxID_ANY,
|
wxWindowID id = wxID_ANY,
|
||||||
wxString title = _T ( "" ),
|
wxString title = _T ( "" ),
|
||||||
const wxPoint& position = wxDefaultPosition,
|
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 );
|
int fdnull = open ( "/dev/null", O_WRONLY, 0 );
|
||||||
dup2 ( fdnull, STDERR_FILENO );
|
dup2 ( fdnull, STDERR_FILENO );
|
||||||
#endif
|
#endif
|
||||||
//myLocale.Init();
|
}
|
||||||
|
|
||||||
|
MyApp::~MyApp()
|
||||||
|
{
|
||||||
|
delete checker;
|
||||||
|
delete server;
|
||||||
|
delete connection;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MyApp::OnInit()
|
||||||
|
{
|
||||||
int systemLocale = myLocale.GetSystemLanguage();
|
int systemLocale = myLocale.GetSystemLanguage();
|
||||||
switch ( systemLocale )
|
switch ( systemLocale )
|
||||||
{
|
{
|
||||||
|
@ -302,43 +312,6 @@ MyApp::MyApp() : checker ( NULL ), server ( NULL ), connection ( NULL ),
|
||||||
#endif
|
#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;
|
wxString name, service, hostName;
|
||||||
name.Printf ( _T ( "xmlcopyeditor-%s" ), wxGetUserId().c_str() );
|
name.Printf ( _T ( "xmlcopyeditor-%s" ), wxGetUserId().c_str() );
|
||||||
service = IPC_SERVICE;
|
service = IPC_SERVICE;
|
||||||
|
@ -382,6 +355,38 @@ bool MyApp::OnInit()
|
||||||
server = new MyServer;
|
server = new MyServer;
|
||||||
server->Create ( service );
|
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;
|
MyFrame *frame;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -572,7 +577,7 @@ void MyApp::HandleEvent ( wxEvtHandler *handler, wxEventFunction func, wxEvent&
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const wxArrayString &MyApp::getAvailableTranslations (
|
const std::set<const wxLanguageInfo *> &MyApp::getAvailableTranslations (
|
||||||
const wxArrayString *catalogLookupPathPrefixes /*= NULL*/,
|
const wxArrayString *catalogLookupPathPrefixes /*= NULL*/,
|
||||||
const wxString *catalog /*= NULL*/ )
|
const wxString *catalog /*= NULL*/ )
|
||||||
{
|
{
|
||||||
|
@ -587,10 +592,20 @@ const wxArrayString &MyApp::getAvailableTranslations (
|
||||||
if ( catalog == NULL )
|
if ( catalog == NULL )
|
||||||
throw std::invalid_argument ( "catelog" );
|
throw std::invalid_argument ( "catelog" );
|
||||||
|
|
||||||
|
const wxLanguageInfo *info;
|
||||||
#if wxCHECK_VERSION(2,9,0)
|
#if wxCHECK_VERSION(2,9,0)
|
||||||
wxTranslations *t = wxTranslations::Get();
|
wxTranslations *t = wxTranslations::Get();
|
||||||
if ( t != NULL )
|
if ( t != NULL )
|
||||||
|
{
|
||||||
translations = t->GetAvailableTranslations ( *catalog );
|
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
|
#else
|
||||||
wxArrayString::const_iterator i = catalogLookupPathPrefixes->begin();
|
wxArrayString::const_iterator i = catalogLookupPathPrefixes->begin();
|
||||||
for ( i = catalogLookupPathPrefixes->begin();
|
for ( i = catalogLookupPathPrefixes->begin();
|
||||||
|
@ -613,7 +628,9 @@ const wxArrayString &MyApp::getAvailableTranslations (
|
||||||
if ( lang.EndsWith(".lproj", &rest) )
|
if ( lang.EndsWith(".lproj", &rest) )
|
||||||
lang = rest;
|
lang = rest;
|
||||||
#endif // __WXOSX__
|
#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()
|
return wxFileName ( dir, catelog, _T ( "mo" ) ).FileExists()
|
||||||
|| wxFileName ( dir + wxFILE_SEP_PATH + _T ( "LC_MESSAGES" ), 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:
|
protected:
|
||||||
wxArrayString translations;
|
std::set<const wxLanguageInfo *> translations;
|
||||||
} translations ( catalogLookupPathPrefixes, catalog );
|
} translations ( catalogLookupPathPrefixes, catalog );
|
||||||
|
|
||||||
return translations();
|
return translations();
|
||||||
|
@ -2573,7 +2590,6 @@ void MyFrame::OnOptions ( wxCommandEvent& WXUNUSED ( event ) )
|
||||||
#else
|
#else
|
||||||
( _ ( "Preferences" ) );
|
( _ ( "Preferences" ) );
|
||||||
#endif
|
#endif
|
||||||
MyApp *app = ( MyApp * ) wxTheApp;
|
|
||||||
std::auto_ptr<MyPropertySheet> mpsd ( new MyPropertySheet (
|
std::auto_ptr<MyPropertySheet> mpsd ( new MyPropertySheet (
|
||||||
this,
|
this,
|
||||||
properties,
|
properties,
|
||||||
|
@ -2587,7 +2603,7 @@ void MyFrame::OnOptions ( wxCommandEvent& WXUNUSED ( event ) )
|
||||||
expandInternalEntities,
|
expandInternalEntities,
|
||||||
showFullPathOnFrame,
|
showFullPathOnFrame,
|
||||||
lang,
|
lang,
|
||||||
app->getAvailableTranslations(),
|
wxGetApp().getAvailableTranslations(),
|
||||||
wxID_ANY,
|
wxID_ANY,
|
||||||
title ) );
|
title ) );
|
||||||
if ( mpsd->ShowModal() == wxID_OK )
|
if ( mpsd->ShowModal() == wxID_OK )
|
||||||
|
|
|
@ -176,7 +176,7 @@ class MyApp : public wxApp
|
||||||
#ifndef __WXMSW__
|
#ifndef __WXMSW__
|
||||||
virtual void HandleEvent ( wxEvtHandler *handler, wxEventFunction func, wxEvent& event ) const;
|
virtual void HandleEvent ( wxEvtHandler *handler, wxEventFunction func, wxEvent& event ) const;
|
||||||
#endif
|
#endif
|
||||||
const wxArrayString &getAvailableTranslations (
|
const std::set<const wxLanguageInfo *> &getAvailableTranslations (
|
||||||
const wxArrayString *catalogLookupPathPrefixes = NULL,
|
const wxArrayString *catalogLookupPathPrefixes = NULL,
|
||||||
const wxString *catelog = NULL );
|
const wxString *catelog = NULL );
|
||||||
protected:
|
protected:
|
||||||
|
|
Loading…
Reference in New Issue