viridis
viridis

Reputation: 177

Best way for i18n l10n in Android for SQLite database

I am using SQLite to store questions in a trivia-like android game. I have followed the tutorial on using own SQLite database:

http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/

I would like to add i18n functionality, and I wonder if the table android_metadata can be used for this (and how) or is intended for something else and I would better add a field for i18n.

If android_metadata table was to be used: how it could link to each question stored in the QUESTIONS table?

My current database has only one table (apart from android_metadata) with this structure:

CREATE TABLE "QUESTIONS" (
_id INTEGER, 
question TEXT,
answer TEXT
)

Thanks in advance, Daniel.

Upvotes: 0

Views: 625

Answers (1)

stefan bachert
stefan bachert

Reputation: 9626

Add a field for your the different locales

CREATE TABLE "QUESTIONS" (
 _id INTEGER, 
 language TEXT,
 question TEXT,
 answer TEXT
)

and use language in the appropriate queries

Upvotes: 1

Related Questions