Re: How to store different languages
Date: Mon, 22 Apr 2019 18:44:41 +0200
Message-ID: <q9kr1n$e66$1_at_gioia.aioe.org>
> Add a language_id to every table that has descriptions
>
> so for Inredients:
> ingredients
> -------------------
> id | language | name
> -------------------
> 1 | 0 | milk
> 2 | 0 | spelt
> 3 | 0 | onion
Thank you for your reply, I try to understand what you wrote with an example:
languages
id | name
0 | English 1 | Dutch 2 | Italian
ingredients
id | FK_id_language | name
1 | 0 | milk 2 | 0 | spelt 3 | 0 | onion
ingredient_langs
FK_id_ingredients| FK_id_language | name
1 | 1 | melk ? | 1 | boter ? | 1 | eieren
Or maybe the id of the ingredient_langs table is not a FK but every time I can link a new ingredient to the ingredients table if exits a english version...
> SELECT ingredient.name
> from ingredients, users
> where id=3 and language_id = users.language_id
> order by language_id desc
> limit 1
>
> This should give description in language of user, and when the
> description in the language of the user does not exist it will show the
> default ('0') description.
[Quoted] I understood it but I'm sorru I don't understand how to create tables :\
^Bart Received on Mon Apr 22 2019 - 18:44:41 CEST