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

Offline LETARTARE

  • Regular
  • ***
  • Posts: 363
  • L'ami de l'homme.The friend of man.
A tool to translate wxWidgets projects
« on: August 05, 2013, 11:43:59 pm »
I suggest a plugin script for translating project using Code::Blocks wxWidgets.
This extension of  Code::Blocks will be offered on:
https://sourceforge.net/projects/wxtranslate/
and is called :
Quote
wxTranslate_plugin.script
I will lay the deposit in a few days.

It scans all files (project, or workspace) then creates the file '*.po' we give Poedit.
It uses 'xgettext.exe' and 'wxrc.exe (tools wxWidgets).

If this tool is interest on the forum ,  I will write a wiki page to describe its use.

Sincerely

« Last Edit: August 07, 2013, 04:38:46 pm by LETARTARE »
C::B  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2239
Re: A tools to translate wxWidgets projects
« Reply #1 on: August 06, 2013, 10:37:02 am »
Hello!
it's a squirrel plug-in?

Seems to be useful, also a separate sourceforge page is great, so the plug-in doesn't get lost!

greetings!

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: A tools to translate wxWidgets projects
« Reply #2 on: August 06, 2013, 02:25:16 pm »
+1 for this plugin. Good luck...
[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: 363
  • L'ami de l'homme.The friend of man.
Re: A tools to translate wxWidgets projects
« Reply #3 on: August 06, 2013, 03:51:13 pm »
Thank you.
Yes, it's a squirrel plugin (78 kb !!) that dialogue with executable.
This is the first time as I use a SVN repository I also gently so as not to make mistakes.
A soon.
C::B  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!

Offline LETARTARE

  • Regular
  • ***
  • Posts: 363
  • L'ami de l'homme.The friend of man.
Re: A tools to translate wxWidgets projects
« Reply #4 on: August 07, 2013, 03:48:19 pm »
You can browse the source at :
https://sourceforge.net/projects/wxtranslate/
then get a zip file (or a 7z file).
Version 0.3.1, follow the instructions in the 'infos' (English and French).

Good use.
C::B  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!

Offline LETARTARE

  • Regular
  • ***
  • Posts: 363
  • L'ami de l'homme.The friend of man.
Re: A tool to translate wxWidgets projects
« Reply #5 on: August 09, 2013, 10:59:17 am »
You will find some new pictures of the use on the download site.
https://sourceforge.net/projects/wxtranslate/
A soon.
C::B  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2239
Re: A tool to translate wxWidgets projects
« Reply #6 on: August 09, 2013, 08:26:50 pm »
Hi.
i tried your script with c::b ;) and got this error, witch seems legit:
Code: [Select]
The project name 'Code::Blocks wx2.8.x - Unix' contains an illegal character ':'
i think this should not be a error message, but it should replace the illegal character with something like '_' or '-' ....

I'm also running linux, and i have problems with the ".exe" thing.... it is to hard to implement a check wit "PLATFORM" and remove the .exe from execute string.

greetings
« Last Edit: August 09, 2013, 08:33:06 pm by BlueHazzard »

Offline LETARTARE

  • Regular
  • ***
  • Posts: 363
  • L'ami de l'homme.The friend of man.
Re: A tool to translate wxWidgets projects
« Reply #7 on: August 09, 2013, 09:21:56 pm »
@BlueHazzard
Thank you for trying.

Yes it's normal ':' is an illegal caracter and  '::' also.
Under Wndows, the name of a file must not use certain characters   ( _T("[:*?\"<>|]") ).
You must change the project name with 'Properties' for example :
Quote
Code::Blocks wx2.8.x - Unix -> CodeBlocks_wx2.8.x_Unix

See "function filenameOk(namefile)":L2379.

I made it clear in the documentation that this script is currently working ONLY for Windows.
Obviously the 'exe' can not be considered under Linux.
I have no running Linux and I can not do testing machine.

Sincerely.
« Last Edit: August 09, 2013, 09:24:25 pm by LETARTARE »
C::B  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!

Offline LETARTARE

  • Regular
  • ***
  • Posts: 363
  • L'ami de l'homme.The friend of man.
Re: A tool to translate wxWidgets projects
« Reply #8 on: August 10, 2013, 08:53:06 am »
I fixed an error in 'wxTranslate_plugin.script':L80 :
Code: [Select]
Rexe = _T("wxrc294.exe") -> 'Rexe = _T("wxrc.exe")'new version'0.3.2'

I changed the site, but the download is still on the old version 0.3.1 ??
Also you need to make the change by hand, until 'SourceForge' make changes.
thanks
C::B  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: A tool to translate wxWidgets projects
« Reply #9 on: August 10, 2013, 10:31:52 pm »
Hello. No time to use it right now (an my current project is not at translation stage - oops), but I've seen the screenshots and quickly downloaded then read in diagonal (big explanation file :o)... It sounds promising ;) Do you plan to enter in the contrib plugins which are installable from the plugin manager ?

Also, I didn't understood a line (and maybe others, but not read sequentially) :
Quote
it is assumed that 'codeblocks.exe' is installed in '$(cb_exe)'
What does it means ? Does $(cb_exe) a variable defined somewhere ?
[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: 363
  • L'ami de l'homme.The friend of man.
Re: A tool to translate wxWidgets projects
« Reply #10 on: August 11, 2013, 12:33:34 am »
Thank you very much for recovered 'wxTranslateplugin'.

Quote
Do you plan to enter in the contrib plugins which are installable from the plugin manager
For now we must first test to remove all existing errors ...
Then it would make adaptation to Linux and Mac ...

Quote
Does $(cb_exe) a variable defined somewhere
this is a mistake, it lacks '#'
Quote
$(cb_exe) -> $(#cb_exe)
is to indicate the installation path 'codeblocks.exe' in explanations, but it is not necessary to declare this global variable in 'Settings-> Global variables', because it is not used by the script plugin.

The deposit is updated 'wxTranslate-0.3.2'.

Thank you again for pointing me this oversight, but it is probably more.
I remain at your disposal for any explanation.

C::B  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: A tool to translate wxWidgets projects
« Reply #11 on: August 12, 2013, 02:35:45 am »
OK, better understood about the C::B's cb_exe variable. Also, maybe a tiny thing, but the zip I've downloaded was called Translator.zip : why not use a more explicit filename like wxTranslatePluginForCB_vNNN.zip ?

Good night
[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: 363
  • L'ami de l'homme.The friend of man.
Re: A tool to translate wxWidgets projects
« Reply #12 on: August 12, 2013, 12:18:24 pm »
@eranon
yes it'possible, but actually it is called 'Translator-0.3.2.zip' or *.7z.
C::B  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: A tool to translate wxWidgets projects
« Reply #13 on: August 12, 2013, 05:23:00 pm »
Yes, I know ;) And it's the reason why of my request... Just because when you have hundreds of GB of piece of software, "Translator" is not very speaking... But it's your plugin of course and I can absolutely rename it locally to be able to retrieve it easily... ;D
[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: 363
  • L'ami de l'homme.The friend of man.
Re: A tool to translate wxWidgets projects
« Reply #14 on: August 12, 2013, 06:56:49 pm »
@eranon
yes , indeed you are right, I will modify the next release.
Have you tried ?
C::B  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: A tool to translate wxWidgets projects
« Reply #15 on: August 12, 2013, 08:15:52 pm »
Have you tried ?

Not yet, but when I'll do I'll tell you for sure ;)
[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: 363
  • L'ami de l'homme.The friend of man.
Re: A tool to translate wxWidgets projects
« Reply #16 on: August 12, 2013, 09:20:34 pm »
New release 'wxTranslatePluginForCB-0.3.3.7z'.
Fixed some minor bugs.
C::B  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: A tool to translate wxWidgets projects
« Reply #17 on: August 13, 2013, 10:10:14 pm »
OK, I've quickly taken a try and I stopped when wxTranslate warned me I've not poedit nor wxrc binded with C::B... To do next time :)

Well, but my feeback at this step (since it's the goal of the exchange ; to be positive) :

- Your help file (under "info") is quite complex to follow. For me, the installation and use are far easier and could be explained in some lines like (written quickly) :
  1) Copy the wxTranslate script in the C::B scripts directory
  2) Add the line "here-the-line-content" in the C::B startup script
  3) Launch the C::B console from the View menu to initialize the wxTranslate menu
  4) Launch a project and right-click on one of its virtual directories to display the wxTranslate menu
  5) Choose the "List" command to preview the strings to translate OR the "Extract" one to proceed for real

Also, maybe you should add some lines about the pre-requisite : how to exactly bind poedit.exe and wxrc.exe with C::B...

Have a good evening, LETARTARE
« Last Edit: August 13, 2013, 10:13:22 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: 363
  • L'ami de l'homme.The friend of man.
Re: A tool to translate wxWidgets projects
« Reply #18 on: August 16, 2013, 06:40:37 pm »
@eranon
Thank you for trying 'wxTranslate_plugin'.
Your feedback is sound, and I changed the file 'Readme.txt' and 'Alire.txt' adding the information that you suggest.
So I added the pre-requisites, and a simplified installation.
'Poedit' is not necessary, only 'xgettext.exe', 'msmerge.exe' are absolutely.
As for 'wxrc.exe', it is used only for extensions '.xrc', and '.wxs'.

Forgot :
If after using 'List active project' is abandoned : it remains temporary files '*.str' created by 'wxrc.exe'
As I prepare a new version (0.4.0 ?) to clean up these files if necessary.

Thank you again for your positive ratings.
C::B  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: A tool to translate wxWidgets projects
« Reply #19 on: August 18, 2013, 10:33:34 pm »
OK, I'll be back when you'll release the 0.4.0 ;)
[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: 363
  • L'ami de l'homme.The friend of man.
Re: A tool to translate wxWidgets projects
« Reply #20 on: August 19, 2013, 06:32:33 pm »
Version 0.4.0 is available :

- Improved handling of temporary files by context menu
- The console logs are used to display the workflow
- Illegal characters in the names we manage projects
- Placement 'wxrc.exe' is extended to multiple directories
- Explanatory files are updated

@BlueHazzard
Quote
but it should replace the illegal character with something like '_' or '-'
Now it asks the user if he wants replace illegal characters.

Cordially
C::B  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!

Offline LETARTARE

  • Regular
  • ***
  • Posts: 363
  • L'ami de l'homme.The friend of man.
Re: A tool to translate wxWidgets projects
« Reply #21 on: August 21, 2013, 10:48:13 am »
I just found an oversight in 'Read.me' ('Alire.txt) :
Quote
3-1- Copy the 'wxTranslate_plugin' script in the script directory of  'Code::Blocks'
must be replaced by :
Quote
3-1- Copy the 'wxTranslate_plugin' and 'tools' scripts in the script directory of  'Code::Blocks'
because 'wxTranslate_plugin.script'  load  'tools.script'.

Similar correction in  'infos/wxTranslate_exp.en' in E-2 (*.fr).
C::B  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: A tool to translate wxWidgets projects
« Reply #22 on: August 25, 2013, 06:36:56 pm »
OK, tried the 0.4.1 : it globally works :)

Well, to continue in the same spirit as the one from beginning, here are my constructive comments :

- I still think you complicate what is simple in your explanations (a lot of literature to say something) ;)
- During the list then extract, I received several security warnings (requiring to allow privilege to your scripts)
- At the end of listing (using the "List" command) it reported a duration as 0h 00 mn 0s : funny ! Maybe you could strip-out this info when time is below, say, 15 seconds, or indicate the miliseconds too.
- At the end of the extraction, you don't tell where have been generated the files (ie. under "trlocale" subdirectory).
- I've seen a message box talking about conversion of $$ and %% to $ and %, but I don't know what's about...

For sure, I'll use it when I'll be at localization stage ;D
« Last Edit: August 25, 2013, 06:54:24 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: 363
  • L'ami de l'homme.The friend of man.
Re: A tool to translate wxWidgets projects
« Reply #23 on: August 26, 2013, 12:34:21 am »
hello,
it is good news that you can use.

Quote
I still think you complicate what is simple in your explanations
I'll try to simplify ...

Quote
During the list then extract, I received several security warnings
- see  'wxTranslate_exp.en::NOTES-3-1'
- if it persists, it is better (especially if you have multiple versions installed 'Code::Blocks')
   1- install'' 'wxTranslatepluginforCB-xyz' in a working directory anywhere
   2- and from 'Settings->Scripting...->General->Add' add script,
so you can validate it or not, you have access to the tab 'Security' ..., it is more flexible to use.

Quote
it reported a duration as 0h 00 mn 0s
It is a mistake unresolved in script with macro '$(NOW_L) inside  'function duration(begin, end):L2649' for  'List'
Yet at the end of extraction, time seems correct.

Quote
At the end of the extraction, you don't tell where have been generated the files
- see 'wxTranslate_exp.en::NOTES-3-1'
- I will indicate before ... 'trlocale\project_name.po'

Quote
I've seen a message box talking about conversion of $$ and %% to $ and %
- see 'wxTranslate_exp.en::USE ON SINGLE PROJECT-3.2'  : integrity check of file 'po'
   - removing its characters possibly "\r",
   - replacing its strings possibly "$$..." by "$..."
http://forums.codeblocks.org/index.php/topic,1022.msg66337.html#msg66337
   - replacing its strings possibly "%%..." by "%..."
   - modifying its header using a few macros of 'Code::Blocks'
-but you can answer 'no', and then it does nothing.

Thank you again for the constructive feedback. Because when you work alone, you do not see the point.
A soon.


« Last Edit: August 26, 2013, 12:06:03 pm by LETARTARE »
C::B  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!

Offline LETARTARE

  • Regular
  • ***
  • Posts: 363
  • L'ami de l'homme.The friend of man.
Re: A tool to translate wxWidgets projects
« Reply #24 on: August 28, 2013, 02:25:06 am »
Version 0.4.2 is available :
https://sourceforge.net/projects/wxtranslate

- bug fix on contextual menus when using a project without the  *.xrc or *.wxs file
- try simplification of documentation ...


C::B  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: A tool to translate wxWidgets projects
« Reply #25 on: September 22, 2013, 05:30:41 pm »
Tried this last version and it's OK for me (not applied in my real projects until now, but I'll do it soon). Better explanations in the readme/alire (I installed it in an independent path this time) ;)

About possible improvements (maybe) :
- Possibility to choose the name of the subdirectory in which the files are generated (currently "trlocale")
- Possibility to choose the final filename base (for example talking about a project named "test", I would prefer "test.po" rather than "test_alone.po", and "test_workspace.po" rather than "test.po" for a translated workspace)
- An option to do all steps with one click only (i.e. list -> extract -> delete temp files).

Sounds better from version to version... So, good job !
[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: 363
  • L'ami de l'homme.The friend of man.
Re: A tool to translate wxWidgets projects
« Reply #26 on: September 23, 2013, 11:47:45 am »
Thank you for the positive test.

About possible improvements :

1- waiting for a fix, you can change the line 'wxtranslate_plugin.script:L93'
Code: [Select]
Dirlocale =  _T("trlocale") + ::wxFILE_SEP_PATH
2- I agree, it is more consistent ( -> v 0.4.3),

3- this is more difficult because it complicates the menus and allow many combinations to predict,
I put it on the list of requests.

A soon.
C::B  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!

Offline LETARTARE

  • Regular
  • ***
  • Posts: 363
  • L'ami de l'homme.The friend of man.
Re: A tool to translate wxWidgets projects
« Reply #27 on: September 24, 2013, 10:56:16 am »
Version 0.4.3 is available :
https://sourceforge.net/projects/wxtranslate

- Renaming of files po :
   - simple project -> '*.po'
   - cooperative project -> '*_workspace.po'

C::B  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!

Offline LETARTARE

  • Regular
  • ***
  • Posts: 363
  • L'ami de l'homme.The friend of man.
Re: A tool to translate wxWidgets projects
« Reply #28 on: September 26, 2013, 06:13:12 pm »
Version 0.4.4 is available :
https://sourceforge.net/projects/wxtranslate
- bug fix name '*.po'
C::B  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!

Offline LETARTARE

  • Regular
  • ***
  • Posts: 363
  • L'ami de l'homme.The friend of man.
Re: A tool to translate wxWidgets projects
« Reply #29 on: September 29, 2013, 08:58:26 am »
Version 0.4.5 is available :
https://sourceforge.net/projects/wxtranslate

- bug fix : did not take into account the target of type 'CommandsOnly'
C::B  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!

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: 363
  • 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  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!

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: 363
  • 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  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!

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: 363
  • 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  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!

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: 363
  • 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  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!

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: 363
  • 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  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!

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: 363
  • 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  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!

Offline LETARTARE

  • Regular
  • ***
  • Posts: 363
  • 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  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!

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"]

Offline LETARTARE

  • Regular
  • ***
  • Posts: 363
  • L'ami de l'homme.The friend of man.
Re: A tool to translate wxWidgets projects
« Reply #45 on: May 12, 2014, 04:57:02 pm »
@eranon
I am currently on another project that takes all my time (Grbl with Arduino MEGA2560 for CNC).
My latest version works only "Poedit-1.57" because 1.65 changed paths  >:(
I can not be very available.
Friendships
« Last Edit: May 12, 2014, 07:37:26 pm by LETARTARE »
C::B  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: A tool to translate wxWidgets projects
« Reply #46 on: May 12, 2014, 06:14:04 pm »
OK, thanks to warn me about the Poedit caution... And good luck in your new adventure ;)
[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: 363
  • L'ami de l'homme.The friend of man.
Re: A tool to translate wxWidgets projects
« Reply #47 on: May 12, 2014, 07:18:12 pm »
Hi eranon,
but I will try to answer you if you have questions ;)
C::B  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!

Offline LETARTARE

  • Regular
  • ***
  • Posts: 363
  • L'ami de l'homme.The friend of man.
Re: A tool to translate wxWidgets projects
« Reply #48 on: April 08, 2015, 05:41:11 pm »
Version 0.4.7 is available :
https://sourceforge.net/projects/wxtranslate

- seeking comment by 'xgettext.exe' by "-cTranslators:"
- improved search 'msgmerge.exe'
- updating documentation

Best regards
C::B  : svn11562, wxwidgets2.8,  plugins : QtPregen-2.4.2
1-Vista Business Pack 2 32bits :  TDM-GCC 4.9.2, 
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by GOOGLE !!