• 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: Localize Hide / Show menu?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Localize Hide / Show menu?


  • Subject: Re: Localize Hide / Show menu?
  • From: email@hidden
  • Date: Mon, 3 Dec 2001 20:29:30 +0100

Le lundi 3 dicembre 2001, ` 06:12 , Stiphane Sudre a icrit :

Stupid suggestion:

why don't you just set the complete Menu Item title in your validateMenuItem method using the NSLocalizedString class of methods ?

It is certainly feasible but implies that the strings are in Localizable.strings, though their obvious place is in mainMenu.nib. This is inconvenient for localizers (they have to figure out the link between the menu item and theses strings). This is also inconvenient for the programmer, since you have to remember to load the strings as appropriate,
and to rely either on the tag of the menu (error prone), to its non-localized string (oops) or to its selector (like in your code; this is likely to break if you change the selector, if you append another menu item with the same selector, etc.). If you have a number of menus like that, you have to be very careful for each change... this is the opposite of encapsulation, one of the major benefits of nibs IMHO.


Le lundi 3 dicembre 2001, ` 08:09 , Ondra Cada a icrit :
t> My solution (please don't laugh) is to put the whole string
t> "Hide something/Show something"
t> in the menu and then programmatically separate it by components in
t> validateMenuItem (in particular I assume that the real menu menu items
t> doesn't contain a slash).

Though, I personally like this way too, and my own (Epoc-based in this case)
framework does exactly that (with some little differencies, like that the
separator is a backslash, or that there can be more than two menu titles
/just like that there can be more states of a control/).
---
Ondra Cada

Yes. So the point is to find an elegant way to do that. I put both strings together in the menu, then do the following test: if the menu item has a slash, I split the string, then put both parts in an array which is now the "represented object" of the menu. Then validateMenuItem has just to change the items using the represented object (alternating between the strings).

Thomas Lachand-Robert
********************** email@hidden
<< Et le chemin est long du projet ` la chose. >> Molihre, Tartuffe.


  • Follow-Ups:
    • Re: Localize Hide / Show menu?
      • From: Stéphane Sudre <email@hidden>
  • Prev by Date: Re: Question
  • Next by Date: Re: NSUserDefaults and the synchronize: method - doesn't seem to sync...
  • Previous by thread: Re: inserting non RTF graphics into an NSTextView ?
  • Next by thread: Re: Localize Hide / Show menu?
  • Index(es):
    • Date
    • Thread