I have 3 languages, so I write this:
Root: HKLM; Subkey: "SOFTWARE\Company\Office\Client"; ValueType: dword; ValueName: "LocaleID"; ValueData: "?"; Languages: en
Root: HKLM; Subkey: "SOFTWARE\Company\Office\Client"; ValueType: dword; ValueName: "LocaleID"; ValueData: "?"; Languages: ru
Root: HKLM; Subkey: "SOFTWARE\Company\Office4\Client"; ValueType: dword; ValueName: "LocaleID"; ValueData: "?"; Languages: ua
In the ValueData
field I have to put the corresponding LanguageID ($0419
for Russian, $1058
for Ukrainian and $0409
for English, etc). I could put those numbers manually, but I wonder if there's a way to extract the LanguageID from its name or something.
You can use preprocessor to generate [Languages]
and [Registry]
entries at the same time. The preprocessor has ReadIni
function, which you can use to read the LanguageID
from the .isl
files.
#define AddLanguage(Name, File) \
"[Languages]" + NewLine + \
"Name: " + Name + "; MessagesFile: ""compiler:" + File + """" + NewLine + \
"[Registry]" + NewLine + \
"Root: HKLM; Subkey: ""SOFTWARE\Company\Office\Client""; ValueType: dword; " + \
"ValueName: ""LocaleID""; " + \
"ValueData: " + ReadIni(CompilerPath + File, "LangOptions", "LanguageID") + "; " + \
"Languages: " + Name + NewLine
#emit AddLanguage("en", "Default.isl")
#emit AddLanguage("ru", "Languages\Russian.isl")
#emit AddLanguage("uk", "Languages\Ukrainian.isl")
That will generate a code like this (lines wrapping and empty lines added for readability):
[Languages]
Name: en; MessagesFile: "compiler:Default.isl"
[Registry]
Root: HKLM; Subkey: "SOFTWARE\Company\Office\Client"; ValueType: dword; \
ValueName: "LocaleID"; ValueData: $0409; Languages: en
[Languages]
Name: ru; MessagesFile: "compiler:Languages\Russian.isl"
[Registry]
Root: HKLM; Subkey: "SOFTWARE\Company\Office\Client"; ValueType: dword; \
ValueName: "LocaleID"; ValueData: $0419; Languages: ru
[Languages]
Name: uk; MessagesFile: "compiler:Languages\Ukrainian.isl"
[Registry]
Root: HKLM; Subkey: "SOFTWARE\Company\Office\Client"; ValueType: dword; \
ValueName: "LocaleID"; ValueData: $0422; Languages: uk
Add SaveToFile
to the end of the script to see the generated code.