You are here

Multilanguage support

7 posts / 0 new
Last post
samdev
Offline
Last seen: 6 years 10 months ago
Developer
Joined: 2010-03-16 18:03
Multilanguage support

Is Multilingual still working fine?
Aren't we supposed to choose the app's language on one of the installers steps?

I generated an installer from something like:
[appinfo.ini]
...
Language=Multilingual
...

[installer.ini]
...
[Languages]
ARABIC=true
BELARUSSIAN=true
...

["Launcher".ini]
...
[Language]
Base=%PortableApps.comLocaleName%
DefaultIfNotExists=English

[LanguageStrings]
Arabic=ar
Belarussian=be
...

But i'm not able to choose the language at install time.

Am I missing something?

Tks,

Ken Herbert
Ken Herbert's picture
Online
Last seen: 32 min 14 sec ago
DeveloperModerator
Joined: 2010-05-25 18:19
Language for the Installer

Language for the Installer and Launcher are not the same thing.

The Installer's language selection only changes the language for the actual process of installing the app, nothing else. The [Languages] section in installer.ini only informs the Installer of what languages to present itself in.

Once installed, the app will always open in the same language as the Platform if the setting in Options->General->Language is set to "Use this language for all portable apps" (and the language is actually supported by the app), otherwise the app will always open in the language it was last set as.

samdev
Offline
Last seen: 6 years 10 months ago
Developer
Joined: 2010-03-16 18:03
Forgot

Sorry...
Forgot the language switching purpose.

I'm currently updating TrueCrypt to Platform v3.0. Done it from scratch as I can't find the previous installer (links are broken). But I'm having some difficulties handling the language switching on TrueCrypt, that stores its configuration in a XML file like the one bellow.


<?xml version="1.0" encoding="utf-8"?>
<TrueCrypt>
<configuration>
<config key="OpenExplorerWindowAfterMount">0</config>
...
<config key="DisplayMsgBoxOnHotkeyDismount">1</config>
<config key="Language"></config>
<config key="SecurityTokenLibrary"></config>
</configuration>
</TrueCrypt>

Launcher.ini
[Activate]
XML=true

[Language]
Base=%PortableApps.comLocaleName%
CheckIfExists=%PAL:DataDir%\TrueCrypt\Configuration.xml
DefaultIfNotExists=en

[LanguageStrings]
Arabic=ar
Belarussian=be
...

[LanguageFile]
Type=XML text
File=%PAL:DataDir%\TrueCrypt\Configuration.xml
XPath=/TrueCrypt/configuration/config[@key="Language"]

...

[FileWrite4]
File=%PAL:DataDir%\Configuration.xml
Type=XML text
XPath=/TrueCrypt/configuration/config[@key="Language"]
Value=%PAL:LanguageCustom%

I always get a bad file when launching the app, i.e. the file was updated but in an erroneous way. See bellow.


<?xml version="1.0" encoding="utf-8"?>
<TrueCrypt>
<configuration>
<config key="OpenExplorerWindowAfterMount">0</config>
...
<config key="DisplayMsgBoxOnHotkeyDismount">1</config>
<config key="Language">en</config>
<config key="SecurityTokenLibrary">

</config>
</configuration>
</TrueCrypt>

The last line is being updated and the text is 2 new lines and 4 spaces. I'm not sure what is causing this.

Can you help?

Cheers,
Sam

Ken Herbert
Ken Herbert's picture
Online
Last seen: 32 min 14 sec ago
DeveloperModerator
Joined: 2010-05-25 18:19
Couple of things

This wouldn't kill the XML like you've shown (it would affect the app when starting without the Platform), but your [LanguageFile] has
File=%PAL:DataDir%\TrueCrypt\Configuration.xml while your [FileWrite4] has File=%PAL:DataDir%\Configuration.xml.

Otherwise, my personal preference would be to not use the XML functionality at all. You could get away with a ConfigWrite for this quite easily.

[FileWrite4]
File=%PAL:DataDir%\Configuration.xml
Type=ConfigWrite
Entry=<config key="Language">
Value=%PAL:LanguageCustom%</config>

Note the closing tag added to the Value. If there were any whitespace at the start of the line in the config file, you would need to include it in your Entry like this:
Entry='    <config key="Language">'

samdev
Offline
Last seen: 6 years 10 months ago
Developer
Joined: 2010-03-16 18:03
XML not working

Correct the issue with the path, but it still doesn't work properlly.

Used the other approach:

[LanguageFile]
File=%PAL:DataDir%\Configuration.xml
Type=ConfigRead
Entry=' <config key="Language">'
TrimRight=</config>

[FileWrite4]
File=%PAL:DataDir%\Configuration.xml
Type=ConfigWrite
Entry=' <config key="Language">'
Value=%PAL:LanguageCustom%</config>

But it seems to do nothing. At least is does something as I had to add the TrimRight to remove the extra closing tag... but the language is not updated when I change it from the PortableApp Options menu and stop/start the app.

Any ideas on how to proceed and debug this?

Cheers,
Sam

Ken Herbert
Ken Herbert's picture
Online
Last seen: 32 min 14 sec ago
DeveloperModerator
Joined: 2010-05-25 18:19
Couple of stupid questions

Couple of stupid questions, but they need to be asked:

Are you sure that the language you selected in the Platform is supported by the app?

Are you sure you are using the exact same amount of whitespace in your Entry fields?

Are you sure the app uses the languages in the format you are putting into the XML file? (On a side note - and you may want to wait until you have it actually working before looking at this - if it uses the LanguageCode format, you don't need to read the Base as LocaleName then convert it to LanguageCode, just read it as LanguageCode and only have [LanguageStrings] for any that are a little different).

samdev
Offline
Last seen: 6 years 10 months ago
Developer
Joined: 2010-03-16 18:03
No problem with the questions

Yes, I was using pt-br and it is supported.

Now regarding the amount of spaces, I copied from the file (opened with notepad++) and the line has tabs instead of spaces, maybe this is causing some issues. The thing is that every time time the app writes the conf file it always uses tabs.

Some language codes are different like pt-br (in portableApps the LanguageCode is pt_br).

Cheers,
Sam

Log in or register to post comments