From CodeBlocks
Revision as of 11:22, 23 December 2019 by Gd on (Talk | contribs)

Jump to: navigation, search

This article is about how to realize and use localized C:B. All the works have been done under Windows XP SP2.

Get the English POT file

The url of the english POT file is at:

for the original site (but obsolete) :


for a new site :

Old sites too :

More information can be seen at:,10204.msg70638.html. or :,1022.msg159075.html#msg159075

Of course, you can run intl.bat to generate the POT file. The tool wxrc.exe's url is

The content of intl.bat is below:

rem ======= Begin of intl.bat =======

@echo off
wxrc src\resources\*.xrc -g -o  src\src-xrc.cpp
wxrc sdk\resources\*.xrc -g -o  sdk\sdk-xrc.cpp
wxrc plugins\astyle\resources\*.xrc -g -o  plugins\astyle\astyle-xrc.cpp
wxrc plugins\autosave\*.xrc -g -o  plugins\autosave\autosave-xrc.cpp
wxrc plugins\classwizard\resources\*.xrc -g -o  plugins\classwizard\classwizard-xrc.cpp
wxrc plugins\codecompletion\resources\*.xrc -g -o  plugins\codecompletion\codecompletion-xrc.cpp
wxrc plugins\compilergcc\resources\*.xrc -g -o  plugins\compilergcc\compilergcc-xrc.cpp
wxrc plugins\debuggergdb\resources\*.xrc -g -o  plugins\debuggergdb\debuggergdb-xrc.cpp
wxrc plugins\defaultmimehandler\resources\*.xrc -g -o  plugins\defaultmimehandler\defaultmimehandler-xrc.cpp
wxrc plugins\projectsimporter\resources\*.xrc -g -o  plugins\projectsimporter\projectsimporter-xrc.cpp
wxrc plugins\projectsimporter\resources\*.xrc -g -o  plugins\projectsimporter\projectsimporter-xrc.cpp
wxrc plugins\scriptedwizard\resources\plugins\*.xrc -g -o  plugins\scriptedwizard\resources\plugins\scriptedwizard-xrc.cpp
wxrc plugins\scriptedwizard\resources\wxwidgets\*.xrc -g -o  plugins\scriptedwizard\resources\wxwidgets\wxwidgets-xrc.cpp
wxrc plugins\todo\resources\*.xrc -g -o  plugins\todo\todo-xrc.cpp
if not exist po md po
xgettext -C -n -k_ -o po\codeblocks.pot include\*.h
xgettext -C -n -k_ -j --from-code=UTF-8 -o po\codeblocks.pot src\*.cpp src\*.h
xgettext -C -n -k_ -j -o po\codeblocks.pot sdk\*.cpp
xgettext -C -n -k_ -j -o po\codeblocks.pot sdk\scripting\bindings\*.cpp include\scripting\bindings\*.h
xgettext -C -n -k_ -j -o po\codeblocks.pot plugins\astyle\*.cpp plugins\astyle\*.h
xgettext -C -n -k_ -j -o po\codeblocks.pot plugins\astyle\astyle\*.cpp plugins\astyle\astyle\*.h
xgettext -C -n -k_ -j -o po\codeblocks.pot plugins\autosave\*.cpp plugins\autosave\*.h
xgettext -C -n -k_ -j -o po\codeblocks.pot plugins\classwizard\*.cpp plugins\classwizard\*.h
xgettext -C -n -k_ -j -o po\codeblocks.pot plugins\codecompletion\*.cpp plugins\codecompletion\*.h
xgettext -C -n -k_ -j -o po\codeblocks.pot plugins\codecompletion\parser\*.cpp plugins\codecompletion\parser\*.h
xgettext -C -n -k_ -j -o po\codeblocks.pot plugins\compilergcc\*.cpp plugins\compilergcc\*.h
xgettext -C -n -k_ -j -o po\codeblocks.pot plugins\debuggergdb\*.cpp plugins\debuggergdb\*.h
xgettext -C -n -k_ -j -o po\codeblocks.pot plugins\defaultmimehandler\*.cpp plugins\defaultmimehandler\*.h
xgettext -C -n -k_ -j -o po\codeblocks.pot plugins\headerguard\*.cpp plugins\headerguard\*.h
xgettext -C -n -k_ -j -o po\codeblocks.pot plugins\loghacker\*.cpp plugins\loghacker\*.h
xgettext -C -n -k_ -j -o po\codeblocks.pot plugins\modpoller\*.cpp plugins\modpoller\*.h
xgettext -C -n -k_ -j -o po\codeblocks.pot plugins\openfileslist\*.cpp plugins\openfileslist\*.h
xgettext -C -n -k_ -j -o po\codeblocks.pot plugins\projectsimporter\*.cpp plugins\projectsimporter\*.h
xgettext -C -n -k_ -j -o po\codeblocks.pot plugins\scriptedwizard\*.cpp plugins\scriptedwizard\*.h plugins\scriptedwizard\resources\*.script 
xgettext -C -n -k_ -j -o po\codeblocks.pot plugins\scriptedwizard\resources\plugins\templates\*.cpp plugins\scriptedwizard\resources\plugins\templates\*.h
xgettext -C -n -k_ -j -o po\codeblocks.pot plugins\scriptedwizard\resources\wxwidgets\common\*.cpp plugins\scriptedwizard\resources\wxwidgets\common\*.h
xgettext -C -n -k_ -j -o po\codeblocks.pot plugins\tidycmt\*.cpp plugins\tidycmt\*.h
xgettext -C -n -k_ -j -o po\codeblocks.pot plugins\todo\*.cpp plugins\todo\*.h
xgettext -C -n -k_ -j -o po\codeblocks.pot plugins\xpmanifest\*.cpp plugins\xpmanifest\*.h
rem ======= End of intl.bat =======

The content of intl-plugin.bat is below:

rem ======= Begin of intl-plugin.bat =======

@echo off
wxrc plugins\contrib\devpak_plugin\*.xrc -g -o  plugins\contrib\devpak_plugin\plugin-xrc.cpp
wxrc plugins\contrib\envvars\*.xrc -g -o  plugins\contrib\envvars\plugin-xrc.cpp
wxrc plugins\contrib\help_plugin\*.xrc -g -o  plugins\contrib\help_plugin\plugin-xrc.cpp
wxrc plugins\contrib\IncrementalSearch\*.xrc -g -o  plugins\contrib\IncrementalSearch\plugin-xrc.cpp
wxrc plugins\contrib\regex_testbed\*.xrc -g -o  plugins\contrib\regex_testbed\plugin-xrc.cpp
wxrc plugins\contrib\codestat\resources\*.xrc -g -o  plugins\contrib\codestat\plugin-xrc.cpp
wxrc plugins\contrib\profiler\resources\*.xrc -g -o  plugins\contrib\profiler\plugin-xrc.cpp
wxrc plugins\contrib\symtab\resources\*.xrc -g -o  plugins\contrib\symtab\plugin-xrc.cpp
if not exist po md po
xgettext -C -n -k_ -o po\plugins.pot plugins\contrib\AutoVersioning\*.h plugins\contrib\AutoVersioning\*.cpp
xgettext -C -n -k_ -j --from-code=UTF-8 -o po\plugins.pot plugins\contrib\BrowseTracker\*.h plugins\contrib\BrowseTracker\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\byogames\*.h plugins\contrib\byogames\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\cb_koders\*.h plugins\contrib\cb_koders\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\codesnippets\*.h plugins\contrib\codesnippets\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\codestat\*.h plugins\contrib\codestat\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\copystrings\*.h plugins\contrib\copystrings\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\devpak_plugin\*.h plugins\contrib\devpak_plugin\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\dragscroll\*.h plugins\contrib\dragscroll\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\envvars\*.h plugins\contrib\envvars\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\headerfixup\*.h plugins\contrib\headerfixup\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\help_plugin\*.h plugins\contrib\help_plugin\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\HexEditor\*.h plugins\contrib\HexEditor\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\IncrementalSearch\*.h plugins\contrib\IncrementalSearch\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\keybinder\*.h plugins\contrib\keybinder\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\lib_finder\*.h plugins\contrib\lib_finder\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\profiler\*.h plugins\contrib\profiler\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\regex_testbed\*.h plugins\contrib\regex_testbed\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\rndgen\*.h plugins\contrib\rndgen\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\source_exporter\*.h plugins\contrib\source_exporter\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\symtab\*.h plugins\contrib\symtab\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\ThreadSearch\*.h plugins\contrib\ThreadSearch\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\Valgrind\*.h plugins\contrib\Valgrind\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\wxSmith\properties\*.h plugins\contrib\wxSmith\properties\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\wxSmith\propgrid\contrib\include\wx\propgrid\*.h
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\wxSmith\propgrid\contrib\src\propgrid\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\wxSmith\wxwidgets\*.h plugins\contrib\wxSmith\wxwidgets\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\wxSmith\wxwidgets\defitems\*.h plugins\contrib\wxSmith\wxwidgets\defitems\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\wxSmith\wxwidgets\properties\*.h plugins\contrib\wxSmith\wxwidgets\properties\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\wxSmithAui\*.cpp plugins\contrib\wxSmithAui\*.h
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\wxSmithAui\wxAuiManager\*.cpp plugins\contrib\wxSmithAui\wxAuiManager\*.h
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\wxSmithAui\wxAuiNotebook\*.cpp plugins\contrib\wxSmithAui\wxAuiNotebook\*.h
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\wxSmithAui\wxAuiToolBar\*.cpp plugins\contrib\wxSmithAui\wxAuiToolBar\*.h
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\wxSmithContribItems\*.h plugins\contrib\wxSmithContribItems\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\include\wx\*.h
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\wxSmithContribItems\wxflatnotebook\*.h plugins\contrib\wxSmithContribItems\wxflatnotebook\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\wxSmithContribItems\wxthings\*.h plugins\contrib\wxSmithContribItems\wxthings\*.cpp
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\wxSmithContribItems\wxthings\wxthings\include\wx\things\*.h
xgettext -C -n -k_ -j -o po\plugins.pot plugins\contrib\wxSmithContribItems\wxthings\wxthings\src\*.cpp
rem ======= End of intl-plugin.bat =======

The tools for translation

Usually, we use the poEdit tool which can be downloaded here. Of course, you can do the translation at

Translating with poEdit

Rename codeblocks.pot into codeblocks.po. Use poEdit to open the file codeblocks.po. Change a few settings like:


[Catalog]->[Settings]->[Project info]->[Team/email/Language/Charset]

If Code::Blocks is compiled with Unicode, the charset should be set to utf-8; If Code::Blocks is compiled with ANSI, the charset should be set to your own language charset like gb2312, koi8-r etc.

After these settings are done, you can start translating. Don't be fooled, it's a hard work! During the process, of course, you can use your translation at any time.

Create and use the .mo file

Pressing Ctrl+S in poEdit, you can get a *.mo file like which is what we need. To use, we just place it into C:\Program Files\CodeBlocks\share\CodeBlocks\locale\<lang>\LC_MESSAGES or C:\Program Files\CodeBlocks\share\CodeBlocks\locale\<lang>. My language is Chinese and I have installed C::B into E:\, so I place into E:\Program Files\CodeBlocks\share\CodeBlocks\locale\zh_CN.

If you want to use under Linux or Unix, you just place it into /usr/X11R6/share/locale/<lang>/LC_MESSAGES/. For example, I put it into /usr/X11R6/share/locale/zh_CN/LC_MESSAGES/ under FreeBSD.

Details about internationalization using wxWidgets can be found in the wxWidgets docs.

Let Code::Blocks support your language

If you want Code::Blocks to support your language, you must modify the file \codeblocks\src\src\appglobals.cpp. In it, you can search for the word 'Chinese' to see the example. There are two vars about it:

const wxString langs[LANGUAGES_SIZE]
const int locales[LANGUAGES_SIZE]


If you have any questions, you can mail to me: zxpmyth at