title: Static NSLocalizedString
body: <p>After checking a number of topics, I still can't figure something out :  what is the (best?) way to use static NSLocalizedString, i.e. to statically allocate a NSLocalizedString and access it easily.</p>
  
  <p>Ideally, I would want to do something like that (which won't compile, with an <code>Initializer element is not a compile-time constant</code> error): </p>
  
  <pre><code> //Somewhere in my header
   static NSString* mystring = NSLocalizedString(@"min", nil); //Error : "Initializer element is not a compile-time constant"
  
   @implementation myClass
   (NSString*)aMethod
  {
      return myString;
  }
  @end
  </code></pre>
  
  <p>I know NSLocalizedString is a macro defined by <br><code>#define NSLocalizedString(key, comment) \
          [[NSBundle mainBundle] localizedStringForKey:(key) value:@"" table:nil]</code>,<br> but that is not helping much :S.</p>
  
  <h1>Why ?</h1>
  
  <p>Long story short, to prevent the multiple definition of the same string in multiple parts of a document (which would prevent a one-stroke edit in my whole app).<br></p>
  
  <p>Consider the example, where the redundancy of the definition is quiet explicit : </p>
  
  <pre><code>//MyDelegate.h
  @property IBoutlet NSTextField* myTextField;
  
  //MyDelegate.m
  @implementation MyDelegate.m
  @synthetize myTextField;
  -(void)setTextFieldToDefaultValue
  {
      [myTextField setStringValue:NSLocalizedString(@"Name",@"This field is used to write one's name");
  }
  -(BOOL)isTextFieldStringDefault:(NSString*)myString
  {
      return [[myTextField stringValue] isEqual:NSLocalizedString(@"Name",@"This field is used to write one's name")];
  }
  @end
  </code></pre>
  
  <p>Of course, it makes more sense in a project which is quiet dense and big, where the string would be used in difference methods, and in a context where you have use of a lot of similar localized strings.</p>