National language of file properties

I was browsing here a while looking for a national language problem, but although I found solutions to receive the national language of a workstation,
this won’t be a solution for my problem still.

I am German and I am using a german configured workstation.

I.E.:

set filpath1 to choose file
tell application "Finder"
	set ar1 to kind of filpath1
end tell
get ar1

For a Photoshop Tiff file this will return:
“Adobe Photoshop TIFF-Datei” - on my machine
but: “Adobe Photoshop TIFF file” on an english configured machine
(for some unknown reasons I get this answer even on a different, german configured machine.:confused: )

Although this is undoubtedly a useful behaviour in most cases, my problem begins when I like to compare these strings, because in every case

“Adobe Photoshop TIFF-Datei” ≠“Adobe Photoshop TIFF file” :expressionless:

So if I use these strings for comparisations, my script will fail.
To find out the national language of a workstation and to code the comparisations in dependence of it isn’t a real solution, because:

  • I will have to code not only displayed text (i.e. in dialog boxes) in several languages but in my “real” program as well.
  • Such a construct won’t work i.e. on a spanish machine without a spanisch adaption if the user decides to use my english version instead.

Now my question: Is it possible to code a script which will always return a specified language, i.e. “Adobe Photoshop TIFF file”,
irrespective of the chosen national language of the workstation ?

Thanx !

Browser: Safari 419.3
Operating System: Mac OS X (10.4)

Hallo Giacomo,

there are only a few things in AppleScript which depends on the language,
one of them is the property kind of file information and of course
the name of menu items and buttons for GUI scripting.
Maybe this shell command helps you, it’s independent of the language

set f to (do shell script "file -bi " & quoted form of POSIX path of (choose file))
display dialog f

or take type identifier of file info

Grüße aus dem Nachbarland

Danke Stefan,

nice solution, thanx, but somehow not the help I expected to get.
Seems as if language related difficulties aren’t easy to solve here - for the majority of developers here
they might be a SEP-field which makes you unvisisble (SEP: Somebody Else’s Problem). Or more serious:
Problems, an english native programer normally hasn’t to solve so therefore nobody has a solution.
:confused:
Grüße von den Bayern an die Schweizer :wink:

Localization is indeed a pain, but you could approach it from this standpoint…

set _psTiff to {"Adobe Photoshop TIFF-Datei", "Adobe Photoshop TIFF file"}

set filpath1 to choose file
tell application "Finder"
	set ar1 to kind of filpath1
end tell

if _psTiff contains ar1 then display dialog "The file is a Adobe Photoshop Tiff File"

Hi,

Usually, people use the ‘name extension’ of the file. “tiff” or “tif”.

Edited: and btw, you can get the default application also. e.g.


set f to choose file
set f_info to (info for f)
set {the_ext, default_app} to {name extension, default application} of f_info

gl,