• 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
Re: Applescript localization support
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Applescript localization support


  • Subject: Re: Applescript localization support
  • From: "parag vibhute" <email@hidden>
  • Date: Tue, 24 Jun 2008 14:00:19 +0530

Thanks for reply.

I tried same thing (only difference is I tried this through Cocoa application i.e. creating localizable.string file etc.)

Following is the script which was printed via NSLog:

with timeout of 30 seconds
set theAttachment to POSIX path of "/status.zip"
tell application "Mail"
set theMessage to make new outgoing message with properties {visible:true, subject:"Test", content:"

状态

"}
tell content of theMessage
make new attachment with properties {file name:theAttachment} at after last paragraph

end tell
end tell
end timeout



But I am getting following error which I am unable to understand
{
    NSAppleScriptErrorBriefMessage = "\U9810\U671f\U7684\U662f\Ufffd\"\U8342A\U4f46\U627e\U5230\U7684\U662f\U5de5\U5e8f\U6307\U4ee4\U7d50\U5c3e\U3002";
    NSAppleScriptErrorMessage = "\U9810\U671f\U7684\U662f\Ufffd\"\U8342A\U4f46\U627e\U5230\U7684\U662f\U5de5\U5e8f\U6307\U4ee4\U7d50\U5c3e\U3002";
    NSAppleScriptErrorNumber = -2741;
    NSAppleScriptErrorRange = <b0010000 00000000 >;
}



Can you tell what is the error & what should be the solution?

Thanks,
Palav

On Tue, Jun 24, 2008 at 5:56 AM, Christopher Nebel <email@hidden> wrote:
AppleScript 2.0 added support for literal Unicode strings in the source code, but that's not necessary for your problem.  What you want is the "localized string" command.  Using it is a little complicated, but not too bad:

1. Save your script as a bundle (ideally an application bundle, but a script bundle should work as well).
2. For any text you want to localize, replace the literal string with a function call, like this:

       localized string "My Body"

3. In the script bundle resources, make a new lproj folder named for the locale you want -- for example, "zh_CN.lproj" for Chinese.  Inside that, add a text file named "Localizable.strings", which contains lines like this:

       "My Body" = "Chinese My Body";

Save them as UTF-16; TextEdit should do that for you if necessary.  Repeat as necessary for all the strings and all the locales you want.  When you run the script, the "localized string" calls will return the localized string that you provided.  (If someone tries to use a locale you didn't provide text for, it will return the original string, so it's wise to make them at least somewhat readable.)


--Chris Nebel
AppleScript Engineering


On Jun 23, 2008, at 5:21 AM, parag vibhute wrote:

Any answer guys???

I know Applescript 2.0 (which run on Leopard) supports unicode character set & so support chinese language localization. But what about panther & tiger? It(script with chinese string) does not give expected output on Panther & tiger. So what should be the solution?

Thanks,
Palav

On Mon, Jun 16, 2008 at 6:37 PM, parag vibhute <email@hidden> wrote:

I have following script for generating an email in Apple Mail application:

tell application "Mail"
   set theMessage to make new outgoing message with properties {visible:true, subject:"My Subject", content:"My Body"}
   tell theMessage
       make new to recipient at end of to recipients with properties {address:"email@hidden"}
   end tell
end tell

Now I want to make content of email("My Body" in above script) in Chinese language instead of English, how can I do it? I tried in script editor but whenever I compile the script chinese characters gets changed to some garbage character. What should I do?



--

There are many things in your life that will catch your eye but only a few will catch your heart....pursue those'.
 _______________________________________________
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: Applescript localization support
      • From: Philip Aker <email@hidden>
References: 
 >Applescript localization support (From: "parag vibhute" <email@hidden>)
 >Re: Applescript localization support (From: "parag vibhute" <email@hidden>)
 >Re: Applescript localization support (From: Christopher Nebel <email@hidden>)

  • Prev by Date: Re: Is Image Events working under Leopard?
  • Next by Date: Re: Applescript localization support
  • Previous by thread: Re: Applescript localization support
  • Next by thread: Re: Applescript localization support
  • Index(es):
    • Date
    • Thread