Archive: Problem with language


Problem with language
  Hello everybody,

I start build my install program and I have little problem when i want add language. I have message that I must put UMUI_MULTILANG_GET. So I add this value after another function, but now I have error that I have two the same Function .onInit Can someone help me? I change value to !system 'echo but not work ;/

Ps. Can I add registry option which find add and next time find key language?

Regards,
Lukas

;NSIS Ultra Modern User Interface
;Basic Example Script
;Originally Written by Joost Verburg
;--------------------------------

!system 'echo !insertmacro UMUI_MULTILANG_GET > $%TEMP%\descs.nsh'

Name "AdvSplash.dll test"

OutFile "AdvSplash Test.exe"

XPStyle on

Function .onInit
# the plugins dir is automatically deleted when the installer exits
InitPluginsDir
File /oname=$PLUGINSDIR\splash.bmp "c:\screen1600.bmp"
#optional
#File /oname=$PLUGINSDIR\splash.wav "C:\myprog\sound.wav"

advsplash::show 2500 600 400 -1 $PLUGINSDIR\splash

Pop $0 ; $0 has '1' if the user closed the splash screen early,
; '0' if everything closed normally, and '-1' if some error occurred.

Delete $PLUGINSDIR\splash.bmp
FunctionEnd



Section
SectionEnd
;--------------------------------
;General

;Name and file
Name "Test"
OutFile "1_test.exe"
!define PRODUCT_VERSION "1.0"
!define PRODUCT_PUBLISHER "Lukas"
!define PRODUCT_WEB_SITE "http://www."


;Default installation folder
InstallDir "c:\Game\"

;Get installation folder from registry if available
InstallDirRegKey HKLM "Software\Game\Lukas" "Install Dir"


;--------------------------------
;Include ******odernUI

!include "UMUI.nsh"
; !include "MUIEx.nsh"

;--------------------------------
;Interface Settings

!define UMUI_SKIN "gray2"
!define UMUI_BGSKIN "blue"

!define UMUI_USE_INSTALLOPTIONSEX

!define MUI_ABORTWARNING
!define MUI_UNABORTWARNING

!define UMUI_PAGEBGIMAGE
!define UMUI_UNPAGEBGIMAGE

;--------------------------------
;Pages

!insertmacro UMUI_PAGE_MULTILANGUAGE
!insertmacro MUI_PAGE_WELCOME
!define UMUI_INFORMATIONPAGE_USE_RICHTEXTFORMAT
!insertmacro UMUI_PAGE_INFORMATION "${NSISDIR}\Docs\******odernUI\new1045.txt"
; !insertmacro UMUI_PAGE_INFORMATION "${NSISDIR}\Docs\******odernUI\License.txt"
!insertmacro MUI_PAGE_LICENSE "c:\Licencja.txt"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_PAGE_INSTFILES


;--------------------------------
;Languages

; first language is the default language if the system language is not in this list
!insertmacro MUI_LANGUAGE "English"

; Other UMUI translated languages
!insertmacro MUI_LANGUAGE "Polish"

;--------------------------------
;Installer Sections

Section "Dummy Section" SecDummy

SetOutPath "$INSTDIR"

;ADD YOUR OWN FILES HERE...

;Store installation folder
WriteRegStr HKCU "Software\Modern UI Test" "" $INSTDIR

;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"

SectionEnd

;--------------------------------
;Descriptions

LangString FILE ${LANG_ENGLISH} "English.txt"
LangString FILE ${LANG_Polish} "Polish.txt"
!insertmacro UMUI_PAGE_INFORMATION "${FILE}"

;--------------------------------
;Uninstaller Section

Section "Uninstall"

;ADD YOUR OWN FILES HERE...

Delete "$INSTDIR\Uninstall.exe"

RMDir "$INSTDIR"

DeleteRegKey /ifempty HKCU "Software\Modern UI Test"

SectionEnd

Someone explain me how I can add two function .onInit ?


Instead of starting with Ultra Modern UI, just use MUI2. UMUI is not official and therefore you're not as likely to get help for it.

As for your question, UMUI probably uses .onInit internally, so you need to find a !define that lets you specify your own .onInit function (i.e. MUI has a MUI_CUSTOMFUNCTION_GUIINIT define to specify your own .onGUIInit function).

Also in future please post scripts as file attachments or use pastebin.

Stu


Hi,

I change system to MUI2 and try usage MUI_CUSTOMFUNCTION_GUIINIT but still have error ;/ What I doing wrong someone tell me?


... you didn't attach your MUI2 version.

Line 6, change

Function .onGUIInit 

>
to (example)

myOnGUIInit 

>
Line 48, change

define MUI_CUSTOMFUNCTION_GUIINIT 

>
to

define MUI_CUSTOMFUNCTION_GUIINIT myOnGUIInit 

>
That will allow it to compile. There's still some remaining errors, but you can figure 'm out (or open new threads).

Thanks for help. But when I add


myOnGUIInit

InitPluginsDir
File/oname=$PLUGINSDIRsplash.bmp "c:\wgp1600.bmp"

advsplash::show 2500 600 400 -1 $PLUGINSDIRsplash

Pop$0 ; $0 has '1' if the user closed the splash screen early,
;'0' if everything closed normally, and '-1' if some error occurred.

Delete $PLUGINSDIRsplash.bmp
FunctionEnd
>
This splash show me in the frame. So I change myOnGUIInit to .onInit and give

myOnGUIInit

!insertmacro UMUI_MULTILANG_GET
FunctionEnd
>
But when I select change language " English" I still have the same (Polish)

not sure what problem you're seeing..

When I run the installer, I first get an English UI. Clicking through that shows English for all other pages as well. If I change to Polish on the first page, all the other pages are Polish. Were you expecting the language selection page itself to change immediately after selecting a different language?


Yes work when I set function onInit for UMUI_MULTILANG_GET but splash have frame. When I give
Function myOnGUIInit
!insertmacro UMUI_MULTILANG_GET
FunctionEnd

I can't change language. So can I delete frame when the splash start or can I change some value to change languages with function myOnGUIInit. Sorry for problems


ahhhh now I understand. Yes - simply move the Splash code to .onInit, -before- UMUI_MULTILANG_GET.

So...


insertmacro UMUI_MULTILANG_GET
FunctionEnd
>

myOnGUIInit 

>
can be removed entirely, unless you have something else you'd want to initialize at GUI init.

and

define MUI_CUSTOMFUNCTION_GUIINIT myOnGUIInit 

>
should be removed as well.

Keep in mind that if you plan on supporting a silent installer, you should make sure that splash does -not- show up when running silent.

When I do what you say i have error "Delete: "!insertmacro: macro named "UMUI_MULTILANG_GET" not found!".

Ps. Silent running? Can you explain me.


not sure what edit you made.. I'm attaching my version.

"silent" meaning that the user never gets to see the installer interface.. usually used by administrators or other installers that wrap your installer so that no user interaction is needed. I'm guessing you won't be needing that ;)


Thanks so much for help. But I have another question about some option.

1. I add new function


onInstSuccess

MessageBox MB_OK"Now run another program" IDNO NoReadme
Exec $INSTDIRFile2
.exe ; open link
NoReadme:
FunctionEnd
>
Can I add this text with other language and when installer check version automatic give this text with language what he select?

2. I want add new command Get File Version. I read about this option on the forum and wiki documentation but example is not good. I don't know how doing something like this.

When installer start check file GetFileVersion "${INSTDIR\Baza.exe}".
If this file don't have version 1.0.0.2 he give message: "You must install..."
But when every thing is ok he run

Ps. You've guessed right I don't want silent install ;)

Originally posted by need_a_help
1. I add new function

onInstSuccess

MessageBox MB_OK"Now run another program" IDNO NoReadme
Exec $INSTDIRFile2
.exe ; open link
NoReadme:
FunctionEnd
>
Can I add this text with other language and when installer check version automatic give this text with language what he select?
Yes.. use LangString:
e.g.

LangString runAnotherProgram ${LANG_ENGLISH} "Now run another program"

>LangString runAnotherProgram ${LANG_GERMAN} "Jetzt ein anderes Programm ausführen"
Then replace...
MessageBox MB_OK"Now run another program" IDNO NoReadme 

>
...with...

MessageBox MB_OK "$(runAnotherProgram)" IDNO NoReadme 

>
note that langstring defines use parentheses (), nor curly braces {} like regular defines.


Originally posted by need_a_help
2. I want add new command Get File Version. I read about this option on the forum and wiki documentation but example is not good.
Not sure what's in the wiki - but read the one in your NSIS documentation instead:
E.1.8 GetFileVersion

Basically:

/* contains ${GetFileVersion} */


>***91;...***93;

${
GetFileVersion} "$INSTDIR\Baza.exe" $0
>/* $0 now contains the file version in #.#.#.# format */
Originally posted by need_a_help
If this file don't have version 1.0.0.2 he give message
For that, you can then use ${VersionCompare}:
!include "FileFunc.nsh"

>!include "WordFunc.nsh" /* contains ${VersionCompare} */
>***91;...***93;

${GetFileVersion} "$INSTDIR\Baza.exe" $0
>${VersionCompare} "$0" "1.0.0.2" $1
>/*
$1 now contains one of:
1: Existing $INSTDIR\Baza.exe version is HIGHER than 1.0.0.2
2: Existing $INSTDIR\Baza.exe version is LOWER than 1.0.0.2
0: Existing $INSTDIR\Baza.exe version IS 1.0.0.2
*/

I add other languages how you write and everything is ok. But still have problem with get file version. I copy your code and paste to my file and compilation ( any errors and warnings) but when I lunch installation nothing happens.

Section

>!include "FileFunc.nsh" /* contains ${GetFileVersion} */

>${GetFileVersion} "$INSTDIR\Baza.exe" $0
>/* $0 now contains the file version in #.#.#.# format */

>!include "FileFunc.nsh"
>!include "WordFunc.nsh" /* contains ${VersionCompare} */

>${GetFileVersion} "$INSTDIR\Baza.exe" $0
>${VersionCompare} "$0" "1.0.0.2" $1
>/*
$1 now contains one of:
1: Existing $INSTDIR\Baza.exe version is HIGHER than 1.0.0.2
2: Existing $INSTDIR\Baza.exe version is LOWER than 1.0.0.2
0: Existing $INSTDIR\Baza.exe version IS 1.0.0.2
*/
>SectionEnd
>
Thanks for patience ;)

well the code was only to show you how you might check the version - you still have to add code based on the last comments to actually -do- something :)


Hi I do and everything work good but I have one question ;p When version is higher I add message Currently you have a higher version which could cause problems with patch. Do you want to proceed anyway?

MessageBox MB_YESNO '$(Message1)'/SD IDNO
Abort


And if I click in the installer "Yes" I have abort installation.

Thanks for help :)


Originally posted by need_a_help
MessageBox MB_YESNO '$(Message1)'/SD IDNO
Abort


And if I click in the installer "Yes" I have abort installation.
the /SD flag sets the Silent Default option. What you want is something like:


MessageBox MB_YESNO|MB_ICONQUESTION "Continue?" IDYES _yes

/* IDNO assumed here, as that's the only other option */
Abort /* abort installation */

>_yes:
>/* continue with installation */

Hi everything right now is ok :) But I forgot ask you about one option
1. In the install system I use UMUI_PARAMS_REGISTRY_KEY, this key give my parameters $INSTDIR. Can I change him after choose language? e.g. I want install file baza.exe to: my documents\my games\Polish name (key give me only information about my documents so I must add $INSTDIR\my games\Polish name) but when i select english I want install this same file to $INSTDIR\my games\English name . How I can do this?