Monotouch如何管理资源(字符串,图像等)? [英] How does Monotouch manage resources (strings, images, etc.)?

查看:106
本文介绍了Monotouch如何管理资源(字符串,图像等)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android中,我将应用程序字符串放在名为 strings.xml 的文件中。例如,对于意大利语翻译,我需要创建一个values-it文件夹,并在此新文件夹中放入一个带有意大利语标签的 strings.xml 文件。

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.

Monotouch如何管理字符串的国际化?

How does Monotouch manage such internationalization of strings?

推荐答案

您通常会使用Apple的本地化功能 - 应用程序包中包含本地化版本的笔尖,文件,字符串资源等的特殊lproj文件夹。

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.

您可以在 Apple的iOS国际化文档,还有一些第三方教程非常有用。

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

虽然MonoDevelop没有提供任何明确的本地化支持,只需添加lproj文件夹即可您的项目根目录并将其内容标记为内容应该将它们正确地添加到应用程序包中。

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.

从捆绑包加载的任何资源都应该加载适当的本地化版本,如果有的话。这包括自动从bundle中加载项的API,例如从xibs / nibs实例化视图,以及API以显式检索bundle中的资源。例如 NSBundle.LocalizedString 将从您的字符串资源中加载相应的字符串。

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.

这篇关于Monotouch如何管理资源(字符串,图像等)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆