Archive: Language selection dialog localization


Language selection dialog localization
Hello,

What is the mechanism to have

MUI_LANGDLL_INFO
MUI_LANGDLL_DISPLAY

localized ?

I've tried to put localization strings in french and english nsh files, but got an error (already defined).

Currently, I use a tricky strcompare in onInit function to do it...

Thanks,

BB


Use a LangString (see users manual).


Hello,

I realize I've not properly explained my question.

I wanted to know how i can add these entries in language files, to have automatic localization.

BB


You would have to modify System.nsh.

Why do you want to use localised text when the user has not even selected a language yet?


Hello,

I simply want the language selection dialog to use the machine language.

For instance, on a french machine, the language selection dialog will be displayed in french, and the user can then select English to install with the english language.

Curently, I use this code, which properly works. (only two languages, French and English):

Function .onInit
StrCmp $LANGUAGE ${LANG_FRENCH} french english
french:
StrCpy $R0 "Choisissez la langue du programme d'installation"
StrCpy $R1 "Langue d'installation"
Goto end
english:
StrCpy $R0 "Please select the language of the installer"
StrCpy $R1 "Install language"
end:
!Define MUI_LANGDLL_WINDOWTITLE $R1
!Define MUI_LANGDLL_INFO $R0
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd

BB


This is way easier:


LangString LangDialog_Title ${LANG_ENGLISH}" "Installer Language"
LangString LangDialog_Title ${LANG_FRENCH}" "Langue d'installation"

LangString LangDialog_Text ${LANG_ENGLISH}" "Please select the installer language."
LangString LangDialog_Text ${LANG_FRENCH}" "Choisissez la langue du programme d'installation."

!define MUI_LANGDLL_WINDOWTITLE "$(LangDialog_Title)"
!define MUI_LANGDLL_INFO "$(LangDialog_Text)"

Hello,

Thank you.

I had already tried this, but put it before the language declarations.

It works now.

BB


Hello,

After sucessfully localized the title and the text of the language selection dialog with your active and useful support, it remained to localize the "Cancel" button.

It needed to make a minor change to LangDLL, but I wanted this change absolutely don't need any change in the parameter chain of LangDLL and, of course, in any other NSIS file (1).

To do this (2) I added the cancel button text at the end of the MUI_LANGDLL_WINDOWTITLE like this :
"Installer Language|$(^CancelBtn)"
(which is not an innovation as Microsoft uses commonly this character as strings separator).

In the langdialog procedure, I check the "|" character and, if present, load the remaining text in a g_BtnText variable.

In the dialogproc procedure, if g_btnText length is not null, I send the text to the control SetDlgItemText(hwndDlg, IDCANCEL, g_btntext);

BB

(1) In fact, there is another change to do, help have to mention the availability of the Cancel button customization !

(2) In Delphi port of LangDLL. Unfortunately, I dont program in C, but i can give the code to anyone want to report the change in the original c code for the NSIS "non english speaking" community.


I would vote for having this in the "official" NSIS dist as well! I come from a background of using Wise Installation System on my "9-to-5 job" and it's capable of this as well! (and I used it in all our products)

Cheers,
-Sören

OT: Btw. while Wise is/was already way better (imho) than InstallShield (because it's installers worked very similar to the NSIS ones) it's great to see that NSIS is even much better than Wise! :-)
And for free! I don't know why Wise & InstallShield keep selling products at all *g* (besides some hm very "obscure"/very big installers in the corporate world where I'm not sure if NSIS could handle them properly - forgive me I'm a newbie ;o)


Hey Conando,

Just another remark to your message, regarding support, which is usually far better here !

In the free software community, it is very current to have a developement team answer in less than one hour, a bug fix in less than one day, and a lot workaround from users if the fix is more tricky need more time to implement.

BB


Thanks for your comments BARRIER.

With this modifications it only supports a bit of localization. I think the version is the NSIS distribtion should be updated when there is full support.

I think the best solution would be displaying texts and button texts in the langauge that is currently selected.

If you can add an option to send texts for every langauge and let LangDLL change the texts when the selection changes, that would be great.


Hello,

Effectively, it should be great, but i only program in Delphi. So, if a C developer want translate the code in C to append to the genuine file...

It also needs to integrate the translated strings in language files to avoid the users to explicitely declare the strings.

BB


If someone adds this feature, I'll let the Modern UI support it.


Hello Joost,

As the dialog procedure belongs to a DLL, we are in a totally independant process a
, we have only access to the data passed during the command line and NSIS only pass in the command line ONE language string for the title and ONE language string for the text.

So, as paradox, it will be quite easy to modify the code in the DLL (process a CBN_SELENDOK WM_COMMAND message), buit we have no different strings to display.

To do so, it will be needed to adopt the process used to pass the language names and codes to the DLL also for the text parameters, but it will not be longer compatible with existing scripts, which is probably not acceptable or rewrite a completely new DLL with a callback which is very tricky (and bug prone !) to do and also need a change in the NSIS GUI systeme code.

It is a limitation due to DLLs and it is also present in otehre installers (IS, Wise, MS).

BB


You can modify LangDLL to accept these texts as parameters for every language.

You don't have to break the current syntax. For example, you can check whether the first parameter (currently the window title) = LANGTEXT and then not get the standard texts but texts for every language.