Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Monotouch manage resources (strings, images, etc.)?

In Android I put my application strings in a file called strings.xml. For example, for an Italian translation I need to create a values-it folder and put a strings.xml file with Italian labels inside this new folder.

How does Monotouch manage such internationalization of strings?

like image 933
Premier Avatar asked Sep 30 '10 13:09

Premier


1 Answers

You would generally use Apple's localization features - special "lproj" folders in your app bundle containing localized versions of your nibs, files, string resources etc.

You can find more info in Apple's iOS Internationalization docs, and there are also some third-party tutorials that are useful.

Although MonoDevelop does not provide any explicit support for localization, simply adding the lproj folders to your project root and marking their contents as "Content" should add them into the app bundle properly.

Any resource you load from the bundle should then load the appropriate localized version, if present. This includes APIs that automatically load items from the bundle, such as instantiating views from xibs/nibs, and also APIs to explicit retrieve resources from the bundle. For example NSBundle.LocalizedString will load the appropriate string from your strings resources.

like image 141
Mikayla Hutchinson Avatar answered Nov 10 '22 15:11

Mikayla Hutchinson