Multiple language support
Please let our ADS show!
This sites offers only FREE software and it's supported by a few advertisement boxes (no intrusive popups).
Please:
- disable your AdBlocker by adding CoolSoft website to whitelist
- give the proper cookie consent
- enable JavaScript for this website
This seconds wait is to let you update your browser configuration...
Ok, I've done the required changes... now show me your content!- Jeffio
- Anonymous user
- coolsoft
- Posts: 1972
- Joined: 25 Mar 2012 - 01:19
I'll ask the community to help me in IDE translation, but only when the first 1.x version will be released.
Things are changing day by day, so a translation could become quickly unuseful now.
Stay tuned
- loverkraft
- Anonymous user
I think the request is refering to support multiple languages in edited dialog texts, not in the designer UI...
- coolsoft
- Posts: 1972
- Joined: 25 Mar 2012 - 01:19
Oops, I haven't thougth it ;)
How should the language strings be generated into .nsdinc file?
Could you send me a sample script?
- loverkraft
- Anonymous user
I'm just beginning to play with NSIS installer. I've currently supported the multilanguage feature this way:
!define MUI_LANGDLL_ALLLANGUAGES !insertmacro MUI_LANGUAGE "English" !insertmacro MUI_LANGUAGE "Spanish" !insertmacro MUI_RESERVEFILE_LANGDLL !include "resources\english.lang" !include "resources\spanish.lang"
where the resource files contain string defintions for each supported language, like this
; resources\english.lang LangString TextDirectoryTitle ${LANG_ENGLISH} "Installation folder" LangString TextDirectorySubtitle ${LANG_ENGLISH} "Select the installation folder." ; resources\spanish.lang LangString TextDirectoryTitle ${LANG_SPANISH} "Directorio de instalación" LangString TextDirectorySubtitle ${LANG_SPANISH} "Seleccione el directorio de instalación."
Then, when I need to use the strings in the pages, I do this:
!define MUI_PAGE_HEADER_TEXT "$(TextDirectoryTitle)" !define MUI_PAGE_HEADER_SUBTEXT "$(TextDirectorySubtitle)" !define MUI_PAGE_CUSTOMFUNCTION_PRE DirectoryPre !insertmacro MUI_PAGE_DIRECTORY
But now I need to define a custom dialog with my own settings. First I've tried to define the dialog in a .ini file with HM NIS Editor. The .ini file looks like this:
[Settings] NumFields=9 Title=Application Settings ... [Field 9] Type=Checkbox Text=Run Application on Windows Startup State=0 Left=20 Right=180 Top=20 Bottom=31
HM NIS Editor hasn't multilanguage support, but this issue can be solved when using the dialog, re-writing the Text field:
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "appSettings.ini" ;... !insertmacro MUI_INSTALLOPTIONS_WRITE "appSettings.ini" "Field 9" "Text" "$(TextRunOnStartup)" !insertmacro MUI_INSTALLOPTIONS_DISPLAY "appSettings.ini"
As the InstallOptions plug-in with .ini files is deprecated, now the way to make custom dialogs is nsDialogs plug-in. And I've found NSIS Dialog Designer. It's great and easy to use, but doesn't support multilanguage. The only way I see now to redefine texts in another language is to edit manually the .nsdinc file and replace the texts by variable names:
; === CheckBox7 (type: Checkbox) === ${NSD_CreateCheckbox} 18 31 244 25 "Run Application on Windows Startup" Pop $hCtl_UpdaterAppSettings_CheckBox7
replace it with:
; === CheckBox7 (type: Checkbox) === ${NSD_CreateCheckbox} 18 31 244 25 "$(TextRunOnStartup)" Pop $hCtl_UpdaterAppSettings_CheckBox7
This is quite heavy work! It would be great if, at least, all the Text strings where stored in a separated resource file. So, I'll only have to translate the file and include it, without having to modify the script code itself.
- loverkraft
- Anonymous user
Referring to my previous post with my problems with custom multilanguage forms, I've found a little workaround that works for me with my current NSIS scripts. Let's remember. I had implemented the multilanguage feature this way:
!define MUI_LANGDLL_ALLLANGUAGES !insertmacro MUI_LANGUAGE "English" !insertmacro MUI_LANGUAGE "Spanish" !insertmacro MUI_RESERVEFILE_LANGDLL !include "resources\english.lang" !include "resources\spanish.lang"
where the resource files contained string definitions for each supported language, like this
; resources\english.lang LangString TextDirectoryTitle ${LANG_ENGLISH} "Installation folder" LangString TextDirectorySubtitle ${LANG_ENGLISH} "Select the installation folder." ; resources\spanish.lang LangString TextDirectoryTitle ${LANG_SPANISH} "Directorio de instalacion" LangString TextDirectorySubtitle ${LANG_SPANISH} "Seleccione el directorio de instalacion."
Now, I edit my dialog with NSIS Dialog Designer, putting variable references instead of text in the Text field of the control properties. That is, I put "$(TextDirectoryTitle)" instead of "Installation folder". And it works.
- coolsoft
- Posts: 1972
- Joined: 25 Mar 2012 - 01:19
@loverkraft
Reading official documentation here: http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.15
it seems that your "workaround" is the best way to create a multilanguage setup, and it's compatible with NSISDialogDesigner too.
So I think NSISDialogDesigner should not be changed at all...
Navigazione
Login
Clicca qui per supportare il mio lavoro con PayPal
oppure offrimi un caffè