You are here

automatic language switching

7 posts / 0 new
Last post
tapsklaps
Offline
Last seen: 6 years 1 month ago
Developer
Joined: 2010-10-17 08:11
automatic language switching

I´ve tried to realize the automatic language switching in my portable app Tomahawk PDF+ Portable. To that extent I've created a folder named "Languages" with all language files inside of the folder DafaultData\settings. I also have created a file "custom.nsh" with the following code:

${SegmentFile}

${SegmentPrePrimary}
	ReadEnvStr $0 PAL:LanguageCustom
			CopyFiles /SILENT $EXEDIR\Data\Languages\TPdfPlus$0.lng $EXEDIR\App\TomahawkPDF+
			Delete $EXEDIR\App\TomahawkPDF+\TPdfPlus.lng
			Rename $EXEDIR\App\TomahawkPDF+\TPdfPlus$0.lng $EXEDIR\App\TomahawkPDF+\TPdfPlus.lng			
!macroend

In the file "TomahawkPDF+Portable.ini" I pasted the following code:

[Language]
Base=%PAL:LanguageCustom%

But the automatic language switching don't work in the PortableApps.com Platform.
Has anyone an idea?

Aluísio A. S. G.
Offline
Last seen: 8 years 4 months ago
DeveloperTranslator
Joined: 2010-11-09 17:43
Wrong variable

Use PAL:LanguageCustom on the custom code, and PortableApps.comLocale* on the launcher.ini.

Previously known as kAlug.

tapsklaps
Offline
Last seen: 6 years 1 month ago
Developer
Joined: 2010-10-17 08:11
same idea

On the last night I have thought a whole lot about the automatic language switching and other matters concerning TomahawkPDF+ Portable. I have also detected the little but important failure in my file TomahawkPDF+Portable.ini. Accordingly I altered the code as follows:

[Language]
Base=%PortableApps.comLanguageCode%

And now comes the good news: Now the automatic language switching works fine in the PortableApps.com Platform Smile

Pyromaniac
Pyromaniac's picture
Offline
Last seen: 9 years 8 months ago
Developer
Joined: 2008-09-30 19:18
Missing a space?

First off, I think your missing a space in the fourth line, but that's not important.

Secondly, all you have to do is:

[FileWrite2]
File=%PAL:AppDir%\TomahawkPDF+\TPdfPlus.lng
Type=INI
Section=Options
Key=Language
Value=%PortableApps.comLocaleName%

And that will automatically set the language via PAM.

Also consider moving TPdfPlus into the Data directory and including a copy in DefaultData with English as the default language.

And I don't recommend including a + sign in App\TomahawkPDF, as it's kinda weird.

depp.jones
Offline
Last seen: 22 hours 24 min ago
DeveloperTranslator
Joined: 2010-06-05 17:19
It's more complicated as

It's more complicated as TomahawkPDF acts kinda weird.
The TPdfPlus.lng is only created when a user changes the language. If it is not present, english is used. So, it is not needed in DefaultData.

The biggest problem is that TomahawkPDF produces an error message if the TPdfPlus.lng contains an entry that it cannot handle. Therefore the language switching has to be restricted to the set of languages supported by TaomahawkPDF.
The only solution I had in mind was to substitute every unsupported language with English (US) in the LanguageStrings section.

tapsklaps
Offline
Last seen: 6 years 1 month ago
Developer
Joined: 2010-10-17 08:11
not the solution

Your code don't work.

depp.jones
Offline
Last seen: 22 hours 24 min ago
DeveloperTranslator
Joined: 2010-06-05 17:19
I found the solution - or

I found the solution - or better, I had it already but thought too complicated (once more Wink )... I'll post it in the Tomahawk thread.

Log in or register to post comments