Author Topic: A tool to translate wxWidgets projects  (Read 55015 times)

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: A tool to translate wxWidgets projects
« Reply #30 on: October 08, 2013, 01:51:42 pm »
Hello.

Just downloaded the 0.4.5 then overwritten the previous installed version under "C:\Program Files (x86)\wxTranslate".

The list command worked correctly, but I get a "GPLed program a cess de fonctionner" (in French) when I run the extract one.

Searching in Gloogloo, I've found that it could be related to poedit http://galide.jazar.co.uk/2011/06/gpled-program-for-windows-poedit.html when a file contains a syntax error... However, my project compiles fine (without any error nor warning). So, I don't know. Do you have an idea about the reason why ?
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

Offline LETARTARE

  • Regular
  • ***
  • Posts: 384
  • L'ami de l'homme.The friend of man.
Re: A tool to translate wxWidgets projects
« Reply #31 on: October 08, 2013, 02:54:06 pm »
@eranon
hello,
I never saw this message.
In the extraction I use 'xgettext.exe' from 'Poedit', so this can only come from the utility (GPLed).
Waiting to try another version of 'xgettext.exe', we must find the offending text.
Analyzing the *. lst you can locate  the string involved ? because normally there should be warnings.

I'll do some tests, writing erroneous texts!
Cordially.

PS : Is "Code::Blocks' crash?
Can you temporarily remove 'msmerge.exe' and 'wxrc.exe?', and we will be sure that it is 'xgettex.exe' the culprit.


« Last Edit: October 08, 2013, 04:09:11 pm by LETARTARE »
C::B  : svn11798, wx2.8, plugins : QtPregen-2.6.0-sdk143
1-Vista Business Pack 2 32bits : TDM-GCC-5.1.0.3
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by Deepl !!

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: A tool to translate wxWidgets projects
« Reply #32 on: October 08, 2013, 04:07:40 pm »
Thanks for your reply. Yes and no : CodeBlocks didn't crashed on first attempt, but it crashed on second one. In both attempts (one and two) I got the error message about GPLed... Well, I'll retry and see the lst for warning...
« Last Edit: October 08, 2013, 04:24:55 pm by eranon »
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

Offline LETARTARE

  • Regular
  • ***
  • Posts: 384
  • L'ami de l'homme.The friend of man.
Re: A tool to translate wxWidgets projects
« Reply #33 on: October 08, 2013, 04:19:35 pm »
well,
our messages are crossed !

In the first Win message, you can save the contents of the console script with 'Ctrl-C' and then save it in a file 'C::B'.
Thus, we should see the last message before the crash.
If you want, send me the MP file.

Thanks
C::B  : svn11798, wx2.8, plugins : QtPregen-2.6.0-sdk143
1-Vista Business Pack 2 32bits : TDM-GCC-5.1.0.3
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by Deepl !!

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: A tool to translate wxWidgets projects
« Reply #34 on: October 08, 2013, 04:28:20 pm »
Effectivelly, as you supposed, I have three warnings, all three showing this same message :

Quote
"warning: The following msgid contains non-ASCII characters. Invalid multibyte sequence."

The concerned strings contains these accented characters : . Nevertheless, these strings are not to be translated ; not surrounded by _().

Chance that the error then crash came from these warnings.
« Last Edit: October 08, 2013, 04:35:13 pm by eranon »
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

Offline LETARTARE

  • Regular
  • ***
  • Posts: 384
  • L'ami de l'homme.The friend of man.
Re: A tool to translate wxWidgets projects
« Reply #35 on: October 08, 2013, 05:15:59 pm »
I have done this test in "wxTranslate\trunk\main.cpp:L32"
Code: [Select]
wxString foo = _("My name is");
wxString foo2 = _(" My name ");
The construction is correct.
'List' indicates :
Quote
1- 'main.cpp' (2715 bytes)
       * Warning(s) :
          L34: warning: The following msgid contains non-ASCII characters.
          L34: invalid multibyte sequence
'Extract' works well !

And in '*.po' :
Quote
#: main.cpp:32
msgid "My name is"
msgstr ""

#: main.cpp:34
msgid " My name "
msgstr ""

Version 'xgettext.exe' is '0.18.1'

Is it repaired?

Cordially
C::B  : svn11798, wx2.8, plugins : QtPregen-2.6.0-sdk143
1-Vista Business Pack 2 32bits : TDM-GCC-5.1.0.3
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by Deepl !!

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: A tool to translate wxWidgets projects
« Reply #36 on: October 08, 2013, 06:21:30 pm »
Thanks for your tests on your side, LETARTARE. I'm using xgettext.exe 0.18.1 too.

To be sure about encoding, I've wrapped my literal strings in a wxString instance (e.g. "t" becomes wxString("t")) and it works this way (no warning) for the strings which are not to be translated.

But it doesn't solve the issue about strings which are to be translated ; wxString(_("Welcome to Th")) still raises a warning.

--
EDIT : OK, since I only add one string concerned by this last issue, I simply isolated the problematic word ; so, it becomes _("Welcome to") + wxString(" Th").

Also, an idea came in my mind. I read somewhere (don't remember the exact format/syntax) that gettext is able to extract comments for translators from source code too. Do you think wxTranslate could handle this advanced feature (if it doesn't already do ; not tested) ?

EDIT#2 : this feature seems to be described at point 5.1.5 of the manual at http://www.gnu.org/software/gettext/manual/gettext.html. Where it says (I quote) :

Quote
-c[tag]
--add-comments[=tag]
Place comment blocks starting with tag and preceding keyword lines in the output file. Without a tag, the option means to put all comment blocks preceding keyword lines in the output file.
« Last Edit: October 08, 2013, 07:02:34 pm by eranon »
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

Offline LETARTARE

  • Regular
  • ***
  • Posts: 384
  • L'ami de l'homme.The friend of man.
Re: A tool to translate wxWidgets projects
« Reply #37 on: October 08, 2013, 07:21:38 pm »
@eranon
1- A remark for the strings (not) to translate:
Code: [Select]
_("Welcome") and  _T(" Th") or  wxT(" Th")
2- For 'xgettext.exe' for encoding files scanned :
Quote
--from-code=NAME        encoding of input files   (except for Python, Tcl, Glade)
default : --from-code=ascii
'wxTranslate' uses
Code: [Select]
--from-code=utf-8
3- For comments:
Code: [Select]
-c, --add-comments          place all comment blocks preceding keyword lines  in output filebut I did not try; to do ...

4- Generally 'wxgettext.exe' extract all strings marked with the keyword :
Quote
-k, --keyword               do not to use default keywords
                              (only languages C, C++, ObjectiveC, Shell, Python, Lisp, EmacsLisp, librep, Scheme, Java
                              C#, awk, Tcl, Perl, PHP, GCC-source, Glade)
'wxTranslate' uses :
-k= '_' or '_T' or 'wxT'

For you, what's the point of removing the comments?

C::B  : svn11798, wx2.8, plugins : QtPregen-2.6.0-sdk143
1-Vista Business Pack 2 32bits : TDM-GCC-5.1.0.3
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by Deepl !!

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: A tool to translate wxWidgets projects
« Reply #38 on: October 08, 2013, 09:52:42 pm »
About 1 - Since I'm using wxWidgets 2.9x, I only use _() for the strings to translate

About 2 - Im' using wxWidgets UNICODE and build my project accordingly. My source files are ANSI encoded (Windows-1252), but my po catalogs are UTF-8 encoded of course (as wxTranslate does). It follow the guideline expressed at http://forums.wxwidgets.org/viewtopic.php?f=1&t=36377&hilit=gettext+comment&start=15

About 3 - It's effectivelly the options I indicated to you in my previous message. So, my question was : could you add support to this option (ie. with these switches) from within wxTranslate ?

About 4 - Yep, as said in 1, I always use _() ; the default option for wxTranslate.

Not sure to understand your question : "For you, what's the point of removing the comments?". In my previous message, I just asked you if you could support the gettext option which allow to extract the comments-for-translators (using c[tag] and --add-comments[=tag]). Of course, we would have to decide about a tag (I don't know if there is some habit/usual about this).
« Last Edit: October 08, 2013, 10:02:01 pm by eranon »
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

Offline LETARTARE

  • Regular
  • ***
  • Posts: 384
  • L'ami de l'homme.The friend of man.
Re: A tool to translate wxWidgets projects
« Reply #39 on: October 09, 2013, 12:24:05 pm »
@eranon
I'll try if I can extract the comments preceding keyword lines with :
Code: [Select]
-c//
Cordially
« Last Edit: October 09, 2013, 08:22:53 pm by LETARTARE »
C::B  : svn11798, wx2.8, plugins : QtPregen-2.6.0-sdk143
1-Vista Business Pack 2 32bits : TDM-GCC-5.1.0.3
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by Deepl !!

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: A tool to translate wxWidgets projects
« Reply #40 on: October 09, 2013, 06:55:53 pm »
Good news that you'll try ;o) Thanks...

But don't you think it would be better to choose another tag, because using "//" will imply that every comment on previous line will be considered as a comment-for-translator while it could be just a source comment without relationship with the translation subject/field.

So, I think (but I can be wrong) it would be more judicious to customize the tag to allow to clearly indicate when it's a comment to extract for translator or not.

For example, it could be something like (here I write down a very explicit tag, but all is possible, it could be shortened or totally different) "// Translate-Note :" (without quotes).

What do you think ?
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

Offline LETARTARE

  • Regular
  • ***
  • Posts: 384
  • L'ami de l'homme.The friend of man.
Re: A tool to translate wxWidgets projects
« Reply #41 on: October 09, 2013, 07:41:59 pm »
@eranon
yes,
my tests use
Code: [Select]
-cTranslators:Attached is a version of the script display the command line during extraction.
C::B  : svn11798, wx2.8, plugins : QtPregen-2.6.0-sdk143
1-Vista Business Pack 2 32bits : TDM-GCC-5.1.0.3
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by Deepl !!

Offline LETARTARE

  • Regular
  • ***
  • Posts: 384
  • L'ami de l'homme.The friend of man.
Re: A tool to translate wxWidgets projects
« Reply #42 on: December 22, 2013, 04:38:48 pm »
@eranon
Have you tried this last version?
Good end of the year.
C::B  : svn11798, wx2.8, plugins : QtPregen-2.6.0-sdk143
1-Vista Business Pack 2 32bits : TDM-GCC-5.1.0.3
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by Deepl !!

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: A tool to translate wxWidgets projects
« Reply #43 on: December 24, 2013, 03:24:28 pm »
Hello Tartare. Not yet (busy and more), sorry. But sure I'll tell you when I'll be at localization stage for real...
De bonnes ftes toi ("Happy Christmas" I say)
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: A tool to translate wxWidgets projects
« Reply #44 on: May 12, 2014, 04:36:30 pm »
I am at localization stage in my project, so feel free to tell me where you are in your plugin, Le Tartare...
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]