I'm currently working on BabelPad and have hit a roadblock for language switching. I'm pretty sure I'm going to have to write some custom NSIS (which I haven't really touched before), but just wanted to see what is the best way to do it.
My lang settings are stored in a .reg file, so should I use a segment that occurs prior to the Launcher modifying the registry and modify the .reg file, or wait until after the registry entries have been processed and then modify the registry? And whichever the case, which is the preferred segment to use (I'm assuming PreExec for modifying the registry, Init or Pre for modifying the .reg file)?
Do you need custom code? You can update .reg files like INI files via the BabelPadPortable.ini file. We do it for lots of apps.
Sometimes, the impossible can become possible, if you're awesome!
Yeah, I'm 99.9% sure it will need to be custom. As in my reply to Gord below, the value I would need to read in for non-platform language switching is saved as hex and thus doesn't translate nicely.
Can you post the .reg?
I suspect it'll likely be able to be done with the normal filewrite method, unless the language is stored in hex or something.
Have already had a bash at Launcher-based switching, but yeah, the values are stored as hex - so switching works when run from the platform, but BabelPad will always end up running with [Language]:Default without the platform.
You could set the language values from strings to HEX within the LanguageStrings section. That will work with a LanguageFile definition with or without the platform.
Sometimes, the impossible can become possible, if you're awesome!
I currently have the following:
[Language]
Base=%PortableApps.comLocaleName%
Default=English
[LanguageFile]
Type=ConfigRead
File=%PAL:DataDir%\settings\BabelPad.reg
Value='"UI Language"=dword:'
[LanguageStrings]
English=00000000
SimpChinese=00000001
TradChinese=00000002
[FileWrite1]
Type=ConfigWrite
File=%PAL:DataDir%\settings\BabelPad.reg
Entry='"UI Language"=dword:'
Value=%PAL:LanguageCustom%
It works fine for platform-based switching, but I always end up in English when run without the platform as the value read from the [LanguageFile] section is a hex value, not a LocaleName.
Treat the .reg as an INI and use dword:00000000 and similar as the Language strings.
Sometimes, the impossible can become possible, if you're awesome!
Ok, thanks, will give it a go.
Working now, thanks John.
Although I'm a little let down that I didn't get the chance to throw myself at NSIS. Will have to find another app that needs custom code.