In the app I’m working on, we use all-uppercase strings for certain UI elements.
Sometimes that means, for our Localizable.strings
file, if you were to import as-is all the strings from our NSLocalizedString
API calls, you’ll have an entry for the title-case version as well as the all-caps version. For example, you might have both “My Profile” and “MY PROFILE” strings.
What I’d like to do (and I’m not alone in this idea) is only ever use the title-case strings in code, so that we have fewer and more consistent (and more flexible) entries in the strings file. If I need the all-cap version of that string, I’ll use an Apple API like localizedUppercaseString
to get it.
So instead of having this in your code, and two entries in your strings file:
NSLocalizedString(@"My Profile", @"Title for My Profile section of user interface"); NSLocalizedString(@"MY PROFILE", @"Title for My Profile section of user interface");
You would have this, and only one entry in your strings file:
NSLocalizedString(@"My Profile", @"Title for My Profile section of user interface"); NSLocalizedString(@"My Profile", @"Title for My Profile section of user interface").localizedUppercaseString;
My question is whether this might lead to problems.
A quick Internet search tells me that only Roman, Greek, Cyrillic, and Armenian scripts even have the concept of upper case (source). But I’m also reading that there are ways in other languages and scripts to convey emphasis.
Would a human translator do a better job at appropriately conveying the uppercase nature of a string in other languages and scripts, in a way that Apple’s APIs would not? Or do Apple’s APIs give you basically the same results a translator would give you, or at least what people expect in most localized applications?
Does anyone have real-world experience with Apple’s APIs for this? I’m interested especially in non-European languages, where it will be harder for me to verify that the results are correct.
Let me know in the comments or on Twitter. Thanks!
Note 1: This post originally referred to uppercaseString
by mistake; I always meant localizedUppercaseString
.