PDA

View Full Version : Add custom string to Language file


Stieven76
30th June 2010, 10:03
Hi,

In my installation proces it can be that there are some messageboxes shown.
Now I have set the message text hardcoded in the installer, but how can I use a string var for it?
See example:
MessageBox "MB_OK" "This program requires Microsoft Windows XP or later"
MessageBox MB_YESNO|MB_ICONQUESTION "$(RemoveOldVersionQuestion)" IDNO LblCheckDone

In what file and where do I need to put the langstring "RemoveOldVersionQuestion"?

Thx for any help!!

jiake
30th June 2010, 12:38
Using LangString.

LangString ERROR_TEXT 1033 'Missing a required file!'
LangString ERROR_TEXT 2052 '缺少必要的文件!'

or:

LangString ERROR_TEXT ${LANG_ENGLISH} 'Missing a required file!'
LangString ERROR_TEXT ${LANG_SIMPCHINESE} '缺少必要的文件!'

MessageBox MB_OK|MB_ICONSTOP "$(ERROR_TEXT)"

Setup will automatically show the proper text based on the language of user's OS.

Stieven76
30th June 2010, 12:43
Hi Jake,

Thx for your reply.
Isn't it possible that I add the string variable to say Dutch.nsh file and call it from there?
We have nine languages to support so it would be great if I could add them to their resp. language file.

Afrow UK
30th June 2010, 22:50
I wouldn't because you will then get warnings when using the language files in other scripts that do not use your added language string. If you want, create your own additional nsh files.

Stu

redxii
30th June 2010, 23:54
Just create "dutch.nsh" and just include it:

!addincludedir .

...

!insertmacro MUI_LANGUAGE "Dutch"

!include Dutch.nsh

Though I use this "format" so I don't have to put ${LANG_DUTCH} or the #### throughout:


!insertmacro LANGFILE "Dutch" "Nederlands"

${LangFileString} ERROR_TEXT "There was an error."


and !insertmacro LANGFILE_INCLUDE "translations\dutch.nsh" to include it.