Stieven76
30th June 2010 11:03 UTC
Add custom string to Language file
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 13:38 UTC
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 13:43 UTC
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 23:50 UTC
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
1st July 2010 00:54 UTC
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.