我想構建一個android庫(jar文件)。該jar文件需要進行本地化。像我有一個類:如何在android庫中支持本地化
class MyMessageService
{
//Needs to return different languages message according to locale
String getMessage1();
}
我試圖在罐子包裝res/values/string.xml
和R.class
。
但其中引用的jar我的主應用程序,我稱之爲
String s = this.getResources().getString(mylibrary.localize.R.string.hello);
我的「S」,這是從我的主項目(資源ID碰撞)。
有沒有什麼辦法可以創建一個支持本地化的android庫?我不能讓主應用程序導入我的圖書館資源,因爲我的圖書館應該單獨出貨。
您是否閱讀了本文檔? http://developer.android.com/guide/topics/resources/localization.html – hovanessyan
也許這可以幫助你:http://www.kobu.com/i18n/android/index-en.htm – saini
請注意,我我正在圖書館工作。以上兩個鏈接都是關於應用程序,而不是庫 – goodier