As a followup to posting my Localising Cocoa Apps talk I thought I’d outline some of my favourite localised string failures.
The “I heard literal strings in code are bad” kind of localisation
The “WTF is the comment for anyway” kind of localisation
The “out of sight out of mind” kind of localisation
Yes, that’s redefining the macro to hide the comment…
The “entire book as a key” kind of localisation
The “key can be anything but I know what it is” kind of localisation
The grey area
Duplicating keys
This is in the grey area because good distinct comments can make duplicating keys manageable as good comments show you the key’s appearances in your app in the .strings file.
genstrings
will warn you about duplicate keys- Bad/stupid/empty comments make this a bad offender
- keys with
nil
or@""
comments aren’t picked up as duplicate
Using localised strings in format strings
This is in the grey area because it’s inflexible and implies a structure, but can be okay for small strings. Often you should consider NSNumberFormatter for numbers
Localising the format string too
This is in the grey area because at this point we’ve got localised pieces everywhere. But it’s good that you’re trying though…