manpagez: man (manual) pages & more
man genstrings(1)
Home | html | info | man
genstrings(1)             BSD General Commands Manual            genstrings(1)


NAME

     genstrings -- generate string table from source code


SYNOPSIS

     genstrings [-a] [-s <routine>] [-skipTable <Table>]
                [-noPositionalParameters] [-bigEndian | -littleEndian] [-u]
                [-macRoman] [-q] [-o <outputDir>] file
                 ...


DESCRIPTION

     The genstrings utility generates a .strings file(s) from the C or Objec-
     tive-C (.c or .m) source code file(s) given as the argument(s).  A
     .strings file is used for localizing an application for different lan-
     guages, as described under "Internationalization" in the Cocoa Developer
     Documentation.

     * C and Objective-C:

     Source lines containing text of the form NSLocalizedString("key", com-
     ment) or CFCopyLocalizedString("key", comment) will generate an appropri-
     ate string table entry to a file named Localizable.strings.

     Source lines containing NSLocalizedStringFromTable("key", Table, comment)
     or CFCopyLocalizedStringFromTable("key", Table, comment) will generate an
     appropriate string table entry in a file named Table.strings.

     Source lines with NSLocalizedStringFromTableInBundle("key", Table, bun-
     dle, comment) or CFCopyLocalizedStringFromTableInBundle("key", Table,
     bundle, comment) will generate an appropriate string table entry in Ta-
     ble.strings.

     Source lines with NSLocalizedStringWithDefaultValue("key", Table, bundle,
     "value", comment) or CFCopyLocalizedStringWithDefaultValue("key", Table,
     bundle, "value", comment) will generate an appropriate string table entry
     in Table.strings.

     * Format Strings and Positional Parameters:

     Keys and values of string file entries can include formatting characters.
     For value strings with multiple formatting arguments, positional parame-
     ters are generated.  These allow the order of arguments to be changed as
     needed by each localization (e.g. "File %1$@ contains %2$d bytes." could
     become "%2$d bytes are contained in file %1$@." in another localization).

     * Encoding:

     By default, genstrings will read UTF-8 encoded source files and source
     files with no non-ASCII characters.  Mac Roman encoded files that contain
     non-ASCII characters will not be read successfully unless the -macRoman
     compatibility flag is used.  Developers are strongly encouraged to move
     to UTF-8 as the encoding for source files as the -macRoman option may be
     removed in future versions.

     Embedded non-ASCII characters in UTF-8 files, as well as non-ASCII char-
     acters specified by the escape sequences \uxxxx and \Uxxxxxxxx are read
     automatically by genstrings.  The -u option and genstrings-specific
     escape sequence are also supported.

     Generated .strings files are UTF-16 encoded.  Host endianness is used
     unless the -bigEndian or -littleEndian option is specified.  The endian
     options do not affect .strings files being appended to with the -a
     option.  The byte order of the existing file is maintained.


OPTIONS

     -a  Allows the output to be appended to the old output files. However, -a
         causes the results to be appended to the end of the old file and not
         merged.

     -s routine
         Substitutes routine for NSLocalizedString.  For example, -s MyLocal-
         String will catch calls to MyLocalString and MyLocalStringFromTable.

     -skipTable Table
         Causes genstrings to skip over the file for Table.  Note that any
         entries in this table will not be generated.

     -noPositionalParameters
         Turns off generation of positional parameters.

     -u  Allow unicode characters in the value of strings files.  Any occur-
         rence of \\Uxxxx (where xxxx are four hex digits) in the source code
         will be written to the strings file with its Unicode value (in terms
         of \\Uxxxx) for the key, but the actual Unicode value for its value.
         For Example, CFCopyLocalizedString(CFSTR("AB\\U0043D"), "Comment")
         will result in the key/value pair "AB\\U0043D" = "ABCD".

         Note that non-ASCII characters can now be handled automatically with-
         out this option.  See 'Encoding' section above for details.

     -macRoman
         For compatibility, read source files using Mac Roman encoding.  See
         'Encoding' section above for details.

     -q  Turns off multiple key/value pairs warning

     -o outputDir
         Specifies what directory the tables should be created in.

Mac OS X                          May 7, 2007                         Mac OS X

Mac OS X 10.6 - Generated Thu Sep 17 20:07:43 CDT 2009