I have done something about codeblocks's internationalization, and it seems working for me. I have tested in WinXP SP1a, wxWindows 2.4.2, MingW GCC3.4.4 and CodeBlocks CVS in 11 Aug 2005. Details about the patches can be seen below:
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
Yes, I have modified some files like main.cpp, main.h, app.cpp, app.h, CodeBlocks_Core.iss and update.bat. And I have added somefile like intl.bat, copymo.bat, codeblocks.pot and zh_CN.po.
The english po file is codeblocks.pot which can be translated into any other language. I have translated it into Chinese, so you can see the file zh_CN.po.
I have place *.mo to codeblocks\share\locale\*.
In fact, there are so many works unfinished. For example, we should place a language choice to someplace like Settings\Environment. Hope somebody can do this work. Many source files should be modified in order that we can get more information which should be translated.
Then I want to translate it into Chinese. You can see I have done something, although it is not enough :lol:
========================
I have just update the patch file for codeblocks.pot containing strings in *.XRC .
It works well.
Needed tools are gettext and wxrc belong to wxWidgets
[attachment deleted by admin]