I have a Constants.h which has all strings which are used allover my app.
#define kGuideTitle @"Guide"
#define kSeatingTitle @"Seating"
#define kNotesTitle @"Notes"
#define kQuestionsTitle @"Questionnaire"
#define kTimelineTitle @"Timeline"
#define kMessagesTitle @"Messages"
Now I have a pressing need to localize that file to support multiple languages(5 languages).
I have got the translation for each language i need to support.
So I added lanugage support for Constants.h file from the inspector. And XCode created versions of Constants.h file for each language.
After that I edited the contents of the language specific files, like this.
Constants.h(Dutch)
#define kGuideTitle @"Leitfaden"
#define kSeatingTitle @"Sitzplan"
#define kNotesTitle @"Notizen"
#define kQuestionsTitle @"Fragebogen"
#define kTimelineTitle @"Zeitlinie"
#define kMessagesTitle @"Nachrichten"
But when I run the code in the simulator(Simulator language was set to Dutch), I am seeing only English version of the text all over the app. Why is it so?
Can any file be localized or only the localizable.strings file can be localized?
(I dont want to rework on shifting everything to localizable.strings file).
Can anyone please help?
Thanks very much.
You can’t do it like that. A
#defineis replaced during the pre-processor stage before your code hits the compiler. i.e. only one set of your languages will ever get “compiled in”. You will need to use localised strings.