oryan_dunn
24th January 2011 23:09 UTC
How to i18n strings in nsh file?
I'm using this script here:
http://nsis.sourceforge.net/Java_Run...amic_Installer
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
25th January 2011 00:23 UTC
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
25th January 2011 15:04 UTC
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)?
oryan_dunn
25th January 2011 15:07 UTC
Sorry for the double post.
Afrow UK
25th January 2011 15:13 UTC
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
25th January 2011 15:18 UTC
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
25th January 2011 18:05 UTC
Functions can be anywhere in a script. They are linked at the end of the compile process.
Stu
oryan_dunn
25th January 2011 18:34 UTC
Is that also true of a macro? I forgot that this header has the macro/function pattern.
Afrow UK
25th January 2011 21:53 UTC
No, if it has macros then you are stuck.
Stu