• 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
Localize Attributed Strings?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Localize Attributed Strings?


  • Subject: Localize Attributed Strings?
  • From: "Chunk 1978" <email@hidden>
  • Date: Sat, 3 Jan 2009 19:02:03 -0500

is this possible?  i have a string that changes color and size
according to the length of the words in the string.  however, these
words and their lengths change in different languages.  clearly i
could add and NSLocalization wrapper to the string, but the problem is
that the attributes would remain the same.

-=-=-=-=-
NSMutableAttributedString *dayOfWeekStringAttributes =
[[NSMutableAttributedString alloc] initWithString:[NSString
stringWithFormat:@"Day Of Week - %s", dayOfWeek]];
[dayOfWeekStringAttributes addAttribute:NSForegroundColorAttributeName
value:[NSColor grayColor] range:NSMakeRange(11,
([dayOfWeekStringAttributes length]-11))];
[dayOfWeekStringAttributes addAttribute:NSFontAttributeName
value:[NSFont menuFontOfSize:10] range:NSMakeRange(11,
([dayOfWeekStringAttributes length]-11))];
[dayOfWeekStringAttributes addAttribute:NSFontAttributeName
value:[NSFont menuFontOfSize:14] range:NSMakeRange(0, 11)];

[theMenuItem setAttributedTitle: dayOfWeekStringAttributes];
[dayOfWeekStringAttributes release];
-=-=-=-=-
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Localize Attributed Strings?
      • From: Alastair Houghton <email@hidden>
  • Prev by Date: Finding bounding rect of substring inside a wrapped string
  • Next by Date: Using the security framework
  • Previous by thread: Re: Finding bounding rect of substring inside a wrapped string
  • Next by thread: Re: Localize Attributed Strings?
  • Index(es):
    • Date
    • Thread