Skip to content
⌘ NSIS Forum Archive

How to i18n strings in nsh file?

9 posts

oryan_dunn#

How to i18n strings in nsh file?

I'm using this script here:


Listed under future enhancements is
The text strings used in this page should be configurable, and should be i18n aware
I wanted to i18n the strings, created LangStrings for all UI strings, placed the LangString lines at the end of the nsh, but they don't get read in. The only way I could get this to work is to put the LangString lines at the end of my main nsi file. What's the proper way to i18n a file that is meant to be included (and have that nsh file be all that's needed)?
Afrow UK#
Do you get compiler warnings? When you use LangString you just have to use it after LoadLanguageFile (or in the case of MUI, !insertmacro MUI_LANGUAGE). Therefore to keep them in the header file you will have to include the header file after the languages are defined.

Stu
oryan_dunn#
Yes, I get warnings on the LangString and about a language table.

I tried moving the language declaration to before the include statement, but then I didn't have any strings at all (even the default ones included with nsis). I wasn't sure if there was a way to make the header file self-contained. Can I have the language declarations twice (just put one in the header file, and another in my main file)?
Afrow UK#
I didn't say to move the language declarations. I said to move the !include. You have to have the language declarations after the page declarations.

Stu
oryan_dunn#
Thanks Stu,
The gotcha in this case is that the header file declares a function for a custom page, so it would seem it would need to come before the page declarations.

Ryan
Afrow UK#
Functions can be anywhere in a script. They are linked at the end of the compile process.

Stu