开发者

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

开发者 https://www.devze.com 2023-01-18 18:00 出处:网络
In Android I put my application strings in a file called strings.xml.For example, for an Italian translation I need to c开发者_JAVA百科reate a values-it folder and put a strings.xml file with Italian

In Android I put my application strings in a file called strings.xml. For example, for an Italian translation I need to c开发者_JAVA百科reate 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消