NSError localizedDescription in another language

Even if the operating system language has been set to something else (such as Finnish), NSError.localizedDescription seems to always have the description in English. I need the error message provided by the system in Finnish, but I have no idea how to achieve this.


Somebody on the internets says that in order to achieve this, one has to create a new localization in the Xcode project (which happens on the Info pane of the project settings). I don't need localizations per se, because this project is supposed to be in one single language. Either way, when I try to add a new localization (by clicking on the + button and selecting "Finnish") nothing happens. It shows an empty list of files to localize, and when I click the Finish button, nothing at all happens. No new localization is added to the list.


(I'm wondering if this happens because the project has been created in an unconventional manner. More precisely, it has been created by SpriteBuilder. Changing the project to something else is pretty much out of the question, so that's not a solution.)


I just want the Finnish version of localizedDescription. How can I retrieve it from the system?

Answered by QuinceyMorris in 86833022

Sorry you haven't got any responses so far. Part of the problem is that this Cocoa forum may be one of the less trafficked areas, so fewer people see your post. There's also an issue that many people who have lots of Cocoa experience avoid answering if they're not really sure of the answer, so as not to give out bum information just to be "helpful". But since you're not getting any answers, I'll take a stab at it.


You can't add a Finnish localization, I think, because your app doesn't contain any localizable files (such as a localizable Strings file). So, one possible solution would be to create a default Strings file, but leave it empty. This shouldn't cause your app to behave any differently, AFAIK. Then you should be able to add a Finnish localization (still with no actual localized data, just the empty file), and then your app should be launched in Finnish.


Another, simpler way (though I've never tried this) would be to edit your project's info.plist (select the project entry in the Xcode navigator, then click on the Info tab) and change the "localization native development region" from "en" to the correct country code for Finland. This might be enough to get the localizedDescription for system-generated errors to show up in Finnish.

I would really need an answer to this question. It's still unresolved.

Could someone at the very least direct me to a forum where somebody could possibly know the answer to this question? (Even a "it's not possible" would be better than total silence. That way at least I would know for certain.)


Honestly, 90% of the questions I ask on the Apple developer forums go completely unanswered. It's highly annoying. One would think that this is the best place to ask technical questions about iOS, given that it's the official support forum, but seemingly not.

I don't understand what the purpose of this forum is. I ask a question, and receive no answers whatsoever from anybody. Not from Apple, not from anybody else. Any answer would be preferable to absolute silence. But I get nothing.


What use is this forum if nobody answers the simple questions that developers have? Frankly, this is getting on my nerves.

Accepted Answer

Sorry you haven't got any responses so far. Part of the problem is that this Cocoa forum may be one of the less trafficked areas, so fewer people see your post. There's also an issue that many people who have lots of Cocoa experience avoid answering if they're not really sure of the answer, so as not to give out bum information just to be "helpful". But since you're not getting any answers, I'll take a stab at it.


You can't add a Finnish localization, I think, because your app doesn't contain any localizable files (such as a localizable Strings file). So, one possible solution would be to create a default Strings file, but leave it empty. This shouldn't cause your app to behave any differently, AFAIK. Then you should be able to add a Finnish localization (still with no actual localized data, just the empty file), and then your app should be launched in Finnish.


Another, simpler way (though I've never tried this) would be to edit your project's info.plist (select the project entry in the Xcode navigator, then click on the Info tab) and change the "localization native development region" from "en" to the correct country code for Finland. This might be enough to get the localizedDescription for system-generated errors to show up in Finnish.

Thank you for your answer.


I tried to add an empty Localizable.strings file to the project, but when I try to add a new localization, it still shows an empty list, and no localization is added.


I had looked at that Localization native development language option in Info.plist, which value is a drop-down menu. However, there is only a very small selection of entries in it, and "Finnish" is not one of them.


I didn't realize that I had to actually edit the text "English" into "Finnish". Now the messages are indeed coming in Finnish!


Thank you.

NSError localizedDescription in another language
 
 
Q