Index: src/CodeBlocks.cbp
===================================================================
RCS file: /cvsroot/codeblocks/codeblocks/src/CodeBlocks.cbp,v
retrieving revision 1.67.2.4
diff -u -r1.67.2.4 CodeBlocks.cbp
--- src/CodeBlocks.cbp 1 Aug 2005 09:45:40 -0000 1.67.2.4
+++ src/CodeBlocks.cbp 11 Aug 2005 05:13:24 -0000
@@ -334,7 +334,10 @@
<Option includeInTargetAll="0"/>
<Option projectResourceIncludeDirsRelation="4"/>
<ExtraCommands>
- <Add before="update.bat"/>
+ <Add before="intl.bat"/>
+ </ExtraCommands>
+ <ExtraCommands>
+ <Add after="update.bat"/>
</ExtraCommands>
</Target>
<Target title="console_runner">
Index: src/update.bat
===================================================================
RCS file: /cvsroot/codeblocks/codeblocks/src/update.bat,v
retrieving revision 1.13.2.1
diff -u -r1.13.2.1 update.bat
--- src/update.bat 1 Aug 2005 04:41:07 -0000 1.13.2.1
+++ src/update.bat 11 Aug 2005 05:05:44 -0000
@@ -3,6 +3,7 @@
if not exist output md output
if not exist output\share md output\share
+if not exist output\share\locale md output\share\locale
if not exist output\share\CodeBlocks md output\share\CodeBlocks
if not exist output\share\CodeBlocks\lexers md output\share\CodeBlocks\lexers
if not exist output\share\CodeBlocks\images md output\share\CodeBlocks\images
@@ -13,6 +14,10 @@
set ZIPCMD=zip
set RESDIR=devel\share\CodeBlocks
+set LOCALEDIR=output\share\locale
+
+call copymo
+
echo Packing core UI resources
%ZIPCMD% -j9 %RESDIR%\resources.zip src\resources\*.xrc > nul
%ZIPCMD% -j9 %RESDIR%\manager_resources.zip sdk\resources\*.xrc > nul
Index: src/setup/CodeBlocks_Core.iss
===================================================================
RCS file: /cvsroot/codeblocks/codeblocks/src/setup/CodeBlocks_Core.iss,v
retrieving revision 1.16.2.4
diff -u -r1.16.2.4 CodeBlocks_Core.iss
--- src/setup/CodeBlocks_Core.iss 2 Aug 2005 19:12:12 -0000 1.16.2.4
+++ src/setup/CodeBlocks_Core.iss 11 Aug 2005 05:08:18 -0000
@@ -66,7 +66,6 @@
Source: ..\output\share\CodeBlocks\manager_resources.zip; DestDir: {app}\share\CodeBlocks; Components: ProgramFiles
Source: ..\output\share\CodeBlocks\plugin_wizard.zip; DestDir: {app}\share\CodeBlocks; Components: Plugins/PluginWizard
Source: ..\output\share\CodeBlocks\todo.zip; DestDir: {app}\share\CodeBlocks; Components: Plugins/ToDo
-Source: ..\output\share\CodeBlocks\devpakupdater.zip; DestDir: {app}\share\CodeBlocks; Components: Plugins/DevPak
Source: ..\output\share\CodeBlocks\plugins\astyle.dll; DestDir: {app}\share\CodeBlocks\plugins; Components: Plugins/AStyleFormatter
Source: ..\output\share\CodeBlocks\plugins\classwizard.dll; DestDir: {app}\share\CodeBlocks\plugins; Components: Plugins/ClassWizard
Source: ..\output\share\CodeBlocks\plugins\codecompletion.dll; DestDir: {app}\share\CodeBlocks\plugins; Components: Plugins/CodeCompletion
@@ -76,7 +75,6 @@
Source: ..\output\share\CodeBlocks\plugins\pluginwizard.dll; DestDir: {app}\share\CodeBlocks\plugins; Components: Plugins/PluginWizard
Source: ..\output\share\CodeBlocks\plugins\xpmanifest.dll; DestDir: {app}\share\CodeBlocks\plugins; Components: Plugins/XPManifest
Source: ..\output\share\CodeBlocks\plugins\todo.dll; DestDir: {app}\share\CodeBlocks\plugins; Components: Plugins/ToDo
-Source: ..\output\share\CodeBlocks\plugins\devpakupdater.dll; DestDir: {app}\share\CodeBlocks\plugins; Components: Plugins/DevPak
Source: ..\output\share\CodeBlocks\images\ascii.png; DestDir: {app}\share\CodeBlocks\images; Components: ProgramFiles
Source: ..\output\share\CodeBlocks\images\codeblocks.png; DestDir: {app}\share\CodeBlocks\images; Components: ProgramFiles
Source: ..\output\share\CodeBlocks\images\compile.png; DestDir: {app}\share\CodeBlocks\images; Components: ProgramFiles
@@ -190,6 +188,8 @@
Source: ..\sdk\resources\lexers\lexer_rc.xml; DestDir: {app}\share\CodeBlocks\lexers; Components: ProgramFiles
Source: ..\sdk\resources\lexers\lexer_xml.sample; DestDir: {app}\share\CodeBlocks\lexers; Components: ProgramFiles
Source: ..\sdk\resources\lexers\lexer_xml.xml; DestDir: {app}\share\CodeBlocks\lexers; Components: ProgramFiles
+Source: ..\devel\share\locale\zh_CN\codeblocks.mo; DestDir: {app}\share\locale\zh_CN; Components: " Language"
+Source: ..\devel\share\locale\locale.alias; DestDir: {app}\share\locale\; Components: " Language"
[Icons]
Name: {group}\CodeBlocks; Filename: {app}\codeblocks.exe; IconIndex: 0; WorkingDir: {app}; Comment: Code::Blocks IDE; Components: ProgramFiles
@@ -225,6 +225,7 @@
Name: Plugins/AStyleFormatter; Description: Astyle code formatter plugin; Types: custom full
Name: Plugins/DefMimeHandler; Description: Default MIME handler; Types: custom compact full
Name: Plugins/DevPak; Description: DevPaks support plugin; Types: custom
+Name: Language; Description: Language Packages; Types: custom full
[UninstallRun]
-Filename: {app}\codeblocks.exe; Parameters: --clear-configuration; WorkingDir: {app}
+Filename: {app}\codeblocks.exe; Parameters: --clear-configuration; WorkingDir: {app}
\ No newline at end of file
Index: src/src/app.cpp
===================================================================
RCS file: /cvsroot/codeblocks/codeblocks/src/src/app.cpp,v
retrieving revision 1.37.2.5
diff -u -r1.37.2.5 app.cpp
--- src/src/app.cpp 7 Aug 2005 15:56:34 -0000 1.37.2.5
+++ src/src/app.cpp 11 Aug 2005 01:07:56 -0000
@@ -173,7 +173,7 @@
void CodeBlocksApp::InitFrame()
{
- MainFrame *frame = new MainFrame((wxFrame*)0L);
+ MainFrame *frame = new MainFrame(m_locale, (wxFrame*)0L);
#ifdef __WXMSW__
if(g_DDEServer)
g_DDEServer->SetFrame(frame);
@@ -221,6 +221,34 @@
if(!LoadConfig())
return false;
+
+ const wxString langs[] =
+ {
+ _T("(System default)"),
+ _T("Chinese"),
+ _T("English"),
+ _T("English (U.S.)")
+// _T("German"),
+// _T("Russian"),
+ };
+ int lng =-1;
+ lng = wxGetSingleChoiceIndex(_T("Please choose language:"), _T("Language"),
+ WXSIZEOF(langs), langs);
+ switch (lng)
+ {
+ case 0 : m_locale.Init(wxLANGUAGE_DEFAULT); break;
+ case 1 : m_locale.Init(wxLANGUAGE_CHINESE_SIMPLIFIED); break;
+ case 2: m_locale.Init(wxLANGUAGE_ENGLISH); break;
+ case -1:
+ case 3 : m_locale.Init(wxLANGUAGE_ENGLISH_US); break;
+// case 4 : m_locale.Init(wxLANGUAGE_GERMAN); break;
+// case 5 : m_locale.Init(wxLANGUAGE_RUSSIAN); break;
+ }
+ wxLocale::AddCatalogLookupPathPrefix(wxT("./share/locale"));
+ wxLocale::AddCatalogLookupPathPrefix(wxT("."));
+ wxLocale::AddCatalogLookupPathPrefix(wxT(".."));
+ m_locale.AddCatalog(wxT("codeblocks"));
+
m_pSingleInstance = 0;
if (ConfigManager::Get()->Read(_T("/environment/single_instance"), 1))
Index: src/src/app.h
===================================================================
RCS file: /cvsroot/codeblocks/codeblocks/src/src/app.h,v
retrieving revision 1.9
diff -u -r1.9 app.h
--- src/src/app.h 17 Jun 2005 08:07:48 -0000 1.9
+++ src/src/app.h 11 Aug 2005 00:44:48 -0000
@@ -11,7 +11,8 @@
@remarks VC++ 6 requires the following headers to compile correctly, so I added a check for it
*/
#if !defined(WX_PRECOMP) || defined(_MSC_VER)
- #include <wx/wx.h>
+ #include <wx/wx.h>
+ #include <wx/intl.h>
#include <wx/laywin.h>
#include <wx/image.h>
#include <wx/filename.h>
@@ -58,7 +59,8 @@
void ClearConf();
bool InitXRCStuff();
void InitFrame();
- void CheckVersion();
+ void CheckVersion();
+ wxLocale m_locale; // locale we'll be using
private:
void ShowSplashScreen();
void HideSplashScreen();
Index: src/src/main.cpp
===================================================================
RCS file: /cvsroot/codeblocks/codeblocks/src/src/main.cpp,v
retrieving revision 1.78.2.8
diff -u -r1.78.2.8 main.cpp
--- src/src/main.cpp 8 Aug 2005 21:56:26 -0000 1.78.2.8
+++ src/src/main.cpp 11 Aug 2005 02:26:36 -0000
@@ -323,9 +323,10 @@
END_EVENT_TABLE()
-MainFrame::MainFrame(wxWindow* parent)
+MainFrame::MainFrame(wxLocale& lang, wxWindow* parent)
: wxFrame(parent, -1, _T("MainWin"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE),
- m_pAccel(0L),
+ m_pAccel(0L),
+ m_locale(lang),
m_pCloseFullScreenBtn(0L),
m_pNotebook(0L),
m_pLeftSash(0L),
@@ -1032,15 +1033,15 @@
{
wxCommandEvent evt;
wxString link = event.GetString();
- if (link.Matches(_("CB_CMD_NEW_PROJECT")))
+ if (link.Matches(_T("CB_CMD_NEW_PROJECT")))
TemplateManager::Get()->NewProject();
- else if (link.Matches(_("CB_CMD_OPEN_PROJECT")))
+ else if (link.Matches(_T("CB_CMD_OPEN_PROJECT")))
OnFileOpen(evt);
- else if (link.Matches(_("CB_CMD_CONF_ENVIRONMENT")))
+ else if (link.Matches(_T("CB_CMD_CONF_ENVIRONMENT")))
OnSettingsEnvironment(evt);
- else if (link.Matches(_("CB_CMD_CONF_EDITOR")))
+ else if (link.Matches(_T("CB_CMD_CONF_EDITOR")))
Manager::Get()->GetEditorManager()->Configure();
- else if (link.Matches(_("CB_CMD_CONF_COMPILER")))
+ else if (link.Matches(_T("CB_CMD_CONF_COMPILER")))
{
PluginsArray arr = Manager::Get()->GetPluginManager()->GetCompilerOffers();
if (arr.GetCount() != 0)
Index: src/src/main.h
===================================================================
RCS file: /cvsroot/codeblocks/codeblocks/src/src/main.h,v
retrieving revision 1.27
diff -u -r1.27 main.h
--- src/src/main.h 1 Jul 2005 20:11:59 -0000 1.27
+++ src/src/main.h 11 Aug 2005 00:52:02 -0000
@@ -17,8 +17,10 @@
{
public:
wxAcceleratorTable* m_pAccel;
- MainFrame(wxWindow* parent = (wxWindow*)NULL);
+ MainFrame(wxLocale& m_locale, wxWindow* parent = (wxWindow*)NULL);
~MainFrame();
+
+ wxLocale& m_locale;
bool Open(const wxString& filename, bool addToHistory = true);
bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames);
--- src/copymo.bat
+++ src/copymo.bat
@@ -0,0 +1,13 @@
+echo Copying language files...
+
+if not exist %LOCALEDIR%\zh_CN md %LOCALEDIR%\zh_CN
+copy /y po\zh_CN.mo %LOCALEDIR%\zh_CN\codeblocks.mo >nul
+
+rem if not exist %LOCALEDIR%\zh_TW md %LOCALEDIR%\zh_TW
+rem copy /y po\zh_TW.mo %LOCALEDIR%\zh_TW\codeblocks.mo
+
+rem if not exist %LOCALEDIR%\fr md %LOCALEDIR%\fr
+rem copy /y po\fr.mo %LOCALEDIR%\fr\codeblocks.mo
+
+rem if not exist %LOCALEDIR%\ru md %LOCALEDIR%\ru
+rem copy /y po\ru.mo %LOCALEDIR%\ru\codeblocks.mo
--- src/intl.bat
+++ src/intl.bat
@@ -0,0 +1,26 @@
+@echo off
+wxrc src\resources\*.xrc -g -o src\src-xrc.cpp
+wxrc sdk\resources\*.xrc -g -o sdk\src-sdk.cpp
+xgettext -C -n -k_ -o po\codeblocks.pot src\*.cpp
+xgettext -C -n -k_ -j -o po\codeblocks.pot sdk\*.cpp
+cd po
+if exist temp.po delete temp.po
+
+rename zh_CN.po temp.po
+msgmerge -o zh_CN.po temp.po codeblocks.pot
+del temp.po
+msgfmt -o zh_CN.mo zh_CN.po
+
+rem rename en.po temp.po
+rem msgmerge -o en.po temp.po codeblocks.pot
+rem del temp.po
+rem msgfmt -o en.mo en.po
+
+cd ..
+
+if not exist devel md devel
+if not exist devel\locale md devel\locale
+
+set LOCALEDIR=devel\share\locale
+
+call copymo