Skip to content
⌘ NSIS Forum Archive

Inserting language string

9 posts

bukox#

Inserting language string

Hello.
First, sorry for my English🙂
Second, I tried to find answer by searching but I didnt't find it.
I have problem with using language string in another string.
I put macro:

!insertmacro MUI_LANGUAGE "Polish"

include language file:

!include "installer\pp_polish.nsh"

and try to use it in another string:

File /oname=file.exe "include\file$(^LANG_PREFIX).exe"

but I revieve error that the file notepad2$(^LANG_PREFIX).exe doesn't exists. The file is named filePL.exe and if I insert PL insetad of $(^LANG_PREFIX) eveyrthing work correctly. How can I put language string in another string?

bye...
Afrow UK#
Where did $(^LANG_PREFIX) come from?
$(MyLangString) is created if you use LangString MyLangString ...

Stu
bukox#
$(LANG_PREFIX) doesn't work too. Still It raised "no files found" error. If I put plain text instead of lang string it works correctly. It's looks like the lang string isn't parsed when it is in another string.

bye...
bukox#
I have 2 nsh files (polish and english). First lines from pp_polish.nsh:

LangString LANG ${LANG_POLISH} "Polish"
LangString LANG_PREFIX ${LANG_POLISH} "pl"

LangString InstallFull ${LANG_POLISH} "Pełna"
LangString InstallTypical ${LANG_POLISH} "Typowa"

and from pp_english.nsh:

LangString LANG ${LANG_ENGLISH} "English"
LangString LANG_PREFIX ${LANG_ENGLISH} "en"

LangString InstallFull ${LANG_ENGLISH} "Full"
LangString InstallTypical ${LANG_ENGLISH} "Typical"

And in nsi file I have:

!insertmacro MUI_LANGUAGE "Polish"
!insertmacro MUI_LANGUAGE "English"

and

!include "installer\pp_polish.nsh"
!include "installer\pp_english.nsh"

bye...
bukox#
I have line:
File /oname=test.exe "include\Tools\test$(LANG_PREFIX).exe"

and in this line I recieve:

File: "include\Tools\test$(LANG_PREFIX).exe" -> no files found.
Usage: File [/nonfatal] [/a] ([/r] [/x filespec [...]] filespec [...] |
/oname=outfile one_file_only)
Error in script "D:\test\test.nsi" on line 191 -- aborting creation process

bye...
Afrow UK#
Oh I see. No you cannot do that because language strings much like variables are for run time use (obviously). File is a compile time instruction which must be given hard coded parameters.

Hope that makes sense. You can only use defines at compile time.

Stu