Although I am not entirely sure if I get this correctly, I will try to answer your question TTBOMK.
Suppose you’re using NSLocalizedString(key, comment)
from in your code. You can clearly see that the first argument is actually is a key for a string, rather than the translated (or to be translated) string itself. Therefore when you “write code” you actually don’t write strings in base language — or any other language for that matter. You should think it as if you're adding string placeholders in your code.
Later on, you’re supposed to create a Localizable.strings
file for each language you would like to support, in the form of key = value;
. To make your UI appear at least in one humanly–readable language you should at least have one Localizable.strings
file with proper string values for each placeholder key.
For example: if you had NSLocalizedString(@“ConfirmationButtonTitle", @“Yada yada”)
in your code, then it makes totally sense having a Localizable.strings
file that contains ”ConfirmationButtonTitle” = “Tap here to confirm”;
element in it. If you don’t create a Localizable.strings
file or no Localizable.strings
file contain ConfirmationButtonTitle
key, then button title falls back to ConfirmationButtonTitle
, since it is the name of the placeholder key.
Having said that, most people prefer naming their keys exactly as string values for various reasons. This is arguably a convenient — and very common — practice, but could lead to conflicts in people’s minds.
So, if you were to create the previous NSLocalizedString
example like NSLocalizedString(@“Tap here to confirm", @“Yada yada”)
instead, then your default/base Localizable.strings
file would probably contain an element like “Tap here to confirm” = “Tap here to confirm”;
.
What happens here isn’t that you’re repeating yourself, but instead you’re naming your key exactly as your base language’s string value, that’s all.
EDIT
There always have been a base language concept, but as I understand it Xcode 5 emphasizes this even more: that’s good. If your base language is English, then you don’t have to have a Localizable.strings
file for English, again.