On 1 Apr 2008, at 12:25, Jean-Daniel Dupas wrote:

The strings you are looking for are in the AppKit ressources, but I don't think there are part of the API, the keys can change at anytime and you cannot rely on the files names. (in Leopard, the Undo.strings file contains a "Paste Font" key, but it's not garantee that it remain like that)

Anyway, you can probably copy this Undo.strings file in your application.


Le 1 avr. 08 à 11:52, Gerriet M. Denkmann a écrit :
Cocoa uses (automatically) localized strings. I would like to do the same.

E.g. using NSTextView and pasting a font, the Edit menu will suddenly show Undo "Paste Font". If the same app is running with German as the preferred language, the Edit menu will contain Undo "Schrift einsetzen" (yes, the "Undo" also gets translated, but this does not interest me at this point).

When I override this mechanism, doing my own undo handling I have to use setActionName: "Paste Font".
But this is only correct if the current language is English.

So I have to do: setActionName: NSLocalizedStringFromTable ( @"Paste Font", @"UndoStrings", @"setting font via menu Format → Font");

But this means that I have to create UndoStrings.strings files for about 15 languages, which is kind of tedious. Also: If Apple decides that the correct translation for "Paste Font" should be "Schriftart einfügen" instead of "Schrift einsetzen", my app would look strange, using different words compared to all other apps.

So I want something like: NSLocalizedStringFrom_the_Table_used_by_the_System(..). Or maby I could get at the official translations using NSDefaultManager?

Thanks a lot. I decided to use it like this:
NSBundle *appBundle = [ NSBundle bundleWithIdentifier: @"com.apple.AppKit" ]; NSString *localSetFont = [ appBundle localizedStringForKey: @"Set Font" value: nil table: @"Undo"];
Seems to work fine.

Kind regards,

Gerriet.

P.S. How can one paste into Mail without loosing all newlines?

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to