单独的 APK 中的语言资源?
我想知道是否可以创建一个单独的 APK 文件,其中仅包含特定于语言的字符串,并以某种方式说服我的程序尝试首先从该包的资源中读取字符串资源,然后从程序自己的资源中读取字符串资源...我想有一个包含 2-3 个主要语言的主程序,其余语言将放入单独的语言包中。 (这是为了保持主程序的大小较小,因为我已经有 12 个翻译)
I'm wondering if it is possible to create a separate APK file which contains only language specific strings and somehow persuade my program to try to read the string resources first from that package's resource and then from the program's own resources... I would like to have a main program with 2-3 mayor laguages and the rest of the languages would go into a separate language pack. (This is to keep the main program size small as I have already 12 translations)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以通过
PackageManager
和getResourcesForApplication()
访问另一个 APK 的资源。这将允许您访问这些字符串。You can access another APK's resources through the
PackageManager
andgetResourcesForApplication()
. That will allow you to access those strings.查看此教程页面以了解如何使用图书馆资源 - 它可能会帮助您实现共享资源模型。请注意,由于某种原因,android SDK 2.0 和 1.5 之前版本无法创建库。 http://developer.android.com/guide/developing/eclipse- adt.html#libraryProject
Look at this tutorial page for using library resources - it may help you acheive a shared resources model. Note that android SDK 2.0 and pre-1.5 are not capable of creating libraries for some reason. http://developer.android.com/guide/developing/eclipse-adt.html#libraryProject