StringyString part II

A fully automated alternative to STRINGIFY(StringString).

Select your app target in the Project Navigator and select Build Phases.

Click + to create a new Run Script item phase and drag it immediately below the top Target Dependencies item.

Set the shell to /usr/bin/ruby.

Copy the following into the text area:

strings_path = "#{ENV['SRCROOT']}/path/to/en.lproj/Localizable.strings"  
header_path = "#{ENV['SRCROOT']}/path/to/LocalizableStrings.h"  
regexp = %r{  
    ^     # start of line
    \s*    # optional whitespace
    "      # open quote
    (\w+)  # captured identifier
    "      # close quote
    \s*    # optional whitespace
    =      # =
    \s*    # optional whitespace
    "      # open quote
    .*     # any text
    "      # close quote
    \s*    # optional whitepace
    ;      # semi-colon

if !File.exist?(header_path) || < then, "w") do |f|
    IO.readlines(strings_path).each do |line|
      match = regexp.match(line)
      if match then
        f.write("static NSString *#{match[1]} = @\"#{match[1]}\";\n")

Edit strings_path to point to the source Localizable.strings file.

Edit header_path to point to the desired destination header file.

Add the destination header file to your precompiled (".pch") header file.

When the project is built, the header file will be written if it's missing or out of date. For each string in the .strings file

"FooString" = "Hello Foo";

the header file will contain a corresponding string definition

static NSString *FooString = @"FooString";