From 210e2d4e5e9110acd6865ea454b98af72b7b2a83 Mon Sep 17 00:00:00 2001 From: kichik Date: Fri, 4 Oct 2002 10:27:46 +0000 Subject: [PATCH] Added an option for unprocessed user multilingual strings (LangStringUP). Use it if you see weird squares before and special character in your LangString. git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1298 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/build.h | 2 +- Source/lang.cpp | 4 ++-- Source/script.cpp | 5 +++-- Source/tokens.cpp | 1 + Source/tokens.h | 1 + 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Source/build.h b/Source/build.h index fa320792..183c389c 100644 --- a/Source/build.h +++ b/Source/build.h @@ -139,7 +139,7 @@ class CEXEBuild { StringTable *GetTable(LANGID &lang); int SetString(char *string, int id, int process, WORD lang=0); int SetString(char *string, int id, int process, StringTable *table); - int SetUserString(char *name, LANGID lang, char *string); + int SetUserString(char *name, LANGID lang, char *string, int process=1); int WriteStringTables(); void FillDefaultsIfNeeded(StringTable *table, NLF *nlf=0); #define IsNotSet(s) _IsNotSet(string_tables.size()?&(string_tables[0]->s):0) diff --git a/Source/lang.cpp b/Source/lang.cpp index f271fd01..4aebda31 100644 --- a/Source/lang.cpp +++ b/Source/lang.cpp @@ -184,7 +184,7 @@ int CEXEBuild::SetString(char *string, int id, int process, StringTable *table) return PS_OK; } -int CEXEBuild::SetUserString(char *name, LANGID lang, char *string) { +int CEXEBuild::SetUserString(char *name, LANGID lang, char *string, int process/*=1*/) { StringTable *table = GetTable(lang); if (!table) return PS_ERROR; @@ -208,7 +208,7 @@ int CEXEBuild::SetUserString(char *name, LANGID lang, char *string) { } user_strings->resize((idx+1)*sizeof(int)); - ((int*)user_strings->get())[idx] = uninst ? add_string_uninst(string,1) : add_string_main(string,1); + ((int*)user_strings->get())[idx] = uninst ? add_string_uninst(string,process) : add_string_main(string,process); for (int j = 0; j < string_tables.size(); j++) { if (j == idx) continue; diff --git a/Source/script.cpp b/Source/script.cpp index 4ef7c0e5..af283abf 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -533,8 +533,9 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char // header flags /////////////////////////////////////////////////////////////////////////////// case TOK_LANGSTRING: - SCRIPT_MSG("LangString: \"%s\" %s \"%s\"\n", line.gettoken_str(1), line.gettoken_str(2), line.gettoken_str(3)); - if (SetUserString(line.gettoken_str(1), line.gettoken_int(2), line.gettoken_str(3)) != PS_OK) + case TOK_LANGSTRINGUP: + SCRIPT_MSG("LangString: \"%s\" %s \"%s\"%s\n", line.gettoken_str(1), line.gettoken_str(2), line.gettoken_str(3), which_token==TOK_LANGSTRINGUP?" (unprocessed)":""); + if (SetUserString(line.gettoken_str(1), line.gettoken_int(2), line.gettoken_str(3), which_token==TOK_LANGSTRING) != PS_OK) { ERROR_MSG("Error: LangString: can't add user string!\n"); return PS_ERROR; diff --git a/Source/tokens.cpp b/Source/tokens.cpp index 7e682c24..7083877b 100644 --- a/Source/tokens.cpp +++ b/Source/tokens.cpp @@ -93,6 +93,7 @@ static tokenType tokenlist[TOK__LAST] = {TOK_ISWINDOW,"IsWindow",2,1,"hwnd jump_if_window [jump_if_not_window]"}, {TOK_GOTO,"Goto",1,0,"label"}, {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_LICENSETEXT,"LicenseText",1,2,"[/LANG=lang_id] license_page_description [license_button_text]"}, {TOK_LICENSEBKCOLOR,"LicenseBkColor",1,0,"background_color"}, diff --git a/Source/tokens.h b/Source/tokens.h index 04ab2890..68366629 100644 --- a/Source/tokens.h +++ b/Source/tokens.h @@ -54,6 +54,7 @@ enum TOK_COMPLETEDTEXT, TOK_LANGSTRING, + TOK_LANGSTRINGUP, // system "preprocessor"ish tokens TOK_P_IFDEF,