Old language files will work too...

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2364 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2003-03-26 18:18:55 +00:00
parent 586bbd99d1
commit 7df19c4d58
2 changed files with 12 additions and 2 deletions

View file

@ -613,7 +613,10 @@ NLF::NLF(char *filename) {
// Check header
if (strncmp(buf, "NLF v", 5)) throw runtime_error("Invalid language file!");
int nlf_version = atoi(buf+5);
if (atoi(buf+5) != NLF_VERSION) throw runtime_error("Language file version doesn't match NSIS version!");
if (nlf_version != NLF_VERSION) {
if (nlf_version != 2)
throw runtime_error("Language file version doesn't match NSIS version!");
}
// Get language ID
buf[0] = SkipComments(f);
@ -623,6 +626,13 @@ NLF::NLF(char *filename) {
// Read strings
for (int i = 0; i < NLF_STRINGS; i++) {
buf[0] = SkipComments(f);
if ((i == NLF_BTN_LICENSE_AGREE || i == NLF_BTN_LICENSE_DISAGREE) && nlf_version == 2) {
m_szStrings[i] = new char[1];
m_szStrings[i][0] = 0;
continue;
}
fgets(buf+1, NSIS_MAX_STRLEN, f);
if (lstrlen(buf) == NSIS_MAX_STRLEN-1) {
wsprintf(buf, "String too long (string #%d)!", i);

View file

@ -97,7 +97,7 @@ static tokenType tokenlist[TOK__LAST] =
{TOK_LANGSTRING,"LangString",3,0,"[un.]name lang_id string"},
{TOK_LANGSTRINGUP,"LangStringUP",3,0,"[un.]name lang_id string"},
{TOK_LICENSEDATA,"LicenseData",1,1,"[/LANG=lang_id] local_file_that_has_license_text.txt"},
{TOK_LICENSEFORCESELECTION,"LicenseForceSelection",1,3,"[/LANG=lang_id] (checkbox|radiobuttons|off) accept_text decline_text"},
{TOK_LICENSEFORCESELECTION,"LicenseForceSelection",1,3,"[/LANG=lang_id] (checkbox|radiobuttons|off) [accept_text] [decline_text]"},
{TOK_LICENSETEXT,"LicenseText",1,2,"[/LANG=lang_id] license_page_description [license_button_text]"},
{TOK_LICENSEBKCOLOR,"LicenseBkColor",1,0,"background_color"},
{TOK_LOADNLF,"LoadLanguageFile",1,0,"language.nlf"},