Archive: Multilanguage header


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.


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...


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...


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)"

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


Thanks for help. Solution is simple as usual. :)


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.


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


SetBrandingImage solves this problem! Now I using LogicLib :)
BIG thanks for support!


Greetings

I've tested this

Does not work

Sample code to write the

Thanks...


Professors ؟؟
I'm waiting ؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟
:cry::cry::cry::cry::cry::cry::cry:

Should I open a new Post


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؟؟


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:




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?

I think paths to your images are wrong.
The language is not initialized on .onInit, chcek the language immediately after .onInit function finishes.