- More strings translatable (K/M/G Byte, registering, unregistering)

- Language specific fonts
- $\t now works too
- More to do


git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2475 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2003-04-21 13:32:34 +00:00
parent 526ecc097b
commit cf01b06e62
43 changed files with 498 additions and 106 deletions

View file

@ -43,6 +43,7 @@ HICON g_hIcon;
// Added by Amir Szekely 3rd August 2002
char *language_tables;
int *cur_language_table;
int dlg_offset;
int g_quit_flag; // set when Quit has been called (meaning bail out ASAP)
@ -170,7 +171,8 @@ lang_again:
for (i = 0; i < lang_num; i++) {
language_table=language_tables+i*g_inst_cmnheader->language_table_size;
if (!((lang ^ *(LANGID*)language_table) & lang_mask)) {
cur_language_table=(int*)(language_table+sizeof(LANGID));
dlg_offset=*(int*)(language_table+sizeof(LANGID));
cur_language_table=(int*)(language_table+sizeof(LANGID)+sizeof(int));
break;
}
}
@ -323,7 +325,7 @@ int NSISCALL ui_doinstall(void)
}
#endif
return DialogBox(g_hInstance,MAKEINTRESOURCE(IDD_INST),0,DialogProc);
return DialogBox(g_hInstance,MAKEINTRESOURCE(IDD_INST+dlg_offset),0,DialogProc);
}
#endif//NSIS_CONFIG_VISIBLE_SUPPORT
#ifdef NSIS_CONFIG_SILENT_SUPPORT
@ -371,22 +373,22 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
page *this_page;
static struct
{
char *id;
unsigned int id;
DLGPROC proc;
}
windows[]=
{
#ifdef NSIS_CONFIG_LICENSEPAGE
{MAKEINTRESOURCE(IDD_LICENSE),LicenseProc},
{IDD_LICENSE,LicenseProc},
#endif
#ifdef NSIS_CONFIG_COMPONENTPAGE
{MAKEINTRESOURCE(IDD_SELCOM),SelProc},
{IDD_SELCOM,SelProc},
#endif
{MAKEINTRESOURCE(IDD_DIR),DirProc},
{MAKEINTRESOURCE(IDD_INSTFILES),InstProc},
{NULL,NULL}, // imaginary completed page
{IDD_DIR,DirProc},
{IDD_INSTFILES,InstProc},
{0,NULL}, // imaginary completed page
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
{MAKEINTRESOURCE(IDD_UNINST),UninstProc}
{IDD_UNINST,UninstProc}
#endif
};
@ -400,9 +402,8 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
SetDlgItemTextFromLang(hwndDlg,IDCANCEL,LANG_BTN_CANCEL);
SetDlgItemTextFromLang(hwndDlg,IDC_BACK,LANG_BTN_BACK);
#if defined(NSIS_SUPPORT_CODECALLBACKS) && defined(NSIS_CONFIG_ENHANCEDUI_SUPPORT)
if (!(g_quit_flag = ExecuteCodeSegment(g_inst_cmnheader->code_onGUIInit,NULL)))
g_quit_flag = ExecuteCodeSegment(g_inst_cmnheader->code_onGUIInit,NULL);
#endif
ShowWindow(hwndDlg,SW_SHOW);
}
this_page=g_inst_page+m_page;
@ -470,7 +471,11 @@ nextPage:
if (this_page->id>=0) // NSIS page
{
m_curwnd=CreateDialog(g_hInstance,windows[this_page->id].id,hwndDlg,windows[this_page->id].proc);
m_curwnd=CreateDialog(
g_hInstance,
MAKEINTRESOURCE(windows[this_page->id].id+dlg_offset),
hwndDlg,windows[this_page->id].proc
);
if (m_curwnd)
{
RECT r;
@ -669,12 +674,12 @@ static BOOL CALLBACK UninstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
static char * NSISCALL inttosizestr(int kb, char *str)
{
char sh=20;
char c='G';
char s=0;;
if (kb < 1024) { sh=0; c='K'; }
else if (kb < 1024*1024) { sh=10; c='M'; }
char s=0;
int scale=LANG_GIGA;
if (kb < 1024) { sh=0; scale=LANG_KILO; }
else if (kb < 1024*1024) { sh=10; scale=LANG_MEGA; }
else if (GetVersion()&0x80000000) s='+';//only display the + on GB shown on win9x.
wsprintf(str+mystrlen(str),"%d.%d%cB%c",kb>>sh,((kb*10)>>sh)%10,c,s);
wsprintf(str+mystrlen(str),"%d.%d%s%s%c",kb>>sh,((kb*10)>>sh)%10,LANG_STR(scale),LANG_STR(LANG_BYTE),s);
return str;
}
@ -695,7 +700,7 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
if (GetAsyncKeyState(VK_SHIFT)&0x8000)
{
HWND h=GetUIItem(IDC_CHECK1);
my_SetWindowText(h,"Log install process");
my_SetWindowText(h,LANG_STR(LANG_LOG_INSTALL_PROCESS));
ShowWindow(h,SW_SHOWNA);
}
#endif

View file

@ -938,8 +938,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
g_flags.exec_error--;
if (parm2)
{
char *buf2=process_string_fromparm_tobuf(0x22);
update_status_text(buf2,buf1);
update_status_text_from_lang(parm2,buf1);
if (funke()) g_flags.exec_error++;
}
else

View file

@ -233,6 +233,13 @@ typedef struct
int closebutton; // "Close"
int completed;
int copy_details;
int byte;
int kilo;
int mega;
int giga;
// processed strings
int subcaptions[5];
#endif
@ -253,6 +260,8 @@ typedef struct
int copy_to;
#endif
#ifdef NSIS_SUPPORT_ACTIVEXREG
int registering;
int unregistering;
int symbol_not_found;
int could_not_load;
int no_ole;
@ -293,7 +302,9 @@ typedef struct
int inst_corrupted;
int output_dir;
int create_dir;
int copy_details;
#ifdef NSIS_CONFIG_LOG
int log_install_process;
#endif
} common_strings;
// Flags for common_header.flags

View file

@ -81,6 +81,13 @@
#define LANG_NAME (COMMON_STR(name))
#define LANG_CAPTION (COMMON_STR(caption))
#define LANG_SUBCAPTION(x) (COMMON_STR(subcaptions[x]))
#define LANG_INSTCORRUPTED (COMMON_STR(inst_corrupted))
#define LANG_COPYDETAILS (COMMON_STR(copy_details))
#define LANG_LOG_INSTALL_PROCESS (COMMON_STR(log_install_process))
#define LANG_BYTE (COMMON_STR(byte))
#define LANG_KILO (COMMON_STR(kilo))
#define LANG_MEGA (COMMON_STR(mega))
#define LANG_GIGA (COMMON_STR(giga))
// instruction strings
#define LANG_FILEERR (COMMON_STR(fileerrtext))
@ -108,7 +115,7 @@
#define LANG_COPYFAILED (COMMON_STR(copy_failed))
#define LANG_ERRORCREATING (COMMON_STR(err_creating))
#define LANG_CREATEDUNINST (COMMON_STR(created_uninst))
#define LANG_INSTCORRUPTED (COMMON_STR(inst_corrupted))
#define LANG_COPYDETAILS (COMMON_STR(copy_details))
#define LANG_REGISTERING (COMMON_STR(registering))
#define LANG_UNREGISTERING (COMMON_STR(unregistering))
#endif//_NSIS_LANG_H_