title: Dynamic, localized NSString
body: <p>I need to build an NSString that resembles the following:</p>
  
  <p>Name: Craig Buchanan<br/>
  Telephone: 800-555-1212<br/>
  Email: name@company.com<br/></p>
  
  <p>Where:</p>
  
  <ul>
  <li>each line (e.g. Telephone) is included or excluded based on the value of a UISwitch </li>
  <li>the key part of the string (i.e. the part to the left of the ':') is localized </li>
  <li>the value part is from a UITextField.</li>
  </ul>
  
  <p>My approach:</p>
  
  <pre><code>NSMutableArray *values = [[NSMutableArray alloc] initWithCapacity:3];
  
  if (self.nameSwitch.isOn) 
      [values addObject:[NSString stringWithFormat:@"%@: %@", NSLocalizedString(@"Name", @"Name label"), textFieldName.text]];
  if (self.telephoneSwitch.isOn)
      [values addObject:[NSString stringWithFormat:@"%@: %@", NSLocalizedString(@"Telephone", @"Telephone number label"), textFieldTelephone.text]];
  if (self.emailSwitch.isOn)
      [values addObject:[NSString stringWithFormat:@"%@: %@", NSLocalizedString(@"Email", @"Email address label"), textFieldEmail.text]];
  
  return [values componentsJoinedByString:@"\r"];
  </code></pre>
  
  <p>I have a few questions:</p>
  
  <ul>
  <li>is this a decent approach (i'm an objective-c noob)?</li>
  <li>i realize that my array is autoreleased, but still i'm concerned about memory usage.  should i release the auto-release pool?  seems a bit dangerous.</li>
  <li>i'm hoping to make the code a bit more dynamic.  my initial thought is to create an array of outlet variables, then use the UISwitch's tag to store the key that drives the localization.  thoughts?</li>
  </ul>
  
  <p>Thanks for your time,</p>
  
  <p>Craig Buchanan</p>