Archive: Using translated message in .onInit


Using translated message in .onInit
Hi,

I want have an english and frensh version for my installer, so do do that I use LangString for example:

# Language Selection Dialog Settings
!define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"

#Always show the language selection dialog, even if a language has been stored in the registry.
#The language stored in the registry will be selected by default.
!define MUI_LANGDLL_ALWAYSSHOW

# Language files
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "French"

LangString message ${LANG_ENGLISH} "English message"
LangString message ${LANG_FRENCH} "message en français"



I want to use $(message) in function .onInit (but this don't work)
so what can I do

other question:
I use

File /r "source_data\*.*"
to adds file(s) output path ($INSTDIR).

how can i delete installed files from $INSTDIR?

Doesn't work in what way? You can use it in .oninit, I do in mine, and before you ask the user what language they want ( !insertmacro MUI_LANGDLL_DISPLAY ) it depends on the locale of the Windows installation. I tested for example with a German version of XP, before the selection dialogue it displays German message.

To delete a file is Delete, simple enough.


function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
MessageBox MB_OK "$(message)"
FunctionEnd


I select english language but the message is always shown in frensh (because i use frensh verion of XP)

and I want to list autaumatically installed files before deleting them without using delete "fileName" for every file

You cannot use language strings in .onInit, only after; e.g. you can use them in .onGUIInit (!define MUI_CUSTOMFUNCTION_GUIINIT myOnGUIInit) or in your first page's PRE function.

To generate a list of files to delete you can write a script to do it or write an NSIS executable to do it. Run it with !system then !include its output file.

Stu