Skip to content
⌘ NSIS Forum Archive

Language files and script sample

9 posts

coco_vc#

Language files and script sample

Hi all,

I am not sure if I have to provide the language files saved with the correct codepage (as seems to be the ones from C:\Program Files\NSIS\Contrib\Modern UI\Language files) or is it ok if I provide just an UTF-8 file.

In order to test this I tried to use the C:\Program Files\NSIS\Contrib\Modern UI\Language files\Arabic.nsh as this one is supposed to be saved in the correct form.

So steps I did:

- Create a very simple installer


...
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "Arabic"
!include "Arabic.nsh"
...
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY

StrCpy $msg "${MUI_TEXT_LICENSE_TITLE}"
MessageBox MB_ICONEXCLAMATION|MB_OK "$msg"
FunctionEnd
- and as I couldn't use the Arabic.nsh as it's by default provided, I opened it with VC++ editor, deleted all the lines except:


!define MUI_TEXT_LICENSE_TITLE "إتفاقية‏ الترخيص"
and then just save it.

Problem is, when I run the installer I am not able to see the right chars. All I see are "monkeys". Please see the attached files: momo.nsi and Arabic.nsh.

Questions:
1) Can you pls tell me what am I doing wrong above?
2) Can smbd pls give me an arabic.nsh with just one correct define?
3) Once I have the above I'll keep trying, with and without UTF-8, but still I can ask: can I provide the language files saved in UTF-8 format? or do I have to provide the file in the correct codepage? (pls note that I'm not familiar with codepage and languages)

Thx,
Viv
coco_vc#
I will attach to this reply the Arabic.nsh file for the sample I wrote in the above entry.

Thx,
Viv
coco_vc#
Seems I am really lost. I tried the sample written in my first entry, and not only my custom string looks fishy, but also the NSIS default dialogs look weird.

I have the right languages installed (Arabic) so I really don't understand what's the issue.

Please see in the attached file:
- the script I was playing with
- that I have the right language installed
- how the NSIS built-in dialog in Arabic looks on my system (I have Win 2000 English installed).

Can someone pls tell me what am I doing wrong?

Thx,
Viv
coco_vc#
OK, after trying everything around I finally got the point so I will post the answers to my own questions:

1) In order to see NSIS Arabic dialogs it's needed to set the corect codepage (on Win 2000: Settings -> Control Panel -> Regional Options -> Set Default -> choose an Arabic). Once this is set I can see correct both: my dialog and the NSIS dialogs.

2) My second post contains a correct Arabic.nsh with only one define.

3) No, using utf-8 language files won't work. The language files _have_ to be saved with the correct codepage. iconv is a tool that can be used for this.

If the above is not OK pls correct me.

Thx,
Viv
kichik#
You're correct. By the way, there's a valid Arabic NSH file in Contrib\Modern UI\Languge files\Arabic.nsh.
coco_vc#
Thx kichik for the answer, but as I wrote above that Arabic.nsh file couldn't just be added to a project as contains more than just some defines, this is why out of that file I was trying to create a small version with only one define.

Viv
coco_vc#
One more question related to the language subject: is there a way to prevent the user to choose a language for the installer that is not supported by the current codepage? I mean let's say I have in my installer the following languages: english, german, arabic, so when a user starts the installer he can select any of these 3 languages regardless of it's codepage. So if the user has an english system and he chooses arabic he will see just "monkeys". Can I somehow make so that in the language-dialog-selection are shown only the languages that fit the codepage of the user? (in the sample above to show english and german and not also arabic)

Thx,
Viv
kichik#
You can call GetACP using the System plug-in and compare the result to that of the languages. You can then push to LangDLL just the supported languages.
coco_vc#
Wouldn't it be a decent requirement for some feature version of NSIS this to be somehow done by default? I mean doesn't make any sense on an english codepage to even let the user choose arabic. He'll just complain afterwards 🙂

Viv