I would like to localize my constants. Constants are defined and declared the usual way:
extern NSString * const kStringName;
NSString * const kStringName = @"Whatever...";
How to make it localizable? This just can not work...
NString * const kStringName = NSLocalizedString(@"Whatever...", @"Whatever...");
Thank you!
There are two categories of localized strings: the strings included in the installation package's UI, common to every MSI file. the strings included in your project, that are particular to the current project: the name of your application, file names, registry values, properties etc.
A string constant is an arbitrary sequence of characters that are enclosed in single quotation marks (' '). For example, 'This is a string'. You can embed single quotation marks in strings by typing two adjacent single quotation marks.
The key used to look up an entry in a strings file or strings dictionary file. iOS 13.0+ iPadOS 13.0+ macOS 10.15+ Mac Catalyst 13.0+ tvOS 13.0+ watchOS 6.0+
Answer. Explanation: A string constant consists of zero or more characters enclosed by apostrophes ( ' ) or quotes ( " ). ... This is because a quote character followed by a digit from 0 to 7 represents an octal numeric constant, not a string, and the character 9 is an illegal octal digit.
A const variable may already optimized at compile time so you can't change it at runtime. You simply can't have const localized strings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With