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/ (https://sourceforge.net/projects/wxtranslate/)
and is called :
QuotewxTranslate_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
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!
+1 for this plugin. Good luck...
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.
You can browse the source at :
https://sourceforge.net/projects/wxtranslate/ (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.
You will find some new pictures of the use on the download site.
https://sourceforge.net/projects/wxtranslate/ (https://sourceforge.net/projects/wxtranslate/)
A soon.
Hi.
i tried your script with c::b ;) and got this error, witch seems legit:
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
@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 :
QuoteCode::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.
I fixed an error in 'wxTranslate_plugin.script':L80 :
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
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) :
Quoteit is assumed that 'codeblocks.exe' is installed in '$(cb_exe)'
What does it means ? Does $(cb_exe) a variable defined somewhere ?
Thank you very much for recovered 'wxTranslateplugin'.
QuoteDo 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 ...
QuoteDoes $(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.
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
@eranon
yes it'possible, but actually it is called 'Translator-0.3.2.zip' or *.7z.
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
@eranon
yes , indeed you are right, I will modify the next release.
Have you tried ?
Quote from: LETARTARE on August 12, 2013, 06:56:49 PM
Have you tried ?
Not yet, but when I'll do I'll tell you for sure ;)
New release 'wxTranslatePluginForCB-0.3.3.7z'.
Fixed some minor bugs.
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
@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.
OK, I'll be back when you'll release the 0.4.0 ;)
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
Quotebut it should replace the illegal character with something like '_' or '-'
Now it asks the user if he wants replace illegal characters.
Cordially
I just found an oversight in 'Read.me' ('Alire.txt) :
Quote3-1- Copy the 'wxTranslate_plugin' script in the script directory of 'Code::Blocks'
must be replaced by :
Quote3-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).
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
hello,
it is good news that you can use.
QuoteI still think you complicate what is simple in your explanations
I'll try to simplify ...
QuoteDuring 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.
Quoteit 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.
QuoteAt 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'
QuoteI'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.next.codeblocks.org/index.php/topic,1022.msg66337.html#msg66337 (http://forums.next.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.
Version 0.4.2 is available :
https://sourceforge.net/projects/wxtranslate (https://sourceforge.net/projects/wxtranslate)
- bug fix on contextual menus when using a project without the *.xrc or *.wxs file
- try simplification of documentation ...
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 !
Thank you for the positive test.
About possible improvements :
1- waiting for a fix, you can change the line 'wxtranslate_plugin.script:L93'
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.
Version 0.4.3 is available :
https://sourceforge.net/projects/wxtranslate
- Renaming of files po :
- simple project -> '*.po'
- cooperative project -> '*_workspace.po'
Version 0.4.4 is available :
https://sourceforge.net/projects/wxtranslate
- bug fix name '*.po'
Version 0.4.5 is available :
https://sourceforge.net/projects/wxtranslate
- bug fix : did not take into account the target of type 'CommandsOnly'
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 ?
@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.
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...
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
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.
I have done this test in "wxTranslate\trunk\main.cpp:L32"
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
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.
@eranon
1- A remark for the strings (not) to translate:
_("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
--from-code=utf-8 3- For comments:
-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?
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).
@eranon
I'll try if I can extract the comments preceding keyword lines with :
-c//
Cordially
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 ?
@eranon
yes,
my tests use
-cTranslators:
Attached is a version of the script display the command line during extraction.
@eranon
Have you tried this last version?
Good end of the year.
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 fêtes à toi ("Happy Christmas" I say) ¤
I am at localization stage in my project, so feel free to tell me where you are in your plugin, Le Tartare...
@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
OK, thanks to warn me about the Poedit caution... And good luck in your new adventure ;)
Hi eranon,
but I will try to answer you if you have questions ;)
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