Macro

NSLocalizedString

Returns a localized version of a string.

Declaration

#define NSLocalizedString

Parameters

key

The key for a string in the default table.

comment

The comment to place above the key-value pair in the strings file.

Return Value

The result of invoking localizedStringForKey:value:table: on the main bundle passing nil as the table.

Discussion

Use this macro to generate the default Localizable.strings file from your code using the genstrings utility. You can specify Unicode characters in key using \\Uxxxx—see the -u option for the genstrings utility. The initial value for key in the strings file will be key. Use the NSLocalizedStringWithDefaultValue macro to specify another value for key.

As of OS X 10.11 and iOS 9, NSBundle is thread-safe. As such, NSLocalizedString can safely be called from any execution context.