Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development
A tool to translate wxWidgets projects
LETARTARE:
I have done this test in "wxTranslate\trunk\main.cpp:L32"
--- Code: ---wxString foo = _("My name is");
wxString foo2 = _(" My name ë è ô");
--- End code ---
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
--- End quote ---
'Extract' works well !
And in '*.po' :
--- Quote ---#: main.cpp:32
msgid "My name is"
msgstr ""
#: main.cpp:34
msgid " My name ë è ô"
msgstr ""
--- End quote ---
Version 'xgettext.exe' is '0.18.1'
Is it repaired?
Cordially
eranon:
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.
--- End quote ---
LETARTARE:
@eranon
1- A remark for the strings (not) to translate:
--- Code: ---_("Welcome") and _T(" Thô") or wxT(" Thô")
--- End code ---
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
--- End quote ---
'wxTranslate' uses
--- Code: -----from-code=utf-8
--- End code ---
3- For comments:
--- Code: ----c, --add-comments place all comment blocks preceding keyword lines in output file
--- End code ---
but 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)
--- End quote ---
'wxTranslate' uses :
-k= '_' or '_T' or 'wxT'
For you, what's the point of removing the comments?
eranon:
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).
LETARTARE:
@eranon
I'll try if I can extract the comments preceding keyword lines with :
--- Code: ----c//
--- End code ---
Cordially
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version