开发者

Specifying non-ASCII characters for NSIS' LangString

开发者 https://www.devze.com 2023-01-24 21:01 出处:网络
I\'m using NSIS to generat开发者_运维百科e a Windows\' installer for my application.I\'d like a multi-lingual installer.I\'m using LangString for specifying strings.

I'm using NSIS to generat开发者_运维百科e a Windows' installer for my application. I'd like a multi-lingual installer. I'm using LangString for specifying strings.

However, the documentation doesn't seem to say how one should encode a non-ASCII character. For example, to use the German word "benötigt" (where the 'o' has an umlaut), how should I encode the ö?


It's just easier to use the Unicode version of NSIS. The entire problem then goes away.


I assume we are talking about the ANSI version of NSIS here...

The 2nd parameter to LangString is the language id (You can generate one with NSIS\Bin\MakeLangId.exe, but since you probably already use the MUI_LANGUAGE macro or LoadLanguageFile, ${LANG_GERMAN} etc will be defined for you)

NSIS does not really care how the string is encoded, but if you have a lot of strings in different languages, it is probably a good idea to put the LangString commands in external files that you can !include. This way you can edit different language files with different codepages and text editors.


If you want to compile the UNICODE strings by the ANSI version of NSIS compiler, then you have to put such strings in separate .nsi file with UCS-2 LE BOM (lookup it with Notepad++) format and directly include that.

I've using particularly english and russian versions of such files at the end of a main.nsi:

!ifdef LANG_ENGLISH
!include "${PROJECT_SRCS_ROOT}\lang_en.nsi"
!endif

!ifdef LANG_RUSSIAN
!include "${PROJECT_SRCS_ROOT}\lang_ru.nsi"
!endif


if you can not use the unicode version of nsis, you could encode your text in latin-1 (ISO 8859-1) which can be used to produce these umlauts as ü,ä,ö

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号