Re: Preferences and l10n
Re: Preferences and l10n
- Subject: Re: Preferences and l10n
- From: Jean-Christophe Helary <email@hidden>
- Date: Wed, 20 May 2015 11:32:45 +0900
> 2015/05/18 9:16、Shane Stanley <email@hidden> のメール:
>
> On 17 May 2015, at 11:08 pm, Jean-Christophe Helary <email@hidden> wrote:
>>
>> 1) extract all "local" information (like paths etc) and put them in a preference file
>
> Traditionally AppleScript scripts have just properties, and it hasn't really caught up with the fact that that's no longer acceptable in many situations. There is no built-in method for saving a preference file, so it's essentially a matter of rolling your own, using read/write commands or something like NSUserDefaults. I have an ASObjC script library that does it using user defaults, if you or anyone is interested.
I mostly save the scripts as applications because I can launch them with Spotlight. I tried various ways to set shortcuts to them but none was satisfying.
I was thinking that since Script Editor allows for saving them as applications, there would be an implicit way to access the bundled Info.plist...
In the case of my script, I just want to have the user enter values in the various dialogs and those values would be remembered as defaults for the next launch.
Is it better to store such values in the Info.plist or to put them into ~/Library/Application Support/... ? And if I absolutely want to use Info.plist, is there a way for the Application to actually know where its location is ?
>> 2) create localized versions
>
> You have to create the .lproj folders and .strings files yourself manually. Standard Additions gives you access via the 'localized string' command.
Ok, so instead of using, say:
display alert "not localized arbitrary string"
I would use
display alert (localized string of arbitrary_string_key)
> For common things like date- and time-related names, it's simpler to use ASObjC, provided your target is 10.9 or later. For example:
Thank you for the info about dates. I don't use them now but that's good as reference.
Jean-Christophe
_______________________________________________
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