- NSIS Discussion
- Display Multiple languages in Message Box
Archive: Display Multiple languages in Message Box
ranu_hai
12th October 2007 11:09 UTC
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?
Afrow UK
12th October 2007 11:48 UTC
Can't you just use a LangString?
Stu
ranu_hai
12th October 2007 11:59 UTC
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 ?
kichik
14th October 2007 22:33 UTC
Simply save the file as ANSI. Japanese has a codepage, so Unicode is not required.
ranu_hai
15th October 2007 05:54 UTC
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 " ????????"
ranu_hai
15th October 2007 06:00 UTC
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}
Afrow UK
15th October 2007 08:42 UTC
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
ranu_hai
15th October 2007 10:02 UTC
Thanks for ur reply ,But I m calling this MessageBox from
Oninit
jimpark
15th October 2007 16:12 UTC
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.
galevsky
16th October 2007 10:32 UTC
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'
ranu_hai
16th October 2007 10:52 UTC
thanks a lot
Setting options in Control Panel -> Regional & Language Options solved my problem .
But still I was not able to implement LangString
Afrow UK
16th October 2007 12:48 UTC
If you want to show multilingual messages on installer launch put them in .onGUIInit or in the first page's pre function.
Stu
galevsky
16th October 2007 13:33 UTC
Many thanks Afrow UK ;)
Gal'
galevsky
16th October 2007 13:52 UTC
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'
ranu_hai
17th October 2007 06:20 UTC
Suppose if v select the language( based on system default language),rather then allowing the user ,then will this .onGUIinit works ?
galevsky
17th October 2007 09:17 UTC
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'
ranu_hai
17th October 2007 10:33 UTC
Hey Thanks
that solved my problem
ranu_hai
17th December 2007 06:54 UTC
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
ranu_hai
17th December 2007 11:00 UTC
solved my problem by downloading and installing Unicode NSIS from http://www.scratchpaper.com/