Open andy5995 opened 6 years ago
@andy5995 Yeah! I’ll look into it. I’m a little busy at the moment, but I’ll work on it later tonight!
So these are the files where you'll be removing messages
htdig/htdig.cc htsearch/htsearch.cc htsearch/qtest.cc htsearch/parsetest.cc httools/htmerge.cc httools/htdump.cc httools/htstat.cc httools/htpurge.cc httools/htload.cc
You'll notice in htdig.cc that some of the cout statements have been changed to printf statements, and that _(
and a closing parens has been added to some of the strings.
That's related to the translation process. _(String)
is defined in htdig.h
#include "gettext.h"
#define _(String) gettext (String)
#define gettext_noop(String) String
#define N_(String) gettext_noop (String)
Using the gettext library, one would use gettext(String)
but using the _ shortens that. The calls to are strings that will get translated.
So that's the short explanation. What that means for you...
That block above would have to be moved to a header file that all the .cc files I mentioned loads. I'm thinking HtConfiguration.h would be the best place for it. It can then be removed from htdig.h.
If you can suggest a better place for it, please do so.
These three lines that follow main()
must be added to each of the .cc files in the list above:
https://github.com/andy5995/htdig/blob/e49f1cfa3a889a05fba0e21b4fc49d384500a22b/htdig/htdig.cc#L78-L82
That basically allows gettext
to work.
Once that's done, it'll be a matter of editing the Makefiles, so just let me know when you've prepared the sources as described above. Or let me know if you get stuck.
And let me know if you change your mind about working on this ;)
I have to correct myself on some of what I said above. That will all help to prepare the sources for translation, but since the translated strings at present will only be in messages.c and htdig.cc, that would not all be necessary. gettext would only need to be triggered in messages.c.
But as I said, it will help prepare the sources for translating. Soon, each of those .cc files will also need to be able to use gettext
and the _(String)
definition.
@andy5995 I believe that the location for the code snippet above is perfectly suitable to be located in HtConfiguration.cc!
If you run
ack "Verbose mode. This increases the verbosity of the"
you'll see a lot of the same messages in several files.So for example, this code:
Could go into htcommon/messages.c and all the other programs that use it could call a variable containing the contents of the string in that file.
And actually, to help with preparing the source for translating, instead of using "cout" we'll do this:
@AlexChristoforides would you be interested in working on this?