Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Localizing applescript source code



At application startup time, handlers connected to the application object are called in this order:

1. will finish launching
2. awake from nib
3. launched
4. will become active
5. activated
6. idle

Before any handlers are called for the application object (with the exception of the will finish launching handler, which is always called first, if present), the applications main nib file is loaded, all its objects unarchived, and awake from nib called for any objects that have that handler connected. So an awake from nib handler connected to an object in the applications main nib file, such as the applications main window, will be called before any handlers connected to the application object itself.

If you read from user defaults (using a default plist if user defaults is empty) in the will finish launching handler, you'll have your properties when you need them. I hope this helps.

Topher

On Tuesday, August 26, 2003, at 01:18 PM, email@hidden wrote:

OK, all is almost well but...

My application *needs* 5 initial properties at launch, is there any way
to set the value of those properties via Localized.strings?
I tried:

property this_initial_setting : localized string "INITIAL_SETTING" from
table "Localized"

which seems to compile OK but throws an error at build, saying it
doesn't understand the message.

They can't be hardcoded (as in set this_initial_setting to localised
string...) because after the first use, the Default entries will be
created, and hardcoding the properties would override the User Defaults.

Also, I read over at ADC that it is best to user the 2 letter country
code when localizing, so why does PB create 'English.lproj' and
'French.lproj' instead of 'En.lproj' and 'Fr.lproj' ??? I sthere a
setting somewhere in PB to change this?

Thanks again for any help!

Guy

Hi Tim,
Cheers for the pointer.
And now I wonder why the hell I was trying to make so difficult, when
it's sooooo easy!!!

Hi Guy,

As of AppleScript Studio 1.1 there is built in support for handling
localized strings. Look at the "localized string" command in the
AppleScript Studio Reference for information and examples of how to
use it.

Tim Bumgarner
AppleScript Engineering

Hi all,

I'm trying to localize my app to French, so far I know how to deal
with the NIB files, but would appreciate pointers as far as
localizing
strings generated by the script itself (dialogs, title, text
fields...). I've read a bit about the NSLocalizedString() and
.strings
file method on Apple's Dev site but don't quite understand how to
implement it in an AppleScript application (if at all possible).

In my script, if I have:

set title of cell "cell_" of matrix "matrix_" of window "window_" to
"Use this new title"

and I thought I could just replace it to:

set title of cell "cell_" of matrix "matrix_" of window "window_" to
NSLocalizedString("this string")

and it would read from the .strings file:

/* this entry for cell title of matrix */
"this string" = "Use this new title";

But that doesn't work, as the NSLocalizedString() turns into a
variable (green when compiled).
So I'm obviously missing the point somewhere.

Any help much appreciated!
--
autoMAC-it
mailto:email@hidden
visit: http://www.dizzypenguin.com/automac-it/
_______________________________________________
applescript-studio mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-studio
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-studio mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-studio
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Localizing applescript source code (From: email@hidden)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.