After CB uses default.conf as its configure file or is built with UNICODE mode, the internationalize of CB seems more difficult than before.
I don't want to say much more lest so many people be annoyed. :P
I'll try to solve them.
Please do say more. What exactly is making it more complicated?
I build CB with unicode mode, but my translation can't works any more like before. Maybe I don't find the right way. So I build CB with ansi mode. Now my translation works. However another problem produced. That's some phrases translated by me have been written into the file default.conf. When I first launch CB and close it, an exception will be raised. It's from sdk\configuremanager.cpp:487 and it says the node and the namespace are "an_dlg". That's because I have translated this phrase "Layout changed!" in src\main.cpp:917. Then I choice not to translated it and launch CB again (Notice, some Chinese characters have been existed in the file default.conf). A alert window shows these:
TinyXML error:
Error reading end tag.
Good news
After I change the defult.conf's code page to utf-8, the second problem seems disappeared and the first one still be there. Perhaps it is because CB is working with ansi mode, so the default.conf's code page is ansi. However there produces another problem that all the Chinese characters in default.conf can't be shown correctly.
Please accept that you cannot use xml tags that contain Chinese characters. It does not matter whether you convert the wxStrings or not, it is illegal.
If you write something like
key << _("/file_groups/group") << wxString::Format(_T("%d"), i) << _T("/") << _T("name");
i.e. you translate the path, then this does not only make it impossible for people who are unable to speak Chinese to find an error in such a file, but it is also illegal.
It might even appear to work out of pure coincidence, but at some random point, it will fail, and we will not know why!
Please don't do such things, you're opening Pandora's box. Configuration keys should not be translated, and they should not contain special characters.
Storing non-ANSI characters as data is a completely different thing, this works fine since end of December, and you can certainly do it.
Please accept that you cannot use xml tags that contain Chinese characters. It does not matter whether you convert the wxStrings or not, it is illegal.
Yes, it's. So if the code is like this
key << _("/file_groups/group") << wxString::Format(_T("%d"), i) << _T("/") << _T("name");
, it is wrong. It should be like that:
key << _T("/file_groups/group") << wxString::Format(_T("%d"), i) << _T("/") << _T("name");
My patchs have resolved some problems like this in CB's source codes.
Storing non-ANSI characters as data is a completely different thing, this works fine since end of December, and you can certainly do it.
I'am sure there is no problem with English characters with non-ANSI and ANSI mode. I have tested it that CB can't compeletly handles the non-English characters like Chinese characters as datas in default.conf with non-ANSI mode. This patch also can resolve it.
I havn't tested it widely with non-English with ANSI mode. So I have no idea of it.
I started with internationalization under my own project and, after no little pain, I get it to work and then: "Well, now that I know how to make wxWidgets internationalization work, let's have a look on Code::Blocks's source code about internationalization".
I downloaded the source through svn and opened it with C::B. I found the function "Initlocale()" where it seems that you start the locales. I see that you add a "path" to search catalog that I don't knew what was it so I added a simple "wxMessageBox(path, wxT("path"));" to see what was it. That wxMessageBox said (after "make install"):
/usr/share/codeblocks/locale
So putting the ".mo" file to the default folder "/usr/share/locale/<language>" do nothing for C::B. Then I put "_codeblocks-es.mo" to "/usr/share/codeblocks/locale" and it works!
I realised that the name of the ".mo" is not important, it works fine at least if you have only 1 ".mo" in that folder. I think that happens because I do not choose a particular language in "Settings->Environment...", but "Available languages". I also test that putting the ".mo" to a subfolder "es/LC_MESSAGES" or "es_ES/LC_MESSAGES" make it not to work.
The subfolder "locale" under "/usr/share/codeblocks" has to be created manually, it has not been created by the installation.
I think that the wiki have to be changed to reflect this for new users.
Hi all.
I've tested this french translation, and it works fine : thanks !
There are some improvements to make to the C::B source to make it perfect (I don't know if it is the right place to report this) :
First, the "New class wizard" doesn't works properly : when adding a new class witch inherits from another, the "scope" keyword (public, protected or private) is translated (but of course it shouldn't). This appends only for the scope keyword, not inside the class declaration.
For example, creating a class B inherited from a class A should be :
class B : public A
{
public:
B();
virtual ~B();
protected:
private:
};
But with the french translation, the code generated is :
class B : publique A
{
public:
B();
virtual ~B();
protected:
private:
};
Then, I think that the "Start here" page should also be translated. And for now, the only way to do this is editing the corresponding html file, and replacing the following texts :
- Create a new project
- Open an existing project
- Visit the Code::Blocks forums
- Report a bug
- Request a new feature
And even when doing this, it is not fully translated : the "Recent projects" and "Recent files" titles stay in english.
Neverless, great work, gd_on, for the french translation ;)
Regards
Xav'
I think its in src/plugins/contrib/wxSmith/wxwidgets/wxsnewwindowdlg.cpp at lines 210, 212 or 214
This is not it. This code is in no way releated to the class wizard. Nevertheless - the line of code you are referring to is here:
classwizarddlg.cpp, line 321:
m_AncestorScope = XRCCTRL(*this, "cmbInheritanceScope", wxComboBox)->GetValue();
classwizarddlg.cpp, line 435-438:
if (m_Inherits)
{
buffer << _T(" : ") << m_AncestorScope << _T(" ") << m_Ancestor;
}
As you see: The name is obtained via XRC. In fact I have no idea why it gets translated...?!
BTW: I realised that the class wizard features certain dialogs (message boxes) without translation - but that's another story... ;-)
Hi.
Here is a patch for the translation of the "Start here" page.
Not sure it is the best way to do this, but it works...
Index: src/src/main.cpp
===================================================================
--- src/src/main.cpp (révision 5480)
+++ src/src/main.cpp (copie de travail)
@@ -1861,7 +1861,7 @@
wxString buf = event.GetString();
wxString links;
- links << _T("<b>Recent projects</b><br>\n");
+ links << _("<b>Recent projects</b><br>\n");
if (m_pProjectsHistory->GetCount())
{
links << _T("<ul>");
@@ -1877,7 +1877,7 @@
else
links << _T(" No recent projects<br>\n");
- links << _T("<br><b>Recent files</b><br>\n");
+ links << _("<br><b>Recent files</b><br>\n");
if (m_pFilesHistory->GetCount())
{
links << _T("<ul>");
@@ -1896,6 +1896,11 @@
// update page
buf.Replace(_T("CB_VAR_RECENT_FILES_AND_PROJECTS"), links);
+ buf.Replace(_T("CB_TXT_NEW_PROJECT"), _("Create a new project"));
+ buf.Replace(_T("CB_TXT_OPEN_PROJECT"), _("Open an existing project"));
+ buf.Replace(_T("CB_TXT_VISIT_FORUMS"), _("Visit the Code::Blocks forums"));
+ buf.Replace(_T("CB_TXT_REPORT_BUG"), _("Report a bug"));
+ buf.Replace(_T("CB_TXT_REQ_NEW_FEATURE"), _("Request a new feature"));
((StartHerePage*)sh)->SetPageContent(buf);
}
Index: src/src/resources/start_here/start_here.html
===================================================================
--- src/src/resources/start_here/start_here.html (révision 5480)
+++ src/src/resources/start_here/start_here.html (copie de travail)
@@ -27,29 +27,27 @@
<tr>
<td><a href="CB_CMD_NEW_PROJECT"><img style=
"width: 47px; height: 42px;" alt="" src="new.png"></a></td>
-<td><a href="CB_CMD_NEW_PROJECT">Create a new project</a></td>
+<td><a href="CB_CMD_NEW_PROJECT">CB_TXT_NEW_PROJECT</a></td>
</tr>
<tr>
<td><a href="CB_CMD_OPEN_PROJECT"><img style=
"width: 47px; height: 47px;" alt="" src="open.png"></a></td>
-<td><a href="CB_CMD_OPEN_PROJECT">Open an existing project</a></td>
+<td><a href="CB_CMD_OPEN_PROJECT">CB_TXT_OPEN_PROJECT</a></td>
</tr>
<tr>
<td width="56" rowspan="4"><img alt="" src="www.png"></td>
</tr>
<tr>
-<td><a href="http://forums.codeblocks.org/">Visit the Code::Blocks
-forums</a></td>
+<td><a href="http://forums.codeblocks.org/">CB_TXT_VISIT_FORUMS</a></td>
</tr>
<tr>
<td><a href=
-"http://developer.berlios.de/bugs/?func=addbug&group_id=5358">Report
-a bug</a></td>
+"http://developer.berlios.de/bugs/?func=addbug&group_id=5358">CB_TXT_REPORT_BUG</a></td>
</tr>
<tr>
<td><a href=
"http://developer.berlios.de/feature/?func=addfeature&group_id=5358">
-Request a new feature</a></td>
+CB_TXT_REQ_NEW_FEATURE</a></td>
</tr>
</table>
</td>
And here is a link to an archive containing the modified revision 5480 including the french language file (if someone is interested for testing) :
CB_20090304_rev5480_win32_fr.7z (http://www.archive-host.com/compteur.php?url=http://codeblocks.archive-host.com/CB_20090304_rev5480_win32_fr.7z)
Regards
Xav'
[attachment deleted by admin]
Since the Class Wizard translation is still not fixed i wrote a little workaround that should work
with every language:
In src\plugins\classwizard\classwizarddlg.cpp on line 322 replace
m_AncestorScope = XRCCTRL(*this, "cmbInheritanceScope", wxComboBox)->GetValue();
with this
int scope = XRCCTRL(*this, "cmbInheritanceScope", wxComboBox)->GetCurrentSelection();
switch (scope)
{
case 0:
m_AncestorScope = _T("public");
break;
case 1:
m_AncestorScope = _T("protected");
break;
case 2:
m_AncestorScope = _T("private");
break;
default:
break;
}
Greets GeO
Seems that there are missing some lines in the .POT/.PO file.
msgid "&Show tips at startup"
msgstr ""
msgid "Did you know..."
msgstr ""
msgid "&Next Tip"
msgstr ""
It translates some stuff in the "Tip of de day" dialog.
Maybe something is missing in the extraction tool.
@gd_on
hello,
I am currently working on GNU AVR GCC and after building C::B r8818 and added your translation file, I can not find the compiler in the list.
A search tells me the last file "codeblocks.po" :
#: ../plugins/compilergcc/compilerGNUAVR.cpp:19
msgid "GNU AVR GCC Compiler"
msgstr "Compilateur GNU ARM GCC"
I do not have time to check the rest ...
Sincerely
PS : sorry it's All_codeblocks_fr_8644_12.11.7z
now old
Hello,
I just loaded the file 'All_codeblocks_All_codeblocks-fr.po' to test it on 'CB-12467-wx315'.
Under Win7 with "Poedit-3.0.1', I got ''All_codeblocks_All_codeblocks-fr.mo' that I renamed 'codeblocks-fr.po', then dropped in "$(APP_PATH)\share\CodeBlocks\locale\fr_FR"
At the start of "cb-12647"
- without this file: no problem
- with this file and choice 'French' in Settings : an argument window appears twice (see attachment)
This message is provided in "wx-3.1.5\src\common\menucmn.cpp" during the second "wxCHECK_MSG"
wxMenuItem* wxMenuBase::Insert(size_t pos, wxMenuItem *item)
{
wxCHECK_MSG( item, NULL, wxT("invalid item in wxMenu::Insert") );
if ( pos == GetMenuItemCount() )
{
return DoAppend(item);
}
else
{
wxCHECK_MSG( pos < GetMenuItemCount(), NULL,
wxT("invalid index in wxMenu::Insert") );
return DoInsert(pos, item);
}
I looked for the deadlines of code, and the tracks are numerous, I found in
ProjectManagerUI::CreateMenu(wxMenuBar* menuBar)
a possibility with 'GetMenuiItemCount ()' and 'Insert(...)' corresponding to the image provided:
menu->Insert(menu->GetMenuItemCount() - 1, idMenuFileProperties, _("Properties..."));
I then deleted the translation of "Properties ..." into the * .mo file, but the result is unchanged, so it must be elsewhere ...
If you have tracks ?
OK. So it's an other problem.
I tried different things as :
- using directly the .mo file downloaded from launchpad;
- download the .po from launchpad, compiling it with poedit, and using the .mo produced (with and without renaming it)
- using my own .mo file ...
everything work as expected.
I also tried to rename a .mo file in .po, just to see what happens. C::B logically appears in English : no assert message.
So, I can't reproduce your behaviour.
One idea : Are you sure you use a wxWidgets version compiled with the same compiler version as your Code::Blocks build ?
There is also an other thing which look strange for me :
at line 405 in menucmn.cpp (located in C:\wxWidgets-3.1.5\src\common for me), I have :
wxMenuItemList::compatibility_iterator node = m_items.Item(pos);
which does not correspond exactly to your indicated code lines. For me it's inside wxMenuBase::DoInsert (not in wxMenuBase::Insert)
Assert lines are 403 or 406. So, may be we have not exactly the same wxWidgets 3.1.5 version !)
Note : it's in wxWidgets 3.1.6 (trunk version, beta) that I have a wxcheck at line 405, inside wxMenuBase::Insert ! But, I still don't use it in C::B.
Main plugin's manifest.xml contents appear in the POT, but not those from the contrib folder.
For example, the debuggergdb plugin's contents are in the POT, but those in regex_testbed from contrib are not.
With [r13017] you can see the difference, for example, in the Help -> Plugins menu.
In you bash file, the line
find ../plugins | grep -F manifest | grep -F .xml | grep -v svn-base | grep -v .svn | xargs sed -n -e '/description/,/>/p' | sed '/author/d' | sed ':a;N;$!ba;s/\n/\\n/g' | sed 's/""//g' | sed 's/>\\n/>'"\\${nl}"'/g' | sed 's/"/\\"/g' | sed 's/&/\&/g' > src_xml3.cpp 2>> log.txt
should be modified to do a recursive search (or add another line for plugins/contrib).
EDIT: why don't you use
find ../plugins -name manifest.xml
instead of
find ../plugins | grep -F manifest | grep -F .xml
I am looking to translate tags extracted by 'wxrc' in the 'codestat::main_dialog.xrc' plugin:
There are four named fields :
'txt_Gauge_Code' => <label>XXXX% Code only</label>
'txt_Gauge_Code_Comments' => <label>XXXX% Code + comm.</label>
'txt_Gauge_Comments' => <label>XXXX% Comments</label>
'txt_Gauge_Empty' => <label>XXXX% Empty</label>
These fields are extracted in the form :
#line 92 "res/main_dialog.xrc"
_("XXXX% Code only");
#line 105 "res/main_dialog.xrc"
_("XXXX% Code + comm.");
#line 119 "res/main_dialog.xrc"
_("XXXX% Comments");
#line 132 "res/main_dialog.xrc"
_("XXXX% Empty");
The marked strings are extracted by 'xgettext' into a '*.po' file provided to 'poedit'.
If I translate the latter by ""XXXX% Vide" (in French), 'poedit' tells me that 'V' (Vide) is not valid while 'E' Empty) is !
The mark '%' must be written for example '%s'.
What does it mean "XXXX% " ?
It is a placeholder reserving space for the real string:
wxStaticText* txt_Gauge_Empty = XRCCTRL(*this, "txt_Gauge_Empty", wxStaticText);
txt_Gauge_Empty->SetLabel(wxString::Format(_("%3d%% Empty"), percentEmpty));