V
V
Vladimir Kozhevnikov2014-03-13 21:29:12
Android
Vladimir Kozhevnikov, 2014-03-13 21:29:12

Android, sqlite - how to implement localization?

Good afternoon.
Given: android application, sqlite database where the application takes rows from.
Please advise how to localize? From current thoughts - to create a database for each locale and select the one you need by checking the current locale of the user, or place the lines for all locales in one database, in different columns and pull out the necessary data with the same check, but it all looks like a crutch. Maybe there is a more elegant solution?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stepan, 2014-03-13
@L3n1n

From current thoughts, create a database for each locale and select the one you need by checking the current locale

Why base? After all, each locale can have its own table with the same fields.
For example, lang_ru lang_us... The processing of the results is the same for all, but the selection is from different tables.
Of course, you can add the prefix _ru, _xx to each field and put it in one table.
But ... Android has its own localization system. Why reinvent the wheel?

G
gleb_kudr, 2014-03-14
@gleb_kudr

In the database:
1. Table of languages. Enumeration of language variants and their properties (including table names)
2. Each language has its own table with all translations. + one base or invariant table with primary key.
This works quite well in practice.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question