Old 5th February 2008, 15:18   #1
robbynaze
Junior Member
 
Join Date: Feb 2008
Posts: 5
Unhappy Section text unchanged (MUI/.onInit)

Hi all, i would need a little help for a problem i could not find a response despite search

briefly, im trying to change Section title dynamically (calling function in .oninit) in MUI interface, using this syntax:

SectionSetText ${_section_X} "$(XTitle)"

where XTitle is define in langstring external file as:
LangString XTitle ${LANG_GERMAN} "XGerman"
LangString XTitle ${LANG_FRENCH} "XFrench"


Actually i've defined all sections titles that way, and their title is changing correctly with selected language except the one that i am trying to change dynamically at runtime

Sections are all defined that way
Section "$(XTitle)" _section_X

> is there an order in .onInit to respect for calling my function and !insertmacro MUI_LANGDLL_DISPLAY (if concerned ?)

In fact, the section text is always the last language in alphabetic order of language selection box (in my example, it is always XFrench, even when i choose German)

Thx for tips !
robbynaze is offline   Reply With Quote
Old 5th February 2008, 16:57   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Languages are not initialised until after .onInit. Do language strings not work in section names?

Stu
Afrow UK is offline   Reply With Quote
Old 6th February 2008, 07:11   #3
robbynaze
Junior Member
 
Join Date: Feb 2008
Posts: 5
They do work in section names for 'static' sections
To be more explicit, this an example

In langstring.nsh i declare:
LangString XTitle ${LANG_GERMAN} "XGerman"
LangString XTitle ${LANG_FRENCH} "XFrench"
LangString YTitle ${LANG_GERMAN} "YGerman"
LangString YTitle ${LANG_FRENCH} "YFrench"


In main script file i have:
; Languages
!insertmacro MUI_LANGUAGE "German"
!insertmacro MUI_LANGUAGE "French"

; Language translations
!insertmacro MUI_RESERVEFILE_LANGDLL
!include ".\langstrings.nsh"

....

Section "$(XTitle)" _section_X
...

Section "$(YTitle)" _section_Y
...

Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
;SectionSetText ${_section_X} "$(XTitle) XXXXX"
FunctionEnd



--> Ytitle is correctly translated, i have "YGerman" or "YFrench" when i choose German or French

--> XTitle is ALWAYS "XFrench XXXXX" whenever i choose German or French !


if any idea ...
robbynaze is offline   Reply With Quote
Old 6th February 2008, 12:34   #4
robbynaze
Junior Member
 
Join Date: Feb 2008
Posts: 5
thx 4 answer Afro, you right

LangString:
"If you change the language in the .onInit function, note that language strings in .onInit will still use the detected language based on the user's default Windows language, because the language is initialized after .onInit."

Need to find a solution now :P
robbynaze is offline   Reply With Quote
Old 6th February 2008, 13:13   #5
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Anywhere before you show the components page will be fine. .onGUIInit is a start (MUI_CUSTOMFUNCTION_GUIINIT for Modern UI).

Stu
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump