translations Archives

How to retrieve the current User Locale

The following method will return a two letter code of which language is set on the iOS device in question: NSString *myLanguage = [[NSLocale preferredLanguages] objectAtIndex:0]; There’s a list of language codes on Wikipedia: http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes Note that to compare the current value against a list of languages you support we need use the isEqualToString method. Here’s […]

How to localize your project in Xcode 4.4

Before we start we need to create a new file called Localizable.strings (from File – New – Resource – Strings File). Xcode needs one file per language. Next we create localized copies of our files: head over to your Project Editor (the big blue icon) select it again under Project (another blue icon) make sure […]