Archive: How does this macro function??


How does this macro function??
Hi,

I have a code which says: ( abc.nsi)

MessageBox MB_OK "${${LANGUAGE}_setup.23645}"

Here the $LANGUAGE is correctly set to Locale Language. But still the MessageBox shows msg in english only always!
The purpose is to display the MsgBox depending on the Locale language.

Also, i have a header file , say xyz.nsh which has

LangString setup.23645 ${LANGUAGE_CODE} "${${LANGUAGE}_setup.23645}"

Does this affect the first code snippet?? If so how? Im not very clear with the usage and working of LangString. where can i find some examples of using LangString??

Could someone provide some info on this please?

Thanks,
Ramya


Actually the header file, xyz.nsh has the following:

!insertmacro MUI_LANGUAGEFILE_LANGSTRING LANGUAGE setup.23645 "Error Code"
LangString setup.23645 ${LANGUAGE_CODE} "${${LANGUAGE}_setup.23645}"
!ifmacrondef UIMSG_ErrorCode
!macro UIMSG_ErrorCode ARGS
MessageBox ${ARGS} "$(setup.23645)"
!macroend
!endif


Where does ${LANGUAGE} come from? If you are trying to reference $LANGUAGE then you shouldn't use {} and either way you cannot use it ${${LANGUAGE}_setup.23645} unless ${LANGUAGE} is a compile time constant.

Stu


I set $LANGUAGE in .onInit Function

If I dont use {} for $LANGUAGE as in:

MessageBox MB_OK "${${LANGUAGE}_setup.23648}" , then I dont get the actual message.

Let me be clear:

What is expected: The Message box should display "Error Code" in Locale Language.

What Happens:

1. If I give MessageBox MB_OK "${${LANGUAGE}_setup.23648}" ,

I get "Error Code" in English always ( inspite of the $LANGUAGE being set to Locale language)

2. If I give MessageBox MB_OK "${$LANGUAGE_setup.23648}" ,

(i.e without {}) then i get the messagebox showing "1041_samsetup.23648" - Here the macro should have been substituted which prints "Error Code" in Japanese

[1041 = JAPANESE - this is on a JApanese XP machine ]


At compile time ${${LANGUAGE}_setup.23648} will be substituted for the constant value contained in ${LANGUAGE}_setup.23648, i.e.
!define ${LANGUAGE}_setup.23648 "my string"
Therefore, what you are trying to do is logically impossible.
${LANGUAGE} also has to be a compile time constant for this and of course $LANGUAGE is not and it has nothing to do with ${LANGUAGE} even. You should be getting some compiler warnings.

What you could do is have a ${Switch} statement (LogicLib.nsh) to display the correct message for the correct language:
http://forums.winamp.com/showthread.php?postid=2068057

Stu


Oh ok.... thanks a lot for that swift response... I'll look into it...

Kind Regards,
Ramya