- NSIS Discussion
- Multilanguage header
Archive: Multilanguage header
Brewster333
21st July 2008 11:06 UTC
Multilanguage header
Hello! I need help... I'm trying to create multilanguage setup using MUI2. I'm using defines:
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "Header.bmp"
!define MUI_WELCOMEFINISHPAGE_BITMAP "Wizard.bmp"
All works perfectly, but I need use different images for each language... Witch way I can do it (if it is possible)???
Thank you for your help.
pospec
21st July 2008 12:34 UTC
I believe that you can use a variable instead of the filename and fill the variable in onInit with some language string.
I didn't tried it.
EDIT: Ooops, it doesn't work...
Brewster333
21st July 2008 13:50 UTC
I trying different ways to solve this problem (image substitution in .onGUIInit, MUI_HEADERIMAGE_BITMAP redefining), but it does not woking... May be ChangeUI function help me? I am a novice in NSIS-script developing and don't know which parameters use for ChangeUI...
LoRd_MuldeR
21st July 2008 14:46 UTC
LanguageString!
LangStr HeaderImage ${LANG_ENGLISH} "Header_EN.bmp"
LangStr HeaderImage ${LANG_GERMAN} "Header_DE.bmp"
LangStr WizardImage ${LANG_ENGLISH} "Wizard_EN.bmp"
LangStr WizardImage ${LANG_GERMAN} "Wizard_DE.bmp"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "$(HeaderImage)"
!define MUI_WELCOMEFINISHPAGE_BITMAP "$(WizardImage)"
Afrow UK
21st July 2008 15:28 UTC
Neither will work because it needs to include the image file at compile time. For the header image you can extract a new image depending on $LANGUAGE and set it with SetBrandingImage. For the welcome and finish pages you should be able to extract a new bitmap file to $PLUGINSDIR overwriting the existing one in a function set with MUI_PAGE_FUNCTION_GUIINIT.
Stu
Brewster333
22nd July 2008 06:21 UTC
Thanks for help. Solution is simple as usual. :)
Brewster333
22nd July 2008 08:18 UTC
A new trouble. Method with using LangString is not working (as Afrow UK says). I using an image substitution in .onGUIInit. Script fragment:
***
!include MUI2.nsh
***
!define MUI_CUSTOMFUNCTION_GUIINIT GUIInit
***
ReserveFile "HeaderEN.BMP"
ReserveFile "WizardEN.BMP"
***
Function GUIInit
File /oname=$PLUGINSDIR\bg.bmp bg.bmp
BgImage::SetBg /NOUNLOAD /TILED "$PLUGINSDIR\bg.bmp"
BgImage::Redraw /NOUNLOAD
IntCmp $LANGUAGE ${LANG_RUSSIAN} End CopyImages CopyImages
CopyImages:
File /oname=$PLUGINSDIR\modern-header.bmp HeaderEN.bmp
File /oname=$PLUGINSDIR\modern-wizard.bmp WizardEN.bmp
#MessageBox MB_OK $PLUGINSDIR
End:
FunctionEnd
I see that images in $PLUGINSDIR are replaced. Start and Finish pages are using new WizardEN.BMP (substituted bitmap), but header uses old bitmap... May be old header image has been cached? May be I must make it in other place (I try make it on .onInit, but in this case all images are not changed)? Where is problem? Thanks for support.
Afrow UK
22nd July 2008 12:39 UTC
As I said you have to use SetBrandingImage as well:
SetBrandingImage /IMGID=1046 "$PLUGINSDIR\modern-header.bmp"
Edit: I also recommend using LogicLib:
${If} $LANGUAGE == ${LANG_RUSSIAN}
...
${EndIf}
Stu
Brewster333
22nd July 2008 14:41 UTC
SetBrandingImage solves this problem! Now I using LogicLib :)
BIG thanks for support!
didava
1st September 2013 02:05 UTC
Greetings
I've tested this
Does not work
Sample code to write the
Thanks...
didava
1st September 2013 12:10 UTC
Professors ؟؟
I'm waiting ؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟
:cry::cry::cry::cry::cry::cry::cry:
Should I open a new Post
didava
1st September 2013 21:56 UTC
no work?
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
${if} $LANGUAGE == ${LANG_GERMAN}
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "$EXEDIR\GRheader.bmp"
${ElseIf} $LANGUAGE == ${LANG_ENGLISH}
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "$EXEDIR\ENheader.bmp"
${EndIf}
FunctionEnd
Why not work؟؟
didava
1st September 2013 23:43 UTC
LangString HEADER_IMAGE ${LANG_ENGLISH} "misc\dialogs\modern_headerbmpen.exe"
LangString HEADER_IMAGE ${LANG_GERMAN} "misc\dialogs\modern_headerbmpge.exe"
Quote:
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "misc\images\header.bmp"
!define MUI_UI_HEADERIMAGE "$(HEADER_IMAGE)"
!define MUI_ABORTWARNING
Error: Can't open "$(HEADER_IMAGE)"!
Error in macro MUI_INTERFACE on macroline 57
Error in macro MUI_PAGE_INIT on macroline 7
Error in macro MUI_PAGE_LICENSE on macroline 5
Error in script "F:\new system\Setup.nsi" on line 97 -- aborting creation process
:cry::cry::cry::cry::cry::cry::lock:
|
didava
1st September 2013 23:51 UTC
LangString HEADER_IMAGE${LANG_ENGLISH} "misc\images\ENheader.bmp"
LangString HEADER_IMAGE ${LANG_GERMAN} "misc\images\geheader.bmp"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "$(HEADER_IMAGE)"
:mad::mad:
I do not know
Somebody could help
Make an example?
T.Slappy
2nd September 2013 08:45 UTC
I think paths to your images are wrong.
The language is not initialized on .onInit, chcek the language immediately after .onInit function finishes.