Hello.
I'm looking for a sample of script that help me to modify a current .NSI script based on single language to multi-language regarding
- Section name (multi-language)
- Section description (multi-language)
- Icon link description (multi-language).
I search on different forum but I didn't find it.
This the current file that I developped (but didn't work)
It's the installer script for QEMU
Thanks in advance.
Localization of Section name/description and shortcuts
14 posts
MUI already has a section description example.
What is "icon link description"? A .lnk shortcut comment?
What is "icon link description"? A .lnk shortcut comment?
Hello.
Thanks for quickly reply.
I tried to make it myself but probably there some syntax errors in my script.
Could you please check it and provide me an idea where could be the error?
When you create a program group could be a good idea to have the program description in program group localized.
Ex. If you select English as language for the installer the program description in program group could be
"Uninstall xxx" (xx program name)
and if you select Italian could be
"Disinstalla xxx".
Thanks.
Thanks for quickly reply.
I tried to make it myself but probably there some syntax errors in my script.
Could you please check it and provide me an idea where could be the error?
When you create a program group could be a good idea to have the program description in program group localized.
Ex. If you select English as language for the installer the program description in program group could be
"Uninstall xxx" (xx program name)
and if you select Italian could be
"Disinstalla xxx".
Thanks.
@Anders
Of course I red many web pages and tried to interpreter the explanation but surely I made something wrong.
Of course I red many web pages and tried to interpreter the explanation but surely I made something wrong.
Just to clarify, you are talking about start menu shortcuts here?Originally Posted by bovirus View Post
When you create a program group could be a good idea to have the program description in program group localized.
Ex. If you select English as language for the installer the program description in program group could be
"Uninstall xxx" (xx program name)
and if you select Italian could be
"Disinstalla xxx".
The Windows guidelines say that you should not create links to uninstallers and helpfiles, only your main application.
Yes.
Start menu shorcuts in program group.
Ok for Uninstall/Help.
I think for exmaple to the shortcuts that open program web site.
"Open program web site" (English)
"Apri sito web programma" (Italian)
But my main scope is to localize section name and description (tip) showed during installation".
Start menu shorcuts in program group.
Ok for Uninstall/Help.
I think for exmaple to the shortcuts that open program web site.
"Open program web site" (English)
"Apri sito web programma" (Italian)
But my main scope is to localize section name and description (tip) showed during installation".
!include MUI2.nsh
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE English
!insertmacro MUI_LANGUAGE Swedish
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
Section "$(Sec1Name)" Section1
SectionEnd
Section "$(Sec2Name)" Section2
SectionEnd
LangString Sec1Name ${LANG_ENGLISH} "Section 1"
LangString Sec2Name ${LANG_ENGLISH} "Section 2"
LangString DESC_Section1 ${LANG_ENGLISH} "Description of section 1."
LangString DESC_Section2 ${LANG_ENGLISH} "Description of section 2."
LangString Sec1Name ${LANG_SWEDISH} "Chef"
LangString Sec2Name ${LANG_SWEDISH} "Meatball"
LangString DESC_Section1 ${LANG_SWEDISH} "Bork 1."
LangString DESC_Section2 ${LANG_SWEDISH} "Bork bork 2."
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${Section1} $(DESC_Section1)
!insertmacro MUI_DESCRIPTION_TEXT ${Section2} $(DESC_Section2)
!insertmacro MUI_FUNCTION_DESCRIPTION_END The shortcut guideline applies to internet shortcuts as well.If you want your main application shortcut to be based on a language string things get tricky.
* Option A, delete all possible names:
Store the shortcut name somewhere (.ini or registry) when installing and use that name when uninstalling.
* Option C, shell display names (Vista+):
* Option A, delete all possible names:
!define LNKNAME_ENGLISH "MyApp"
!define LNKNAME_SWEDISH "BorkApp"
LangString LnkName ${LANG_ENGLISH} "${LNKNAME_ENGLISH}"
LangString LnkName ${LANG_SWEDISH} "${LNKNAME_SWEDISH}"
Section
CreateShortcut "$SMPrograms\$(LnkName).lnk" "$InstDir\MyApp.exe"
SectionEnd
Section Uninstall
Delete "$SMPrograms\${LNKNAME_ENGLISH}.lnk"
Delete "$SMPrograms\${LNKNAME_SWEDISH}.lnk"
SectionEnd * Option B, storage:Store the shortcut name somewhere (.ini or registry) when installing and use that name when uninstalling.
* Option C, shell display names (Vista+):
LangString LnkDisplayName ...
Section
WriteIniStr "$SMPrograms\Desktop.ini" "LocalizedFileNames" "MyApp.lnk" "$(LnkDisplayName)"
SetFileAttributes "$SMPrograms\Desktop.ini" SYSTEM|HIDDEN|ARCHIVE
CreateShortcut "$SMPrograms\MyApp.lnk" "$InstDir\MyApp.exe"
SectionEnd
Section Uninstall
Delete "$SMPrograms\MyApp.lnk"
DeleteINIStr "$SMPrograms\Desktop.ini" "LocalizedFileNames" "MyApp.lnk"
SectionEnd @Anders
Thanks a lot for your professional explanation
Can I use also a syntax like
LangString LnkName ${LANG_ENGLISH} "MyApp"
LangString LnkName ${LANG_SWEDISH} "BorkApp"
Section
CreateShortcut "$SMPrograms\$(LnkName).lnk" "$InstDir\MyApp.exe"
SectionEnd
Section Uninstall
Delete "$SMPrograms\$(LnkName).lnk"
SectionEnd
Of course you version is more complete because delete all links in any languages.
In my example uninstall only a link in the same single language.
Thanks a lot for your professional explanation
Can I use also a syntax like
LangString LnkName ${LANG_ENGLISH} "MyApp"
LangString LnkName ${LANG_SWEDISH} "BorkApp"
Section
CreateShortcut "$SMPrograms\$(LnkName).lnk" "$InstDir\MyApp.exe"
SectionEnd
Section Uninstall
Delete "$SMPrograms\$(LnkName).lnk"
SectionEnd
Of course you version is more complete because delete all links in any languages.
In my example uninstall only a link in the same single language.
You can but you need to set the correct language in un.onInit. MUI might do it for you if you are using its registry defines and language macros.
@Anders
Thank a lot for your help.
I completed the script and now it works the mouldes name as multilanguage.
can I define the variable in a external file (one for each language)? Ex.
---- Mainscript
!include installer_english_strings.nsh
!include installer_swedish_strings.nsh
Section
CreateShortcut "$SMPrograms\$(LnkName).lnk" "$InstDir\MyApp.exe"
SectionEnd
Section Uninstall
Delete "$SMPrograms\${LNKNAME_ENGLISH}.lnk"
Delete "$SMPrograms\${LNKNAME_SWEDISH}.lnk"
SectionEnd
------------- File installer_english_strings.nsh
!define LNKNAME_ENGLISH "MyApp"
LangString LnkName ${LANG_ENGLISH} "${LNKNAME_ENGLISH}"
------------- File installer_swedish_strings.nsh
!define LNKNAME_SWEDISH "BorkApp"
LangString LnkName ${LANG_SWEDISH} "${LNKNAME_SWEDISH}"
Thanks.
Thank a lot for your help.
I completed the script and now it works the mouldes name as multilanguage.
can I define the variable in a external file (one for each language)? Ex.
---- Mainscript
!include installer_english_strings.nsh
!include installer_swedish_strings.nsh
Section
CreateShortcut "$SMPrograms\$(LnkName).lnk" "$InstDir\MyApp.exe"
SectionEnd
Section Uninstall
Delete "$SMPrograms\${LNKNAME_ENGLISH}.lnk"
Delete "$SMPrograms\${LNKNAME_SWEDISH}.lnk"
SectionEnd
------------- File installer_english_strings.nsh
!define LNKNAME_ENGLISH "MyApp"
LangString LnkName ${LANG_ENGLISH} "${LNKNAME_ENGLISH}"
------------- File installer_swedish_strings.nsh
!define LNKNAME_SWEDISH "BorkApp"
LangString LnkName ${LANG_SWEDISH} "${LNKNAME_SWEDISH}"
Thanks.
Yes you can do that as long as you put the !include at the correct location in your .NSI. !include is just a copy&paste of text.
Anders
Could be in the same way for Memento section like
${MementoSection} "NppExport" NppExport
Delete "$INSTDIR\plugins\NppExport.dll"
Delete "$INSTDIR\plugins\NppExport\NppExport.dll"
Delete "$PLUGIN_INST_PATH\NppExport\NppExport.dll"
SetOutPath "$PLUGIN_INST_PATH\NppExport"
!ifdef ARCH64
File "..\bin64\plugins\NppExport\NppExport.dll"
!else
File "..\bin\plugins\NppExport\NppExport.dll"
!endif
${MementoSectionEnd}
Thanks.
Could be in the same way for Memento section like
${MementoSection} "NppExport" NppExport
Delete "$INSTDIR\plugins\NppExport.dll"
Delete "$INSTDIR\plugins\NppExport\NppExport.dll"
Delete "$PLUGIN_INST_PATH\NppExport\NppExport.dll"
SetOutPath "$PLUGIN_INST_PATH\NppExport"
!ifdef ARCH64
File "..\bin64\plugins\NppExport\NppExport.dll"
!else
File "..\bin\plugins\NppExport\NppExport.dll"
!endif
${MementoSectionEnd}
Thanks.
Use a langstring like you do with a normal section.