Author Topic: Code::Blocks' translation  (Read 664120 times)

Offline gd_on

  • Lives here!
  • ****
  • Posts: 800
Re: Code::Blocks' translation
« Reply #120 on: January 27, 2009, 09:42:05 am »
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 (23H2), svn C::B (last version or almost!), wxWidgets 3.2.5 (tests with 3.3), Msys2 Compilers 14.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9693
Re: Code::Blocks' translation
« Reply #121 on: January 27, 2009, 11:06:39 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:
Code
    m_AncestorScope    = XRCCTRL(*this, "cmbInheritanceScope", wxComboBox)->GetValue();
classwizarddlg.cpp, line 435-438:
Code
    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: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Code::Blocks' translation
« Reply #122 on: January 27, 2009, 11:43:24 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"

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"

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9693
Re: Code::Blocks' translation
« Reply #123 on: January 27, 2009, 11:51:41 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: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7678
    • My Best Post
Re: Code::Blocks' translation
« Reply #124 on: January 27, 2009, 02:04:55 pm »
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
Quote
translate="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++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline gd_on

  • Lives here!
  • ****
  • Posts: 800
Re: Code::Blocks' translation
« Reply #125 on: January 27, 2009, 08:02:44 pm »
Quote
Quote
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.

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.

Quote
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"
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 (23H2), svn C::B (last version or almost!), wxWidgets 3.2.5 (tests with 3.3), Msys2 Compilers 14.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Offline gd_on

  • Lives here!
  • ****
  • Posts: 800
Re: Code::Blocks' translation
« Reply #126 on: January 28, 2009, 07:16:42 pm »
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 (23H2), svn C::B (last version or almost!), wxWidgets 3.2.5 (tests with 3.3), Msys2 Compilers 14.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Offline Xaviou

  • Regular
  • ***
  • Posts: 412
    • X@v's wxStuff
Re: Code::Blocks' translation
« Reply #127 on: January 31, 2009, 10:51:16 am »
Hi

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 : https://wxstuff.xaviou.fr/

Offline Xaviou

  • Regular
  • ***
  • Posts: 412
    • X@v's wxStuff
Re: Code::Blocks' translation
« Reply #128 on: February 03, 2009, 11:26:47 pm »
@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 : https://wxstuff.xaviou.fr/

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9693
Re: Code::Blocks' translation
« Reply #129 on: February 04, 2009, 08:44:41 am »
  • 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: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Xaviou

  • Regular
  • ***
  • Posts: 412
    • X@v's wxStuff
Re: Code::Blocks' translation
« Reply #130 on: February 05, 2009, 11:14:59 pm »
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 : https://wxstuff.xaviou.fr/

Offline dje

  • Lives here!
  • ****
  • Posts: 682
Re: Code::Blocks' translation
« Reply #131 on: February 05, 2009, 11:51:23 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

Offline Xaviou

  • Regular
  • ***
  • Posts: 412
    • X@v's wxStuff
Re: Code::Blocks' translation
« Reply #132 on: March 05, 2009, 11:52:03 pm »
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...
Code
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.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&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]
« Last Edit: March 06, 2009, 12:03:49 am by Xaviou »
My wxWidgets's stuff : https://wxstuff.xaviou.fr/

Offline gd_on

  • Lives here!
  • ****
  • Posts: 800
Re: Code::Blocks' translation
« Reply #133 on: March 08, 2009, 06:54:50 pm »
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
« Last Edit: March 08, 2009, 06:57:12 pm by gd_on »
Windows 11 64 bits (23H2), svn C::B (last version or almost!), wxWidgets 3.2.5 (tests with 3.3), Msys2 Compilers 14.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Offline GeO

  • Multiple posting newcomer
  • *
  • Posts: 51
Re: Code::Blocks' translation
« Reply #134 on: June 17, 2009, 05:51:11 pm »
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
Code
m_AncestorScope    = XRCCTRL(*this, "cmbInheritanceScope", wxComboBox)->GetValue();
with this
Code
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