You are here

[Fixed] Impossibility to change the language in PhotoFiltre Portable

27 posts / 0 new
Last post
tapsklaps
Offline
Last seen: 6 years 4 weeks ago
Developer
Joined: 2010-10-17 08:11
[Fixed] Impossibility to change the language in PhotoFiltre Portable

In the section "Support" of the PhotoFiltre Portable website are mentioned the following sentences:

Languages: PhotoFiltre Portable will automatically adjust language to match the PortableApps.com Platform. If running without the platform, you can adjust the language after running and closing the application at least once by editing the file PhotoFiltrePortableSettings.ini within the PhotoFiltrePortable\Data\settings directory. Set Language= to your preferred language (example, de for German, fr for French, etc).

But the above advices are not valid. The reason for this problem is the fact, that the appropriate language file (eg the file "StudioDE.PLG" for German) don't exists in the folder PhotoFiltre. Therefore it's necessary to paste manually the appropriate language file in the folder PhotoFiltre.

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 4 months ago
Joined: 2007-04-15 21:08
Static analysis looks right to me

I haven't tried running it, but it looks correct to me; however part of it is that it deals with "TranslationDE.plg" rather than "StudioDE.plg". Observe the contents of App\AppInfo\Launcher\Custom.nsh to see how it deals with it. (That code needs refactoring! The fr branch is useless, can't imagine why it's there. And then when changing it we could rename it from custom.nsh to Custom.nsh, a sort of thing which I care about disproportionately much.)

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

tapsklaps
Offline
Last seen: 6 years 4 weeks ago
Developer
Joined: 2010-10-17 08:11
StudioDE.plg is the correct file

I have both the current file "StudioDE.plg" as well as the older file "TranslationDE.plg" tested. But only the file "StudioDE.plg" works fine.

Thank you for your tip to look in the file "custum.nsh". Unfortunately I am not yet familiar with the scripting language NSIS. Could you offer me some solid tutorials to learn NSIS?

tapsklaps
Offline
Last seen: 6 years 4 weeks ago
Developer
Joined: 2010-10-17 08:11
replace string

I looked straight into the file "custom.nsh". How about if I replace in this file the string "Translation" through "Studio"?

tapsklaps
Offline
Last seen: 6 years 4 weeks ago
Developer
Joined: 2010-10-17 08:11
folder called "Languages" don't exist

In row 10 of the file "custom.nsh" I can read, that the code use a folder called "Languages". This folder should reside in the folder PhotoFiltre. In fact during the installing such a folder "Languages" is not generated.

John T. Haller
John T. Haller's picture
Offline
Last seen: 2 hours 12 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Manually Added

Languages are manually added with version 7 and all separate downloads on the site. The launcher was not updated for this. Version 6 only had french and nothing else so those were added in a fr directory. If you download and place them manually do they work?

Sometimes, the impossible can become possible, if you're awesome!

tapsklaps
Offline
Last seen: 6 years 4 weeks ago
Developer
Joined: 2010-10-17 08:11
Yes

I have downloaded the language file StudioDE.plg from here and it works fine.

tapsklaps
Offline
Last seen: 6 years 4 weeks ago
Developer
Joined: 2010-10-17 08:11
more language files in the folder PfotoFiltre

However, if there are multiple language files in the folder PhotoFiltre, then PhotoFiltre will use the first PLG (language file) it finds in alphabetical order. That seems to be a problem. Therefore it's necessary to put all language files in a seperate folder called "Languages". By the file custom.nsh it should be possible to choose the appropriate language file (I hope to interpret this correctly).

Could you offer me some solid tutorials to learn NSIS?

tapsklaps
Offline
Last seen: 6 years 4 weeks ago
Developer
Joined: 2010-10-17 08:11
use of custom.nsh

My starting point is the following:

I have created a folder named "Languages" within the folder "PhotoFiltre". In the folder "Languages" I have pasted all the necessary language files (e.g. StudioDE.plg, StudioNL.plg, StudioES.plg, StudioIT.plg ...). Within the folder "PhotoFiltre" resides only the language file "StudioEN.plg". By parsing the environment variable %PAL:LanguageCustom% it will become for example DE. My aim is now, that I want to substitute the language file "StudioEN.plg" in the folder "PhotoFiltre" through the language file "StudioDE.plg" in the folder "Languages".

In a first step I wrote the following code in the file "PhotoFiltrePortable.ini":

[Language]
Base=%PortableApps.comLanguageCode%
CheckIfExists=%PAL:AppDir%\Photofiltre\Languages\Studio%PAL:LanguageCustom%.plg
DefaultIfNotExists=en

In a second step I create a file custom.nsh with the following content:

${SegmentFile}

${SegmentPrePrimary}
	ReadEnvStr $0 PAL:LanguageCustom
			${If} ${FileExists} "$EXEDIR\App\Photofiltre\Languages\Studio$0.plg"
				Delete $EXEDIR\App\Photofiltre\Studio*.plg
				CopyFiles /SILENT "$EXEDIR\App\Photofiltre\Languages\Studio$0.plg" "$EXEDIR\App\Photofiltre\"
				${EndIf}
!macroend

Unfortunately this did not work. Or is it necessary, that I must compile a new Launcher with the above file custom.nsh and the altered file "PhotoFiltrePortable.ini"? Or is the code of the file custom.nsh probably false?

tapsklaps
Offline
Last seen: 6 years 4 weeks ago
Developer
Joined: 2010-10-17 08:11
above statements are the solution

How I read in the Language documentation in the section "Other ways", I need to compile this new code with the PortableApps.com Launcher Generator. Now all works fine. I forgot this last step.

Now are the invalid sentences, which I have mentioned in my original post, again correctly.

For everyone, who are interested at my version, is here the Downloadlink for the installer: PhotoFiltre Portable 7.0 Development Test 1

tapsklaps
Offline
Last seen: 6 years 4 weeks ago
Developer
Joined: 2010-10-17 08:11
Rename with NSIS

If I want to rename a file called "PhotoFiltre.htm" to "PhotoFiltre7.htm" with NSIS, can I do that with the following code?

Rename "$EXEDIR\App\Photofiltre\PhotoFiltre.htm" "$EXEDIR\App\Photofiltre\PhotoFiltre7.htm"
Aluísio A. S. G.
Offline
Last seen: 8 years 3 months ago
DeveloperTranslator
Joined: 2010-11-09 17:43
Yes

.

Previously known as kAlug.

tapsklaps
Offline
Last seen: 6 years 4 weeks ago
Developer
Joined: 2010-10-17 08:11
something wrong in the code of custom.nsh

In some language files I detected 2 files called "PhotoFiltre.htm" and PhotoMasque.htm". The file "PhotoFiltre.htm" I renamed as "PhotoFiltre7.htm".
I created for every language a folder inside of the folder Languages. For example for german I named this folder "help-de". In this folder I pasted the 2 files "PhotoFiltre7.htm" and "PhotoMasque.htm".

My aim is now, that I want to substitute the language file "StudioEN.plg" in the folder "PhotoFiltre" through the appropriate language file (e.g. "StudioDE.plg" for german) in the folder "Languages". In addition should be replaced the two files "PhotoFiltre7.htm" and "PhotoMasque.htm" in the folder "PhotoFiltre" through the appropriate files in the folder "help-%PAL:LanguageCustom%" (e.g. "help-de" for german). To this end I have created a file "custom.nsh" with the following code:

${SegmentFile}

${SegmentPrePrimary}
	ReadEnvStr $0 PAL:LanguageCustom
		${If} ${FileExists} "$EXEDIR\App\PhotoFiltre\Languages\Studio$0.plg"
			Delete $EXEDIR\App\PhotoFiltre\Studio*.plg
			CopyFiles /SILENT "$EXEDIR\App\PhotoFiltre\Languages\Studio$0.plg" "$EXEDIR\App\PhotoFiltre\"
				${If} ${FileExists} "$EXEDIR\App\PhotoFiltre\Languages\help-$0\PhotoFiltre7.htm"
					Delete $EXEDIR\App\PhotoFiltre\PhotoFiltre7.htm
					CopyFiles /SILENT "$EXEDIR\App\PhotoFiltre\Languages\help-$0\PhotoFiltre7.htm" "$EXEDIR\App\PhotoFiltre\"
				${EndIf}
					${If} ${FileExists} "$EXEDIR\App\PhotoFiltre\Languages\help-$0\PhotoMasque.htm"
						Delete $EXEDIR\App\PhotoFiltre\PhotoMasque.htm
						CopyFiles /SILENT "$EXEDIR\App\PhotoFiltre\Languages\help-$0\PhotoMasque.htm" "$EXEDIR\App\PhotoFiltre\"
					${EndIf}
		${EndIf}
!macroend

Unfortunately, it does not work. Can someone give me a tip to solve this problem?

tapsklaps
Offline
Last seen: 6 years 4 weeks ago
Developer
Joined: 2010-10-17 08:11
problem solved

Unfortunately, I overlooked one small thing. Smile The code of the file "custom.nsh" is correct. Also I have solved the problem with the registry keys (please look for more information in the post of the member SYSTEM).

For everyone, who are interested at my version, is here the Downloadlink for the installer: PhotoFiltre Portable 7.0 Development Test 2

tapsklaps
Offline
Last seen: 6 years 4 weeks ago
Developer
Joined: 2010-10-17 08:11
Preserving of the folder "Languages" during an upgrade

To fix the language issue, I have created a folder named "Languages" inside of the folder "PhotoFiltre". To preserve the folder "Languages" during an upgrade of the app, I have written the following code in the section [DirectoriesToPreserve] of the file "installer.ini":

PreserveDirectory2=App\PhotoFiltre\Languages

For a revised version is here the link for downloading: PhotoFiltre Portable 7.0 Development Test 3

tapsklaps
Offline
Last seen: 6 years 4 weeks ago
Developer
Joined: 2010-10-17 08:11
revised version of PhotoFiltre 7.0

Once again I have modified the code of the file "custom.nsh". Furthermore I have eliminated the folder "Languages" from the folder "PhotoFiltre". Instead I have pasted the folder "Languages" in the folder DefaultData. Accordingly the folder "Languages" will be preserved during an upgrade of the app.

Through these measures now automatic language switching works in the PortableApps.com Platform. If running without the platform, you can adjust the language after running and closing the application at least once by editing the file PhotoFiltrePortableSettings.ini within the PhotoFiltrePortable\Data\settings directory.

For a revised version is here the link for downloading: PhotoFiltre Portable 7.0 Development Test 4

John T. Haller
John T. Haller's picture
Offline
Last seen: 2 hours 12 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Unsupported

DefaultData is only for default user data. As I said previously, things like language files are part of the app and must remain in the App directory. There is no reason to have language files within Data.

Sometimes, the impossible can become possible, if you're awesome!

tapsklaps
Offline
Last seen: 6 years 4 weeks ago
Developer
Joined: 2010-10-17 08:11
different possibilities to solve a problem

It may be, that the language files are a fundamental part of the app. But the folder "Languages" with all the language files, which I created, is not a part of the original app. Also, I was able to reach through this solution (Development Test 4) that the automatic language switching works fine in the PortableApps.com Platform. And in the end this solution preserves the folder "Languages​​" during an upgrade of the app. So I can not quite understand your objection.

Finally I would like to mention, that I've pasted with the variant Development Test 3 the folder "Languages" in the folder "PhotoFiltre". In this case also works fine the automatic language switching.

The result ought to be decisive and not the way there.

depp.jones
Offline
Last seen: 5 hours 46 min ago
DeveloperTranslator
Joined: 2010-06-05 17:19
In this case, I think Dev

In this case, I think Dev Test 3 is the better solution. The language files are not included in the original app but belong to it. It is no user generated content nor is it part of the launchers working files. You preserved it with the installer.ini, so that upgrading is no problem (contrary to placing them in the DefaultData which breaks your language switching mechanism when Data is already present). But as every new version should contain the set of language files (possibly updated as well) there even is no need to preserve them. They should simply be replaced.

tapsklaps
Offline
Last seen: 6 years 4 weeks ago
Developer
Joined: 2010-10-17 08:11
unclear argumentation

Unfortunately I can not understand your argument, why should breaks the automatic language switching, if the folder Data is already present. Please explain it in more detail. Also your assumption is false, that every new version should contain the set of language files. The program PhotoFiltre 7.0 contains only 1 language file named StudioEN.plg. For all these reasons I've created a folder "Languages" with all language files inside of the folder DefaultData. And through the file custom.nsh in conjunction with the section [Language] in the file "PhotoFiltrePortable.ini" it's now possible, that the language file StudioEN.plg in the folder PhotoFiltre will be substituted by the appropriate language file in the folder Languages.

depp.jones
Offline
Last seen: 5 hours 46 min ago
DeveloperTranslator
Joined: 2010-06-05 17:19
Try installing your Dev Test

Try installing your Dev Test over an older Photofiltre portable installation that contains a Data folder ans see what happens to your language switching.
I shurly understood your concept, no need to explain it over and over again. It is good, but not in DefaultData!
-edit-
to further explain again: You do not need to preserve the languages as you should better contain them in every updated paf as well. They would therefore be installed new.

tapsklaps
Offline
Last seen: 6 years 4 weeks ago
Developer
Joined: 2010-10-17 08:11
very good and productive disput

First I would like to mention at this point, that I greatly appreciate your contributions Smile That's why I'm still very interested in your comments.

In fact you have right, that after an upgrade from an older version of PhotoFiltre the automatic language switching in the PortableApps.com Platform don't work. Although the folder Languages ​​is located in the folder DefaultData, afterwards the folder Languages is not transferred to the Data folder. Very strange but sadly true Wink

I also have the same idea like you to insert the complete folder Languages in the folder PhotoFiltre on every update. In fact works then an update from an older version. Therefore is it recommended to use my version Development Test 3.

At the moment I test your launcher.ini regarding Tomahawk PDF+ Portable. More soon

depp.jones
Offline
Last seen: 5 hours 46 min ago
DeveloperTranslator
Joined: 2010-06-05 17:19
That's by design. DefaultData

That's by design.
DefaultData is the "blueprint" for a newly installed app where the Data folder does not exist already. It's the place for any preset settings files that need to be existend for the app to be portable.

The third directory, DefaultData is usually used as a container for the default files to be placed within the Data directory. Generally, the launcher, when run, will check if there is a set of files within Data and, if not, will copy them from DefaultData. The next release of the PortableApps.com Installer will do the same.

(from the PA.c Format Specification 2.0)
The purpose of this is to ensure that user settings won't get overwritten.
In the case of your Photofiltre package, the language files are no user data or settings to portablize and belong to the app's folder - so your first idea for a subfolder in photofiltre was right. It's a pitty that they are not included in the base app already - makes maintanance more complicated than needed. Maybe one should leave the developer a message...

John T. Haller
John T. Haller's picture
Offline
Last seen: 2 hours 12 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Common

Not including the language files is a relatively common practice among many apps. When I package apps like KeePass Portable and WinSCP Portable, I go out and grab the then-current translations and incorporate them into the portable app.

Sometimes, the impossible can become possible, if you're awesome!

tapsklaps
Offline
Last seen: 6 years 4 weeks ago
Developer
Joined: 2010-10-17 08:11
revised version PhotoFiltre 7.0 Development Test 5

I have now again revised the 3 files PhotoFiltrePortable.ini, installer.ini and custom.nsh. In particular I've inserted into the file PhotoFiltrePortable.ini a new section [LanguageStrings].

I've also added the folder Languages again into the program folder ​​PhotoFiltre (as in my version PhotoFiltre Portable 7.0 Development Test 3 ). For future updates the ​​folder Languages should always be a part of the program folder PhotoFiltre.

Here the link for downloading: PhotoFiltre Portable 7.0 Development Test 5

vf2nsr
vf2nsr's picture
Offline
Last seen: 8 years 1 month ago
Developer
Joined: 2010-02-13 17:10
Has this

issue been resolved now through custom code?

“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” Dr. Seuss

John T. Haller
John T. Haller's picture
Offline
Last seen: 2 hours 12 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Fixed in 7.0 Rev 2

This is fixed in 7.0 Rev 2. Thank you tapsklaps for your assistance! I did have to add back in the specialized French handling due to it being internal. Check it out to see what was added.

Sometimes, the impossible can become possible, if you're awesome!

Log in or register to post comments