Archive: IO behavior - reset IO ?


IO behavior - reset IO ?
hi

i have a problem i can not explain

i have 3 io.ini depending on the selected language

this is from the english one:

Type=DropList
Text=Select your language
Left=30
Right=130
Top=95
Bottom=108
State=English
ListItems=Deutsch|English|Francais

the other ones has "Deutsch" and "Francais" as default.

if i press "Next" and language was changed i force to reload this pane with the choosen language. if nothing was changed the second pane is shown.

but unfortunately IO.ini saves somehow its state although i think it must be reset on each call.

so when in choose "Deutsch" in the english IO and change back from the german IO to "English" the english IO shows me "Deutsch" again and not the default "English".

so how is that possible - it might be stored in memory !?
And how can reset an IO.ini?

Thx


I am sorry, but I could quite follow. Maybe if you attach the entire thing it will be a bit more clearer.

But why work hard with all this when you can simply use the LangDLL plug-in to have the user choose the language?


@kichik

i can not use any languagefile from NSIS 'cause this is no regular setup - this is a program itself with very specific dialogs. i use my own panes, none of NSIS.

in short:
i have 3 IO.ini's - each has its default settings
each IO remembers it state when re-accessed - but this not useful

so i have to reset each IO when accessed.

is that possible or do i have do set the default manually?


BTW the code snippet


Function selectaction
selectactionstart:
StrCmp $R3 "g" "" start02
!insertmacro MUI_HEADER_TEXT "Wilkommen" "Bitte wählen Sie den gewünschten Vorgang$\nund klicken sie dann auf 'Weiter'."
goto start04
start02:
StrCmp $R3 "f" "" start03
!insertmacro MUI_HEADER_TEXT "Welcome" "Please choose your desired action. Then press 'Next'."
goto start04
start03:
!insertmacro MUI_HEADER_TEXT "Welcome" "Please choose your desired action. Then press 'Next'."

start04:
StrCmp $R4 "0" start04a
BgImage::Sound $PLUGINSDIR\notify1.wav

start04a:
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "$R3menu01.ini"

; read out language
!insertmacro MUI_INSTALLOPTIONS_READ ${TEMP1} "$R3menu01.ini" "Field 6" "State"
StrCmp ${TEMP1} $R2 start05
call langchange
call soundchange
goto selectactionstart

start05:
!insertmacro MUI_INSTALLOPTIONS_READ ${TEMP1} "$R3menu01.ini" "Field 1" "State"
StrCmp ${TEMP1} "1" selectactionend ""
!insertmacro MUI_INSTALLOPTIONS_READ ${TEMP1} "$R3menu01.ini" "Field 2" "State"
StrCmp ${TEMP1} "1" selectactionend ""

StrCmp $R3 "g" "" +3
MessageBox MB_ICONINFORMATION|MB_OK "Sie müssen einen Vorgang auswählen.$\nAnderfalls klicken Sie bitte auf 'Abbrechen'."
Goto selectactionstart
StrCmp $R3 "f" "" +3
MessageBox MB_ICONINFORMATION|MB_OK "You have to choose an action, otherwise 'cancel'"
Goto selectactionstart
MessageBox MB_ICONINFORMATION|MB_OK "You have to choose an action, otherwise 'cancel'"
Goto selectactionstart

selectactionend:
call soundchange
FunctionEnd


PS i am wating for 3rd-party translation in french so this part is english till now too

$R3 contains index for each language
script is fully functional so far

grmpf i did it this way although it is not luckyly solved


Function langchange
;reset IO
StrCmp $R3 "g" "" langchange1
!insertmacro MUI_INSTALLOPTIONS_WRITE "$R3menu01.ini" "Field 6" "State" "Deutsch"
goto langchange3

langchange1:
StrCmp $R3 "f" "" langchange2
!insertmacro MUI_INSTALLOPTIONS_WRITE "$R3menu01.ini" "Field 6" "State" "Francais"
goto langchange3

langchange2:
StrCmp $R3 "e" "" +3
!insertmacro MUI_INSTALLOPTIONS_WRITE "$R3menu01.ini" "Field 6" "State" "Englisch"

...

Even if you're not using NSIS's inner strings it's still so much easier to use NSIS's language system. Just define some LangStrings instead of this.

If you don't want to then I'll still have to see the entire script.


@kichik

pls gimme a hint how to define additional strings - i need about 125 per language ;) (i use so much in version 1 - winbatch coded - different headers & messages)
Strings are now hardcoded - in version 1 this was a external languagefile easily to work on.

maybe i can insert strings onInit? lang file is build like an ini file.


Use language strings (LangString).


thx Joost - i hope i can use combinations like ${$R3message} where $R3 contains the language shortie (e/g/f).
So i can define all strings seperate :)


Example:

LangString "bla" ${LANG_ENGLISH} "some text"
LangString "bla" ${LANG_FRENCH} "some french text"

in your script, use $(bla)