Archive: Multilingual custom text


Multilingual custom text
I have setup some custom text for various pages of the installer.

I want to use more languages in the installer.
I know it will translate the default text fine, but not the custom text.

How do I make custom text for different languages?

I have this:

!define MUI_WELCOMEPAGE_TEXT "Some text... bla bla"

I want this for french, german, etc.


How do I do it?

use LangString, take NSIS\Examples\languages.nsi as example


This works for ModernUI too?


So I just use this:

LangString Name ${LANG_FRENCH} "French"


Nothing else needed?

and

!define MUI_WELCOMEPAGE_TEXT "$(Name)"

OK, So I used this:

LangString Name ${LANG_FRENCH} "English"
!define MUI_WELCOMEPAGE_TEXT "English text, bla bla!"

LangString Name ${LANG_FRENCH} "French"
!define MUI_WELCOMEPAGE_TEXT "French text, bla bla!"

Added this:

!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "French"

And it gives me an error:

!define: "MUI_WELCOMEPAGE_TEXT" already defined!
Is it all wrong?
Can someone help?

Try this:

!define MUI_WELCOMEPAGE_TEXT "$(MyWelcomeText)"
!insertmacro MUI_PAGE_WELCOME

...
...

!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "French"

...
...

LangString MyWelcomeText ${LANG_ENGLISH} "English text, bla bla!"
LangString MyWelcomeText ${LANG_FRENCH} "French text, bla bla!"


Any special order this must be in?

Gives no errors but doesn't give a language choice at start...
I put all functions you gave me...


My example uses the correct order.

If you want to select the language, use "!insertmacro MUI_LANGDLL_DISPLAY" in .onInit.

Have a look at the MultiLanguage.nsi script in the Examples\Modern UI\ folder.


Says:

unknown variable/constant "{MUI_LANGDLL_PUSHLIST}" detected, ignoring (macro:MUI_LANGDLL_DISPLAY:24)

!?

I put everything in correct order...


I put everything in correct order...
The error message you got means you have not got everything in the correct order.

As I said earlier, look at the MultiLanguage.nsi script - look at where the .onInit function appears and then look at where it appears in your script.

If .onInit is in the wrong place, you'll get the "unknown variable/constant "{MUI_LANGDLL_PUSHLIST}" detected" error message.

The MUI ReadMe gives step-by-step instructions explaining how to use MUI but I don't think it stresses that the order in the ReadMe is the order you should use in your script.

The MUI ReadMe can seem a bit complicated so you may need to read it more than once (I've lost count of the number of times I've read it - I always seem to find something new every time I read it).

Ok, so I got it without errors but the french text doesn't appear...

I tried using this:
LangString MyWelcomeText ${LANG_FRENCH} "French text, bla bla!"

or

LangString MUI_WELCOMEPAGE_TITLE ${LANG_FRENCH} "French text, bla bla!"

But it didn't work.
I know I'm annoying but please help me on this. :D


It is hard to guess what you're doing wrong ;)

Here is a very simple script based upon my earlier examples - this lets you change the language used on the Welcome page.

; A tiny multi-language MUI demo

!include "MUI.nsh"

Name "Tiny ML Demo"
OutFile "ml-demo.exe"

!define MUI_WELCOMEPAGE_TEXT "$(MyWelcomeText)"

!insertmacro MUI_PAGE_WELCOME

!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "French"

LangString MyWelcomeText ${LANG_ENGLISH} "English text, bla bla!"
LangString MyWelcomeText ${LANG_FRENCH} "French text, bla bla!"

!insertmacro MUI_RESERVEFILE_LANGDLL

Section "Dummy Section" SecDummy
; dummy section to keep compiler happy
SectionEnd

Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd

; end of demo

Thank you!
I got it working now! :D

A few more things...
The uninstaller didn't give a language choice? It was in English.
How do I make the installer remember the language selected and then use it in the uninstaller?

What about the DirText and the license,
how do I set them up for every language?
Tried with the same stuff, but failed.


Look at the MultiLanguage.nsi script in the "Examples\Modern UI" folder and read the MUI ReadMe.

The MultiLanguage.nsi script creates a simple installer that shows how to:

(1) use different languages in the uninstaller
(2) remember the language choice and use it the next time the installer is run
(3) remember the language choice and use it for the uninstaller

The MUI ReadMe might look complicated but it is made up of lots of small sections dealing with the many features of the MUI.

If you use the MUI ReadMe and look at the MUI example scripts supplied with NSIS you will soon learn how to do lots of things with the MUI.

Searching the forum can find answers to many common questions - for example there was a thread discussing how to use different languages for the License page a few weeks ago.


Yeah, the MUI ReadMe helped ALOT but not these functions, so that's why I'm asking this.

I figured out how to remember the language...


What I need help for is:

Setting up the language for the uninstaller. I used:
!insertmacro MUI_UNGETLANGUAGE
But it gave me errors.

Setting up the DirText in different languages.


Sorry for bothering, but I really need help. :)