Wiol my Applescripted app work on a German/other language computer?

I have many installer applications written in AS and a User in Germany complains that an error message appears stating a Folder was not found. For example

	-- START MOVE ZIP FILE TO APPLICATIONS ****************************
	do shell script "cd /Applications ; unzip -P 001-001c -o /Volumes/S001-S001C-Install/Resources/Sassoon-S001-S001C.zip" --with administrator privileges

The German for Applications is Anwendungen.

My question is, will “Applications” be a recognised Folder if the computer is set to German language?

Will I have to write the Applescript again using German words for the names of Operating System Folders?

Hi,

the German word for Applications is Programme, but this is only displayed to the user, the shell doesn’t care about localized strings

Thanks StefanK. Understood. But how about these Applescript, does that care about localized strings. Must local language names be used in paths? Two examples:

--Is  'Finder' the same in any langauge, or must if be changed for different Countries?
set theFile to alias ((current_path as text) & "Resources:eula.pdf")
		tell application "Finder" to open file theFile
--should this be "path to programme folder" if German User and different again if Italian etc?
set theFile to alias {(path to applications folder as text) & "MyApplicationFolder:Documents:MyUserGuide.pdf"}
				tell application "Finder" to open file theFile
				

Hello.

Everything you enter in Applescript are the same whether the script is run on an English, or German machine.

Even if you use folder names like ~/Applications, on a machine with a German version of OS X, it should still work, because the only difference is the display name “Anwendungen” or whatever.

What isn’t localized, is the feedback to the user, so if you don’t localize feedback, then a user might see “Applications” in an error message, where he would expect to see Anwendungen for example.

Some values are also localized; one example coming to mind, is for example the name of a ScreenShot, it is named Screen Shot in English, but Skjermbilde in Norwegian, on details like this you’ll have to check for the localized name.

In general your scripts should work as is.

AppleScript doesn’t care either unless it’s a real path like the .lproj folders inside an application bundle.
“Finder” is always Finder and path to applications is always the alias specifier to /Applications

#1 - The Finder is the same for every countries but it uses local resources.
Those used to display localized folder name are stored in :
“/System/Library/CoreServices/SystemFolderLocalizations/”

When I navigate in my home folder with the Finder, the Library folder appears as:
Macintosh HD
Utilisateurs
mySelf
Bibliothèque

On a system running in Deutsch it would appear as :
Macintosh HD
Benutzer
mySelf
Library

If we ask Standard Additions to give the path to this folder with :
set userLibraryFolder to path to library folder from user domain we get :
alias “Macintosh HD:Users:myself:Library:”

#2 - It seems that you are mixing different things.

set myApplicationsFolder to POSIX path of (path to applications folder) will return the correct path to use in AppleScript.
Here on my system running in French it returns “/Applications/”
If you navigate to this folder with the Finder speaking Deutch you will find it at :
macintosh HD
Programme

#3 - In the code below, you encapsulate your pathname between what we name in French “accolades” (maybe curly brackets in English) :{.} doesn’t explain why your script fails.

#4 - In the code below you wrote : tell application “Finder” to open file theFile
As theFile is de fined as an alias, it would be tell application “Finder” to open theFile.
open file theFile is the correct syntax if theFile is defined as a text object.

If your code fails, its not due to the instruction tell application . but to the instruction set theFile to alias (.) which works well only if the given string describe the path to an existing file.

path to applications folder as text will return :
“Macintosh HD:Applications:”
so the path that you are building is :
“Macintosh HD:Applications:MyApplicationFolder:Documents:MyUserGuide.pdf”
If you navigate in the Finder it would be at :
Macintosh HD
Programme
MyApplicationFolder
Documents
MyUserGuide.pdf
As your script fails it’s clear that there is no such file available.

#5 - simple rule : In a script, never write by hand a path belonging to the system. Always use path to to do the job.

Yvan KOENIG (VALLAURIS, France) samedi 21 mars 2015 12:10:13

Thanks to all. Your insights have explained a lot for me. After all your comments, I am confident my scripts work correctly. I now think that the User of my Product Installer app. did not drag the Product Folder into “Applications” as instructed, but dragged it to some other Folder - so that triggered the error message. As usual, Users say they do one thing, but actually do something else.

I have now employed a passworded ZIP file routine which places the Product Folder into Applications by default, thus removing User interference!

Hello.

If you look at other apps, the documents you have described, like eula, and user manual, usually goes into a folder with the appname, under the Application Support Folder, that is a place that Apple has designated for application specific files. This may not be perfect for you, but it shouldn’t be too hard to provide a solution, that may open the folder containing the documentation somewhere in your app.

That way, you’ll let the user store the app everywhere he wants (Apple thinks users should be able to do that) , and still have the documentation show up correctly.

:slight_smile:

Thanks MacUsrII for that. The eula must be read before anything else happens which is why its in the current path on a DMG. Another copy of the eula is in the Application Support Folder too.