• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Pages and localization
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Pages and localization


  • Subject: Pages and localization
  • From: KOENIG Yvan <email@hidden>
  • Date: Fri, 2 Jul 2010 11:30:39 +0200

Hello

When an English user want to create a new document from Pages,
he may use:

tell application "Pages"
	make new document with properties {template name:"blank"}
end tell

but, a French one must use

tell application "Pages"
	make new document with properties {template name:"vierge"}
end tell

and there are 13 other versions.

I know where is stored the localized string.

It's in the file : …Applications:iWork '09:Pages.app:Contents:Resources:French.lproj:TemplatesInfo.plist"

In this file it's
string _LOCALIZABLE_
of displayname
of 0
of groups
of 0
of categories
of Root

Given that I'm perfectly unable to extract this localized string with a script.

Maybe one of you may build what I am unable to achieve.

At this time I use this workaround :

set myNewDoc to my makeNewIworkDoc("Pages", "coucou", path to desktop folder as text)

--=====
(*
Creates a new iWork document from the Blank template,
saves it and returns its pathname.
example:
set myNewDoc to my makeNewIworkDoc(theApp, docName, folderPath)
*)
on makeNewIworkDoc(theApp, n, d)
local maybe, t, c
tell application "System Events" to set maybe to theApp is in title of every application process
if not maybe then tell application theApp to activate
tell application "System Events"
set path_to_theApp to get application file of application process theApp
end tell

if theApp is "Pages" then
set t to ((path_to_theApp as text) & "Contents:Resources:Templates:Blank.template:") --as alias
else if theApp is "Numbers" then
set t to ((path_to_theApp as text) & "Contents:Resources:Templates:Blank.nmbtemplate:") --as alias
else
if my parleAnglais(theApp) then
error "The application “" & theApp & "“ is not accepted !"
else
error "l’application « " & theApp & " » n’est pas gérée !"
end if
end if
if n does not end with "." & theApp then set n to n & "." & theApp
set f to d & n
tell application theApp
set c to count of documents
open t
repeat until (count of documents) > c
delay 0.1
end repeat
save document 1 in file f
end tell -- theApp
return f as alias
end makeNewIworkDoc


--=====


I will be glad to be able to use the simple syntax.
I wish to add that from my point of view, it's a sad design.
I feel that Pages would be able to translate on the fly the instruction :


make new document with properties {template name:"blank"}

but it's unnecessary to repeat what I think of the way some Apple engineers treats localization problems.
The app 'know' its internals. It would be easy for it to grab the localized version of a template name as well as it would be easy for it to grab the localized version of a menu item or of every GUI element.
Isn't it what it does when I ask it to open


((path_to_theApp as text) & "Contents:Resources:Templates:Blank.template:") as alias

Did you took care that even if its dictionary claims that we must pass it an alias, it is perfectly able to open … a string !

Yvan KOENIG (VALLAURIS, France) vendredi 2 juillet 2010 11:18:44






_______________________________________________ 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
  • Follow-Ups:
    • Re: Pages and localization
      • From: Brian Christmas <email@hidden>
  • Prev by Date: Re: Sort not case sensitive
  • Next by Date: Re: Pages and localization
  • Previous by thread: Re: controlling volume levels
  • Next by thread: Re: Pages and localization
  • Index(es):
    • Date
    • Thread