语言包设置

This commit is contained in:
13038267101 2023-01-31 16:01:27 +08:00
parent 09308e53c6
commit 397f919b1d
2 changed files with 45 additions and 44 deletions

View File

@ -194,8 +194,8 @@
#define SCANNER_NAME_HW_8000 "Hanvon HW-8000" #define SCANNER_NAME_HW_8000 "Hanvon HW-8000"
#define SCANNER_NAME_HW_9000 "Hanvon HW-9000" #define SCANNER_NAME_HW_9000 "Hanvon HW-9000"
#define SCANNER_NAME_CT_9020 "CUMTENN CT-9020" #define SCANNER_NAME_CT_9020 "CUMTENN CT-6900"
#define SCANNER_NAME_CT_4520 "CUMTENN CT-4520" #define SCANNER_NAME_CT_4520 "CUMTENN CT-6005"
#define SCANNER_NAME_CT_138 "CUMTENN CT-138" #define SCANNER_NAME_CT_138 "CUMTENN CT-138"
#define SCANNER_NAME_CT_238 "CUMTENN CT-238" #define SCANNER_NAME_CT_238 "CUMTENN CT-238"

View File

@ -23,7 +23,7 @@
/// ///
#define TO_STR(s) #s #define TO_STR(s) #s
#define PID_AND_NAME(p, n) 0x##p, std::string(n) + " - " + TO_STR(p) #define PID_AND_NAME(p, n) 0x##p, std::string(n) + " - " + TO_STR(p)
#define GET_LANG(str,b) from_default_language(str,b)
static struct static struct
{ {
uint16_t vid; // vendor ID uint16_t vid; // vendor ID
@ -74,7 +74,8 @@ g_supporting_devices[] = {
, {0x064B, PID_AND_NAME(7823,SCANNER_NAME_HG_G200), "G200", "", &hg_scanner_mgr::create_scanner_g100} , {0x064B, PID_AND_NAME(7823,SCANNER_NAME_HG_G200), "G200", "", &hg_scanner_mgr::create_scanner_g100}
#endif #endif
}; };
static std::string g_vendor = COMPANY_NAME; bool islang = false;
static std::string g_vendor = GET_LANG(COMPANY_NAME, &islang);
#define BRAND_LOGO_SIZE 8 * 1024 #define BRAND_LOGO_SIZE 8 * 1024
@ -431,7 +432,7 @@ void hg_scanner_mgr::set_appendix_info_for_about(SANE_About* about, char*& ptr,
{ {
#ifdef BRAND_DISPLAY_ALL_EXPAND #ifdef BRAND_DISPLAY_ALL_EXPAND
if (!info || *info == 0) if (!info || *info == 0)
info = BRAND_COMMUNICATION_FAIL; info = GET_LANG(BRAND_COMMUNICATION_FAIL,&islang);
#endif #endif
if (info && strlen(info)) if (info && strlen(info))
@ -461,32 +462,32 @@ scanner_err hg_scanner_mgr::get_about_info(scanner_handle h, void* data, unsigne
SANE_About tmp; SANE_About tmp;
bytes += sizeof(g_logo); bytes += sizeof(g_logo);
bytes += strlen(BRAND_APP_NAME) + 8; bytes += strlen(GET_LANG(BRAND_APP_NAME,&islang)) + 8;
bytes += strlen(BRAND_TITLE_VERSION) + 8; bytes += strlen(GET_LANG(BRAND_TITLE_VERSION,&islang)) + 8;
bytes += strlen(BRAND_TITLE_COPYRIGHT) + 8; bytes += strlen(GET_LANG(BRAND_TITLE_COPYRIGHT,&islang)) + 8;
bytes += strlen(BRAND_COPYRIGHT) + 8; bytes += strlen(GET_LANG(BRAND_COPYRIGHT,&islang)) + 8;
bytes += strlen(BRAND_TITE_MANUFACTOR) + 8; bytes += strlen(GET_LANG(BRAND_TITE_MANUFACTOR,&islang)) + 8;
bytes += strlen(BRAND_TITLE_URL) + 8; bytes += strlen(GET_LANG(BRAND_TITLE_URL,&islang)) + 8;
bytes += strlen(BRAND_COMPANY_URL) + 8; bytes += strlen(GET_LANG(BRAND_COMPANY_URL,&islang)) + 8;
bytes += strlen(BRAND_URL_COMPANY_URL) + 8; bytes += strlen(GET_LANG(BRAND_URL_COMPANY_URL,&islang)) + 8;
bytes += strlen(BRAND_TITLE_TEL) + 8; bytes += strlen(GET_LANG(BRAND_TITLE_TEL,&islang)) + 8;
bytes += strlen(BRAND_COMPANY_TEL) + 8; bytes += strlen(GET_LANG(BRAND_COMPANY_TEL,&islang)) + 8;
bytes += strlen(BRAND_TITLE_ADDRESS) + 8; bytes += strlen(GET_LANG(BRAND_TITLE_ADDRESS,&islang)) + 8;
bytes += strlen(BRAND_COMPANY_ADDRESS) + 8; bytes += strlen(GET_LANG(BRAND_COMPANY_ADDRESS,&islang)) + 8;
bytes += strlen(BRAND_TITLE_GPS) + 8; bytes += strlen(GET_LANG(BRAND_TITLE_GPS,&islang)) + 8;
bytes += strlen(BRAND_COMPANY_GPS) + 8; bytes += strlen(GET_LANG(BRAND_COMPANY_GPS,&islang)) + 8;
bytes += strlen(BRAND_URL_GPS) + 8; bytes += strlen(GET_LANG(BRAND_URL_GPS,&islang)) + 8;
// bytes += 5 * sizeof(tmp.appendix[0]); // bytes += 5 * sizeof(tmp.appendix[0]);
#ifndef BRAND_DISPLAY_ALL_EXPAND #ifndef BRAND_DISPLAY_ALL_EXPAND
if (scanner) if (scanner)
#endif #endif
{ {
bytes += sizeof(tmp.appendix[0]) + BRAND_INFO_MAX_LENGTH + 8 + strlen(BRAND_TITLE_FIRM_VERSION) + 8; bytes += sizeof(tmp.appendix[0]) + BRAND_INFO_MAX_LENGTH + 8 + strlen(GET_LANG(BRAND_TITLE_FIRM_VERSION,&islang)) + 8;
bytes += sizeof(tmp.appendix[0]) + BRAND_INFO_MAX_LENGTH + 8 + strlen(BRAND_TITLE_SERIAL_NUM) + 8; bytes += sizeof(tmp.appendix[0]) + BRAND_INFO_MAX_LENGTH + 8 + strlen(GET_LANG(BRAND_TITLE_SERIAL_NUM,&islang)) + 8;
bytes += sizeof(tmp.appendix[0]) + BRAND_INFO_MAX_LENGTH + 8 + strlen(BRAND_TITLE_IP) + 8; bytes += sizeof(tmp.appendix[0]) + BRAND_INFO_MAX_LENGTH + 8 + strlen(GET_LANG(BRAND_TITLE_IP,&islang)) + 8;
bytes += sizeof(tmp.appendix[0]) + 28 + strlen(BRAND_TITLE_ROLLER_COUNT) + 8; bytes += sizeof(tmp.appendix[0]) + 28 + strlen(GET_LANG(BRAND_TITLE_ROLLER_COUNT,&islang)) + 8;
bytes += sizeof(tmp.appendix[0]) + 28 + strlen(BRAND_TITLE_HISTORY_COUNT) + 8; bytes += sizeof(tmp.appendix[0]) + 28 + strlen(GET_LANG(BRAND_TITLE_HISTORY_COUNT,&islang)) + 8;
bytes += sizeof(tmp.appendix[0]); bytes += sizeof(tmp.appendix[0]);
} }
@ -503,7 +504,7 @@ scanner_err hg_scanner_mgr::get_about_info(scanner_handle h, void* data, unsigne
char* ptr = (char*)data + sizeof(SANE_About) + 9 * sizeof(about->appendix[0]); char* ptr = (char*)data + sizeof(SANE_About) + 9 * sizeof(about->appendix[0]);
about->title = ptr; about->title = ptr;
strcpy(ptr, BRAND_APP_NAME); strcpy(ptr, GET_LANG(BRAND_APP_NAME,&islang));
MOVE_TO_NEXT_STR(ptr); MOVE_TO_NEXT_STR(ptr);
about->version = ptr; about->version = ptr;
@ -511,7 +512,7 @@ scanner_err hg_scanner_mgr::get_about_info(scanner_handle h, void* data, unsigne
MOVE_TO_NEXT_STR(ptr); MOVE_TO_NEXT_STR(ptr);
about->copyright = ptr; about->copyright = ptr;
strcpy(ptr, BRAND_COPYRIGHT); strcpy(ptr, GET_LANG(BRAND_COPYRIGHT,&islang));
MOVE_TO_NEXT_STR(ptr); MOVE_TO_NEXT_STR(ptr);
about->logo_bytes = sizeof(g_logo);; about->logo_bytes = sizeof(g_logo);;
@ -521,29 +522,29 @@ scanner_err hg_scanner_mgr::get_about_info(scanner_handle h, void* data, unsigne
int count = 0, rolls = 0, ret = SCANNER_ERR_OK; int count = 0, rolls = 0, ret = SCANNER_ERR_OK;
set_appendix_info_for_about(about, ptr, count, BRAND_TITE_MANUFACTOR, g_vendor.c_str(), NULL); set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITE_MANUFACTOR,&islang), g_vendor.c_str(), NULL);
set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_URL, BRAND_COMPANY_URL, BRAND_URL_COMPANY_URL); set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_URL,&islang), GET_LANG(BRAND_COMPANY_URL,&islang), GET_LANG(BRAND_URL_COMPANY_URL,&islang));
set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_TEL, BRAND_COMPANY_TEL, NULL); set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_TEL,&islang), GET_LANG(BRAND_COMPANY_TEL,&islang), NULL);
set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_ADDRESS, BRAND_COMPANY_ADDRESS, NULL); set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_ADDRESS,&islang), GET_LANG(BRAND_COMPANY_ADDRESS,&islang), NULL);
set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_GPS, BRAND_COMPANY_GPS, BRAND_URL_GPS); set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_GPS,&islang), GET_LANG(BRAND_COMPANY_GPS,&islang), GET_LANG(BRAND_URL_GPS,&islang));
if (scanner) if (scanner)
{ {
set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_FIRM_VERSION, scanner->get_firmware_version().c_str(), NULL); set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_FIRM_VERSION,&islang), scanner->get_firmware_version().c_str(), NULL);
set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_SERIAL_NUM, scanner->get_serial_num().c_str(), NULL); set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_SERIAL_NUM,&islang), scanner->get_serial_num().c_str(), NULL);
info = scanner->get_ip(); info = scanner->get_ip();
if (info.length() > 10) if (info.length() > 10)
set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_IP, info.c_str(), NULL); set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_IP,&islang), info.c_str(), NULL);
ret = scanner->get_roller_num(rolls); ret = scanner->get_roller_num(rolls);
if (ret == SCANNER_ERR_OK) if (ret == SCANNER_ERR_OK)
{ {
char buf[40]; char buf[40];
sprintf(buf, "%u", rolls); sprintf(buf, "%u", rolls);
set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_ROLLER_COUNT, buf, NULL); set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_ROLLER_COUNT,&islang), buf, NULL);
} }
#ifdef BRAND_DISPLAY_ALL_EXPAND #ifdef BRAND_DISPLAY_ALL_EXPAND
else else
set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_ROLLER_COUNT, rolls == -1 ? BRAND_COMMUNICATION_FAIL : BRAND_DEVICE_NOT_SUPPORT, NULL); set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_ROLLER_COUNT,&islang), rolls == -1 ? GET_LANG(BRAND_COMMUNICATION_FAIL,&islang) : GET_LANG(BRAND_DEVICE_NOT_SUPPORT,&islang), NULL);
#endif #endif
ret = scanner->get_history_scan_count(rolls); ret = scanner->get_history_scan_count(rolls);
@ -551,21 +552,21 @@ scanner_err hg_scanner_mgr::get_about_info(scanner_handle h, void* data, unsigne
{ {
char buf[40]; char buf[40];
sprintf(buf, "%u", rolls); sprintf(buf, "%u", rolls);
set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_HISTORY_COUNT, buf, NULL); set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_HISTORY_COUNT,&islang), buf, NULL);
} }
#ifdef BRAND_DISPLAY_ALL_EXPAND #ifdef BRAND_DISPLAY_ALL_EXPAND
else else
set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_HISTORY_COUNT, rolls == -1 ? BRAND_COMMUNICATION_FAIL : BRAND_DEVICE_NOT_SUPPORT, NULL); set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_HISTORY_COUNT,&islang), rolls == -1 ? GET_LANG(BRAND_COMMUNICATION_FAIL,&islang) : GET_LANG(BRAND_DEVICE_NOT_SUPPORT,&islang), NULL);
#endif #endif
} }
#ifdef BRAND_DISPLAY_ALL_EXPAND #ifdef BRAND_DISPLAY_ALL_EXPAND
else else
{ {
set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_FIRM_VERSION, BRAND_NO_DEVICE, NULL); set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_FIRM_VERSION,&islang), GET_LANG(BRAND_NO_DEVICE,&islang), NULL);
set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_SERIAL_NUM, BRAND_NO_DEVICE, NULL); set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_SERIAL_NUM,&islang), GET_LANG(BRAND_NO_DEVICE,&islang), NULL);
set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_IP, BRAND_NO_DEVICE, NULL); set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_IP,&islang), GET_LANG(BRAND_NO_DEVICE,&islang), NULL);
set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_ROLLER_COUNT, BRAND_NO_DEVICE, NULL); set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_ROLLER_COUNT,&islang), GET_LANG(BRAND_NO_DEVICE,&islang), NULL);
set_appendix_info_for_about(about, ptr, count, BRAND_TITLE_HISTORY_COUNT, BRAND_NO_DEVICE, NULL); set_appendix_info_for_about(about, ptr, count, GET_LANG(BRAND_TITLE_HISTORY_COUNT,&islang), GET_LANG(BRAND_NO_DEVICE,&islang), NULL);
} }
#endif #endif