localized string and 10.6
localized string and 10.6
- Subject: localized string and 10.6
- From: KOENIG Yvan <email@hidden>
- Date: Fri, 21 Jan 2011 18:29:20 +0100
localized string is an useful function of Standard Additions which I use very often.
localized string v : Return the localized string for the specified key
localized string text : the key
[from table text] : the name of the strings file excluding the “.strings” suffix (default is “Localizable”)
[in bundle file] : an alias or file reference to the bundle containing the strings file (default is the current application/script bundle)
→ text : the localized string
Example :
[SCRIPT]
tell application "Safari"
get localized string "Are you sure you want to close this window?"
end tell
[/SCRIPT]
Since 10.6, there is an annoying feature.
Calling an OSAX from a tell application "wxyz" block generates errors
which happily are automatically trapped.
On a French system,running the script above issue this log report
[SCRIPT]
tell application "Safari"
localized string "Are you sure you want to close this window?"
--> error number -1708
«event ascrgdut»
--> error number -1708
localized string "Are you sure you want to close this window?"
--> "Souhaitez-vous vraiment fermer cette fenêtre ?"
end tell
Résultat :
"Souhaitez-vous vraiment fermer cette fenêtre ?"
[/SCRIPT]
On an English one, it will return :
[SCRIPT]
tell application "Safari"
localized string "Are you sure you want to close this window?"
--> error number -1708
«event ascrgdut»
--> error number -1708
localized string "Are you sure you want to close this window?"
--> "Are you sure you want to close this window?"
end tell
Result :
"Are you sure you want to close this window?"
[/SCRIPT]
May we be sure that this kind of error has no odd effects ?
I'm puzzled because, if most of the time I may move calls to OSAXen out of tell blocks,
I really don't know how to do that for localized string whose target's resource is defined by the tell block.
Yvan KOENIG (VALLAURIS, France) vendredi 21 janvier 2011 18:19:54
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden