[英]Android APP multilanguage SQLite
我會完全翻譯我的Android應用程序。 (這包括在電話語言上顯示的SQLite)
就像現在連接;
private static final int DATABASE_VERSION = 5;
private static final String DATABASE_NAME = "quotes.db";
private static final String DB_PATH_SUFFIX = "/databases/";
private static final String TABLE_QUOTES = "quote";
private static final String KEY_ID = "_id";
static Context myContext;
public DataBaseHandler(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
myContext = context;
}
我曾考慮過刪除名稱字符串數據庫,並使用strings.xml文件將其傳遞給名稱數據庫。
超級(上下文,context.getResources()。getString(R.string.DATABASE_NAME),null,DATABASE_VERSION);
還要查找通過string.xml傳遞的查詢,但找不到清晰的文檔。
如果我不做任何指導,我將不勝感激。 非常感謝。
查詢示例:
// Select All Query
String selectQuery = "SELECT name, COUNT(author_name ) AS count FROM author LEFT JOIN quote ON name = author_name WHERE name LIKE '%"
+ value + "%' GROUP BY name ORDER BY name ASC";
我修改表sqlite並添加“ + Locale.getDefault()。getLanguage()+”代碼:
String selectQuery = "SELECT quote._id, quote.author_name_"+ Locale.getDefault().getLanguage() +", quote.qte_"+ Locale.getDefault().getLanguage() +
", quote.category_name_"+ Locale.getDefault().getLanguage() +",fav FROM quote,author where author.name_"+ Locale.getDefault().getLanguage()+
" = quote.author_name_"+ Locale.getDefault().getLanguage() +" and quote.category_name_"+ Locale.getDefault().getLanguage() +
"!='Tips Romanticos' ORDER BY quote.author_name_"+ Locale.getDefault().getLanguage() +" "+limit;
查詢結果為:
選擇quote._id,quote.author_name_es,quote.qte_es,quote.category_name_es,fav引號,作者,其中author.name_es = quote.author_name_es和quote.category_name_es!='Tips Romanticos'OR BY BY quote.author_name_es LIMIT 50
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.