I have in .onInit to do different checks and in case smth fails I have to show MsgBoxes in the specific language. For this I do the ${Switch} $LANGUAGE trick. So I have several times the same code, for instance:
and
${Switch} $LANGUAGE
${Case} ${LANG_ENGLISH}
StrCpy $msg "${OLDER_VERSION_ALREADY_INSTALLED_ENGLISH}"
${Break}
${Case} ${LANG_FRENCH}
StrCpy $msg "${OLDER_VERSION_ALREADY_INSTALLED_FRENCH}"
${Break}
${Default} ; if we forget one language, show the english msgbox
StrCpy $msg "${OLDER_VERSION_ALREADY_INSTALLED_ENGLISH}"
${Break}
${EndSwitch}
and so on.
${Switch} $LANGUAGE
${Case} ${LANG_ENGLISH}
StrCpy $msg "${NEED_TO_BE_ADMIN_LANG_ENGLISH}"
${Break}
${Case} ${LANG_FRENCH}
StrCpy $msg "${NEED_TO_BE_ADMIN_LANG_FRENCH}"
${Break}
${Default} ; if we forget one language, show the english msgbox
StrCpy $msg "${NEED_TO_BE_ADMIN_LANG_ENGLISH}"
${Break}
${EndSwitch}
Those chunks of code look the same with the exception of the define which are in the above sample: OLDER_VERSION_ALREADY_INSTALLED_ENGLISH, OLDER_VERSION_ALREADY_INSTALLED_FRENCH, NEED_TO_BE_ADMIN_LANG_ENGLISH, NEED_TO_BE_ADMIN_LANG_FRENCH
Is there a way to create smth like a function and as a parameter to pass for instance OLDER_VERSION_ALREADY_INSTALLED_ or NEED_TO_BE_ADMIN_LANG_ so that I don't have the same code written over and over again? (and in this way for a new language I just have to add one line in the function not to change in each piece of code)
Thx,
Viv