Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQlite Language based table selection

Tags:

android

sqlite

just for curious, i got a question!

My app is almost ready.. I have implemented bilingual (English/Tamil) when users select thr preferred language in Settings then whole app gets converted into that language (i used custom Locale). Everything works fine.

My question is, Can we do the same to SQlite database? which fetch data automatically based on locale from table "country-en"or"country-ta" ? is there any way? i heard that thr is a method SQLiteOpenHelper.onConfigure(setLocale()); to set locale in sqlitedatabase. i want to know how it works!

like image 774
Rafique Mohammed Avatar asked Mar 20 '23 11:03

Rafique Mohammed


1 Answers

The method you describe above is not related to language localization for the client. It's related to locale options on the database (for example how to treat string comparisons with accented characters).

Anyway, if you think of it... what does localizing a database mean? You can either localize the structure or the data. Localizing the structure (table names...) doesn't make sens because the user is not aware of it. Localizing the data doesn't make sense either, because that means that if the users changes language settings, next time he uses your app he won't see his data!

If the DB only contains static data and you need to provide a different DB for different languages, you could use localization to lookup for the database filename.

like image 180
Merlevede Avatar answered Mar 27 '23 16:03

Merlevede