1
//--------------------------------------------------------------------------------------
2
// LenMus Phonascus: The teacher of music
3
// Copyright (c) 2002-2007 Cecilio Salmeron
5
// This program is free software; you can redistribute it and/or modify it under the
6
// terms of the GNU General Public License as published by the Free Software Foundation;
7
// either version 3 of the License, or (at your option) any later version.
9
// This program is distributed in the hope that it will be useful, but WITHOUT ANY
10
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11
// PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
// You should have received a copy of the GNU General Public License along with this
14
// program. If not, see <http://www.gnu.org/licenses/>.
17
// For any comment, suggestion or feature request, please contact the manager of
18
// the project at cecilios@users.sourceforge.net
20
//-------------------------------------------------------------------------------------
23
#pragma implementation "command.h"
26
// for (compilers that support precompilation, includes "wx/wx.h".
27
#include "wx/wxprec.h"
38
#include "ebook_processor.h"
41
// All actions that is posible to do via command line
43
void CmdCompileBook(wxString sBook, wxString sOut, wxString sLangs, wxString sLocalePath)
46
// Compiles the specified eBook, for the specified list of languages
47
// Compiled eBooks are stored in specified folder
52
// <lang-list> or 'all'
55
// langtool -c -book ..\books\src\L1_MusicReading.xml -out ..\books es en nl
59
wxString::Format(_T("Compliling eBook '%s' for languages '%s'. Output will\n")
60
_T("be left in folder '%s'"), sBook.c_str(), sLangs.c_str(), sOut.c_str() ));
63
const wxString sBookName = sBook;
64
//LogMessage(_T("Preparing to process eMusicBook %s\n"), rOptions.sSrcPath );
67
//bool fLanguage[eLangLast];
70
//if (rOptions.fDump) nDbgOpt |= eDumpTree;
71
//if (rOptions.fLogTree) nDbgOpt |= eLogTree;
72
lmEbookProcessor oEBP(nDbgOpt, (wxTextCtrl*)NULL);
73
//Loop to use each selected language
74
//for(int i=0; i < eLangLast; i++)
75
for(int i=0; i < 1; i++)
80
wxLocale* pLocale = (wxLocale*)NULL;
81
//wxString sLang = g_tLanguages[i].sLang;
82
//wxString sCharCode = g_tLanguages[i].sCharCode;
83
wxString sLang = _T("es");
84
wxString sCharCode = _T("iso-8859-1");
87
pLocale = new wxLocale();
88
wxString sNil = _T("");
89
//wxString sLangName = g_tLanguages[i].sLangName;
90
wxString sLangName = _T("Spanish");
92
pLocale->Init(_T(""), sLang, _T(""), true, true);
93
pLocale->AddCatalogLookupPathPrefix( sLocalePath );
94
wxString sCatalogName = sBookName + _T("_") + pLocale->GetName();
95
pLocale->AddCatalog(sCatalogName);
97
//LogMessage(_T("Locale changed to %s language (using %s)."),
98
// pLocale->GetName(), sCatalogName + _T(".mo\n") );
100
//if (m_pOptMenu->IsChecked(MENU_UTF8)) sCharCode = _T("utf-8");
101
oEBP.GenerateLMB(sBook, sLang, sCharCode);
103
if (i != 0) delete pLocale;