News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Code::Blocks' translation

Started by teto, October 06, 2005, 08:55:03 PM

Previous topic - Next topic

gd_on

You are certainly right. These setting must not be translated here.

In the code, I think its in src/plugins/contrib/wxSmith/wxwidgets/wxsnewwindowdlg.cpp at lines 210, 212 or 214, they are initialized with the macro _, which means they can be translated, which is normal if it's used only to identify a button or something else to be displayed in the graphic user interface. Obviously, it's also used to generate code, and of course, it must not be translated. The author of this plugin should probably use here the macro _T and not _.
In the next French version, I will correct this (in fact do a workaround), simply by duplicating the English words in the French translation.

Thanks for having pointed this problem.

gd_on
Windows 11 64 bits (25H2), svn C::B (last version or almost!), wxWidgets 3.3.2, Msys2 Compilers 16.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

MortenMacFly

Quote from: gd_on on January 27, 2009, 09:42:05 AM
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... ;-)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

Jenna

Quote from: MortenMacFly on January 27, 2009, 11:06:39 AM
As you see: The name is obtained via XRC. In fact I have no idea why it gets translated...?!

Because the .xrc have been scanned  with wxrc to find textes to translate and they got translated.

The same happened for other keywords:

Quote#: plugins_xrc.cpp:63
msgid "private"
msgstr "privé"

Quote#: plugins_xrc.cpp:62
msgid "protected"
msgstr "protégé"

Quote#: plugins_xrc.cpp:61
msgid "public"
msgstr "publique"

Quote from: gd_on on January 27, 2009, 09:42:05 AM
In the next French version, I will correct this (in fact do a workaround), simply by duplicating the English words in the French translation.

If I remember right, it should be enough to leave the translated part (msgstr) empty.

By the way, this one is much more dangerous, because it breaks layout saving and/or loading:
Quote#: ../src/main.cpp:1238
#: ../src/main.cpp:1257
msgid "state=%d"
msgstr "État = %d"

MortenMacFly

Quote from: jens on January 27, 2009, 11:43:24 AM
Because the .xrc have been scanned  with wxrc to find textes to translate and they got translated.
WTF... And I guess there is no way in a XRC file to exclude strings from translation, right?! Or can I use the _() and _T() macros there, too?!

In any ways: If I use e.g. xrced I don't see an option accordingly - so in practice it would mean hand crafted manipulation. :-(
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

stahta01

Quote from: MortenMacFly on January 27, 2009, 11:51:41 AM
Quote from: jens on January 27, 2009, 11:43:24 AM
Because the .xrc have been scanned  with wxrc to find textes to translate and they got translated.
WTF... And I guess there is no way in a XRC file to exclude strings from translation, right?! Or can I use the _() and _T() macros there, too?!

In any ways: If I use e.g. xrced I don't see an option accordingly - so in practice it would mean hand crafted manipulation. :-(

From http://biolpc22.york.ac.uk/wx/docs/html/faqcmn.htm#xrclocale
Quotetranslate="0" attribute in XRC files
Turns it off for whole xrc file which might work sometime. But, most likely not all the time.
Tim S
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

gd_on

Quote
QuoteIn the next French version, I will correct this (in fact do a workaround), simply by duplicating the English words in the French translation.

If I remember right, it should be enough to leave the translated part (msgstr) empty.

True, but I prefer to duplicate English words to be sure that these words have been intentionally put here (and intentionally not translated), and it's not something forgotten or a sentence I don't totally understand.

QuoteBy the way, this one is much more dangerous, because it breaks layout saving and/or loading:
Quote
#: ../src/main.cpp:1238
#: ../src/main.cpp:1257
msgid "state=%d"
msgstr "État = %d"
I don't understand the exact problem. In /src/main the author make a difference between "state=" and "state=%d", using the macro _T for the first case and the macro _ for the second one. So I suppose he wants the second one to be translatable !

Also, it's true that when using wxrc to scan for translatable characters chains in xrc files, I find many many strings. A lot of them have to be translated, but a few ones don't need to. More, it could be an error to do so, as shown by this reported problem. But, how can I do ? Not obvious  :( :(

gd_on
Windows 11 64 bits (25H2), svn C::B (last version or almost!), wxWidgets 3.3.2, Msys2 Compilers 16.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

gd_on

A few updates to the .pot file extracted from svn 5421 are here.
Translation in French, also updated from svn 5421 in the .po and .mo file is here.
Problems mentioned above about words "public, private, protected" are corrected (intentionally not translated).
No changes to the extracting tools. See previous posts here particularly or/and here.

gd_on
Windows 11 64 bits (25H2), svn C::B (last version or almost!), wxWidgets 3.3.2, Msys2 Compilers 16.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Xaviou

Hi

Quote from: gd_on on January 28, 2009, 07:16:42 PM
Problems mentioned above about words "public, private, protected" are corrected (intentionally not translated).
Works fine : thanks ;)

Nothing about the "Start here" page ?

Regards
Xav'
My wxWidgets's stuff : [url="https://wxstuff.xaviou.fr/"]https://wxstuff.xaviou.fr/[/url]

Xaviou

@gd_on : Hey ! I've tested your extracting tool (extract.cmd) : it works fine !  Goog job !

@cb devs : I found a few "_T" to "_" macros replacements to improve Code::Blocks translations.
Do I have to :

  • put the correponding informations here (as a files and lines list) ?
  • submit a patch (I'm not used with that, but I think I'll find how to ;) ) ?
  • fill a bug report ? (I don't think this is a bug, but why not) ?

Regards
Xav'
My wxWidgets's stuff : [url="https://wxstuff.xaviou.fr/"]https://wxstuff.xaviou.fr/[/url]

MortenMacFly

Quote from: Xaviou on February 03, 2009, 11:26:47 PM

  • submit a patch (I'm not used with that, but I think I'll find how to ;) ) ?
That would be fine.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

Xaviou

So, here is a first one : wasn't so hard to do as I thought :)

A lot of things in this patch concern the ThreadSearch Plugin. It seems that the interface code whas been auto-generated by wxGlade, it's why it contains a lot of "wxT" instead of "_". I'm afraid that next update of this plugin will replace the corrected macros by the _T one.

Regards

Xav'

[attachment deleted by admin]
My wxWidgets's stuff : [url="https://wxstuff.xaviou.fr/"]https://wxstuff.xaviou.fr/[/url]

dje

Quote from: Xaviou on February 05, 2009, 11:14:59 PM
A lot of things in this patch concern the ThreadSearch Plugin. It seems that the interface code whas been auto-generated by wxGlade, it's why it contains a lot of "wxT" instead of "_". I'm afraid that next update of this plugin will replace the corrected macros by the _T one.
I'll see  :)
I will apply a patch to spare place for small screen.
But my approach is to generate files in a temporary directory and then merge the graphical stuff so my code is not modified. That's why I think it should work, unless you propose a patch for this tool  :wink:

Dje

Xaviou

#132
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("&nbsp;&nbsp;&nbsp;&nbsp;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.next.codeblocks.org/">Visit the Code::Blocks
-forums</a></td>
+<td><a href="http://forums.next.codeblocks.org/">CB_TXT_VISIT_FORUMS</a></td>
</tr>
<tr>
<td><a href=
-"http://developer.berlios.de/bugs/?func=addbug&amp;group_id=5358">Report
-a bug</a></td>
+"http://developer.berlios.de/bugs/?func=addbug&amp;group_id=5358">CB_TXT_REPORT_BUG</a></td>
</tr>
<tr>
<td><a href=
"http://developer.berlios.de/feature/?func=addfeature&amp;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

Regards

Xav'

[attachment deleted by admin]
My wxWidgets's stuff : [url="https://wxstuff.xaviou.fr/"]https://wxstuff.xaviou.fr/[/url]

gd_on

#133
A few updates to the .pot file extracted from svn 5481 are here.
Translation in French, also updated from svn 5481 in the .po and .mo file is here.
Works if Xaviou's patches for translation are installed (adding 2 missed items : file name and file path).
No changes to the extracting tools. See previous posts here particularly or/and here.

gd_on
Windows 11 64 bits (25H2), svn C::B (last version or almost!), wxWidgets 3.3.2, Msys2 Compilers 16.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

GeO

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