下载stardict 源代码
修改mainwin.cpp中
代码: 全选
static const char *google_fromlangs[] = {N_("Arabic"), N_("Chinese"), N_("Chinese (Simplified)"), N_("Chinese (Traditional)"), N_("English"), N_("French"), N_("German"), N_("Italian"), N_("Japanese"), N_("Korean"), N_("Portuguese"), N_("Russian"), N_("Spanish"), NULL};
static const char *google_arabic_tolangs[] = { N_("English"), NULL };
static const char *google_arabic_code[] = { "ar&tl=en" };
static const char *google_chinese_tolangs[] = { N_("English"), NULL };
static const char *google_chinese_code[] = { "zh-CN&tl=en" };
static const char *google_chinese_simplified_tolangs[] = {N_("Chinese (Traditional)"), N_("English"), NULL };
static const char *google_chinese_simplified_code[] = { "zh-CN&tl=zh-TW", "zh-CN&tl=en" };
static const char *google_chinese_traditional_tolangs[] = {N_("Chinese (Simplified)"), N_("English"), NULL };
static const char *google_chinese_traditional_code[] = { "zh-TW&tl=zh-CN", "zh-TW&tl=en" };
static const char *google_english_tolangs[] = { N_("Arabic"), N_("Chinese (Simplified)"), N_("Chinese (Traditional)"), N_("French"), N_("German"), N_("Italian"), N_("Japanese"), N_("Korean"), N_("Portuguese"), N_("Russian"), N_("Spanish"), NULL };
static const char *google_english_code[] = {"en&tl=ar", "en&tl=zh-CN", "en&tl=zh-TW", "en&tl=fr", "en&tl=de", "en&tl=it", "en&tl=ja", "en&tl=ko", "en&tl=pt", "en&tl=ru", "en&tl=es"};
static const char *google_french_tolangs[] = { N_("English"), N_("German"), NULL };
static const char *google_french_code[] = { "fr&tl=en", "fr&tl=de" };
static const char *google_german_tolangs[] = {N_("English"), N_("French"), NULL};
static const char *google_german_code[] = { "de&tl=en", "de&tl=fr" };
static const char *google_italian_tolangs[] = {N_("English"), NULL};
static const char *google_italian_code[] = { "it&tl=en" };
static const char *google_japanese_tolangs[] = {N_("English"), NULL};
static const char *google_japanese_code[] = { "ja&tl=en" };
static const char *google_korean_tolangs[] = {N_("English"), NULL};
static const char *google_korean_code[] = { "ko&tl=en" };
static const char *google_portuguese_tolangs[] = {N_("English"), NULL};
static const char *google_portuguese_code[] = { "pt&tl=en" };
static const char *google_russian_tolangs[] = {N_("English"), NULL};
static const char *google_russian_code[] = { "ru&tl=en" };
static const char *google_spanish_tolangs[] = {N_("English"), NULL};
static const char *google_spanish_code[] = { "es&tl=en" };
代码: 全选
void TransWin::GetHostFile(std::string &host, std::string &file, const char *text)
{
gint engine_index = gtk_combo_box_get_active(GTK_COMBO_BOX(engine_combobox));
if(engine_index==0){
host = "translate.google.cn";
file = "/translate_t?prev=hp&hl=zh-CN&js=y&sl=";
}else if(engine_index==1){
host = "fanyi.cn.yahoo.com";
file = "/translate_txt?ei=UTF-8&lp=";
}else if(engine_index==2){
host = "babelfish.altavista.com";
file = "/tr?ienc=utf-8&lp=";
}else if(engine_index==3){
host = "www.systranbox.com";
file = "/systran/box?systran_id=SystranSoft-en&systran_charset=UTF-8&systran_lp=";
}else if(engine_index==4){
host = "www.excite.co.jp";
file = "/world";
}else if(engine_index==5){
host = "fy.iciba.com";
file = "/?langpair=";
}
gint fromlang_index = gtk_combo_box_get_active(GTK_COMBO_BOX(fromlang_combobox));
gint tolang_index = gtk_combo_box_get_active(GTK_COMBO_BOX(tolang_combobox));
const char *lang_code = trans_engines[engine_index].code[fromlang_index][tolang_index];
if(engine_index==4){
if(strcmp(lang_code,"KOJA")==0 || strcmp(lang_code,"JAKO")==0){
file += "/korean?wb_lp=";
}else if(strcmp(lang_code,"ENJA")==0 || strcmp(lang_code,"JAEN")==0){
file += "/english?wb_lp=";
}else if(strcmp(lang_code,"CHJA")==0 || strcmp(lang_code,"JACH")==0){
file += "/chinese?wb_lp=";
}else{
file += "/english?wb_lp=";
}
}
file += lang_code;
if (engine_index == 0) {
file += "&text=";
file += text;
} else if (engine_index == 1){
file += "&text=";
file += text;
} else if (engine_index == 2){
file += "&trtext=";
file += text;
}else if(engine_index == 3 ){
file += "&systran_text=";
file += text;
}else if(engine_index == 4 ){
file += "&before=";
file += text;
}
}
代码: 全选
} else if (engine_index == 0) {
//#define GoogleTranslateStartMark "<div id=result_box dir=ltr>"
#define GoogleTranslateStartMark "<textarea name=utrans wrap=SOFT dir=\"ltr\" rows=5 id=suggestion>"
//<textarea name=utrans wrap=SOFT dir="ltr" rows=5 id=suggestion>
char *p = g_strstr_len(buffer, buffer_len, GoogleTranslateStartMark);
if (p) {
p += sizeof(GoogleTranslateStartMark) -1;
char *p2 = g_strstr_len(p, buffer_len - (p - buffer), "</textarea>");
if (p2) {
result_text.assign(p, p2-p);
found = true;
}
}
}
http://www.brsbox.com/filebox/down/fc/86e4548789d625fa5592ffb2abc895a1
下载地址2
http://xiujiecn.qupan.com/5018378.html
如何用gcc/g++编译
代码: 全选
./configure PKG_CONFIG=/usr/bin/pkg-config --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man --disable-gnome-support --disable-schemas-install --disable-espeak --disable-gucharmap --disable-festival --disable-advertisement --disable-updateinfo --disable-spell
make
代码: 全选
sudo make install