You are here

Language switching issue

10 posts / 0 new
Last post
Ken Herbert
Ken Herbert's picture
Offline
Last seen: 22 hours 39 min ago
DeveloperModerator
Joined: 2010-05-25 18:19
Language switching issue

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)?

John T. Haller
John T. Haller's picture
Online
Last seen: 49 min 40 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Custom?

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!

Ken Herbert
Ken Herbert's picture
Offline
Last seen: 22 hours 39 min ago
DeveloperModerator
Joined: 2010-05-25 18:19
Yeah, I'm 99.9% sure it will

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.

Gord Caswell
Gord Caswell's picture
Offline
Last seen: 5 months 4 days ago
DeveloperModerator
Joined: 2008-07-24 18:46
post .reg?

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.

Ken Herbert
Ken Herbert's picture
Offline
Last seen: 22 hours 39 min ago
DeveloperModerator
Joined: 2010-05-25 18:19
Have already had a bash at

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.

John T. Haller
John T. Haller's picture
Online
Last seen: 49 min 40 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Hex

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!

Ken Herbert
Ken Herbert's picture
Offline
Last seen: 22 hours 39 min ago
DeveloperModerator
Joined: 2010-05-25 18:19
I currently have the

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.

John T. Haller
John T. Haller's picture
Online
Last seen: 49 min 40 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
INI

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!

Ken Herbert
Ken Herbert's picture
Offline
Last seen: 22 hours 39 min ago
DeveloperModerator
Joined: 2010-05-25 18:19
Ok, thanks, will give it a

Ok, thanks, will give it a go.

Ken Herbert
Ken Herbert's picture
Offline
Last seen: 22 hours 39 min ago
DeveloperModerator
Joined: 2010-05-25 18:19
Working now, thanks

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.

Log in or register to post comments