Archive: Display Multiple languages in Message Box


Display Multiple languages in Message Box
I want to display Multiple languages in Message Box based on System default language ,
Is there any way where in I can create a Resource files for each of the language and fetch the text based on
system default language?


Can't you just use a LangString?

Stu


Thanks for ur reply :-)

Yes i could do that but m not able to add Japanese Text into NSIS script file, since NSIS doesnt support UNICODE.Is there any way where in I can add Japanese text int NSIS script file ?


Simply save the file as ANSI. Japanese has a codepage, so Unicode is not required.


saving Japanese text in ANSI
Thanks for ur reply .....
well I tried adding Japanese text in NSIS script file and
saving it in ANSI , later when I opened back the script file
the japanese text had turned to a question mark " ????????"


This is how I add Japanese text

Creating a macro

!macro MACRO_INSTALL_PRODUCT prodname

StrCmp $LANGUAGE ${LANG_ENGLISH} 0 +2

MessageBox MB_OKCANCEL|MB_ICONQUESTION "You are about install ${prodname}. Press OK to continue or CANCEL to exit the installation." IDOK NoAbort

StrCmp $LANGUAGE ${LANG_JAPANESE} 0 +2
MessageBox MB_OK|MB_ICONSTOP 'Japanese text here'

!macroend


call it as follows :

!insertmacro MACRO_INSTALL_PRODUCT ${prodname}


There is no need for that unless you are calling the code in .onInit. As I said, use a LangString:

LangString MsgBoxText ${LANG_ENGLISH} "You are about to install ${prodname}. Press OK to continue or CANCEL to exit the installation."
LangString MsgBoxText ${LANG_ENGLISH} "Japanese text..."

...
MessageBox MB_OKCANCEL|MB_ICONQUESTION $(MsgBoxText) IDOK +2
Abort


Stu

Thanks for ur reply ,But I m calling this MessageBox from
Oninit


ranu_hai, is the Windows you are running set to use the Japanese codepage? Or are you running using another language (i.e. English) as your codepage and using the IME to type Japanese into the script?

There are two things you could try. Using ANSI NSIS:
1. Change your codepage to the language you want to use. For example, if you want to type Japanese text, change your Windows setting to use the Japanese codepage. (Control Panel->Regional and Language Options->Language for non-Unicode programs->Japanese.
2. Reboot.
3. Type your Japanese text in your NSIS script.
4. Save as ANSI.
For each language you want to support, you will need to do this process again. Set the language, reboot, type, save etc. And when you open the file up in a different language, it will look like junk but believe us, it will look right on the right localized Windows.

OR, you can try the Unicode version of NSIS. Look for the thread on the forums and get the files. There is no rebooting involved that one because it supports Unicode.


As for the LangString mechanism ineffective inside .onInit functions, is there any delivery planned to extend LangString abilities everywhere ?

Because it is a bit disappointing to have both a pseudo-global easy-to-maintain multi-languages feature and hard coded management of languages inside some functions.

Gal'


thanks a lot

Setting options in Control Panel -> Regional & Language Options solved my problem .

But still I was not able to implement LangString


If you want to show multilingual messages on installer launch put them in .onGUIInit or in the first page's pre function.

Stu


Many thanks Afrow UK ;)

Gal'


Just one more thing:

I did my customized .onGUIInit function. I can use LangString inside. Good. The first line of my function is

!insertmacro MUI_LANGDLL_DISPLAY


To let the user choose the language. But the language is not taken into account.... so I still have a .onInit which contains this line. Is it normal to have .onGUIInit not able to set the language ?

Thks.

Gal'

Suppose if v select the language( based on system default language),rather then allowing the user ,then will this .onGUIinit works ?


I advise you to declare your language inside .onInit function, either by !insertmacro MUI_LANGDLL_DISPLAY to let the user choose, or setup manually with StrCpy $LANGUAGE whatuwant.

The tricky part is that MessageBoxes generated in .onInit don't take care of the language you setup. So, define your own .onGUIInit function into which you define your MessageBoxes of the primary checks (OS checks, welcome message and so on). Another way is to use the PRE function of the first page instead of re-defining .onGUIInit. Despite of all, the MUY_PAGES won't face any problem to use the right language, and the problem concerns only the MessageBoxes of the .onInit function.

I hope it is clear for you now.

Gal'


Hey Thanks

that solved my problem


Hi jimpark ,
As u said i was able to display Japanese Text by using the steps mentioned i.e Setting options in Control Panel -> Regional & Language Options ...
But when i run the setup in MUI 2000 Server /Professional instead of Japanese text some junk gets displayed ???????

any idea ??? y is this happening


solved my problem by downloading and installing Unicode NSIS from http://www.scratchpaper.com/