Re: How to store different languages

From: Luuk <luuk_at_invalid.lan>
Date: Tue, 23 Apr 2019 19:44:46 +0200
Message-ID: <5cbf4f0d$0$22343$e4fe514c_at_news.xs4all.nl>


On 22-4-2019 20:11, ^Bart wrote:

>> i.e.
>>
>> http://www.mysqltutorial.org/mysql-create-table/
>>
>> ;)

>
> Ahahah! Lol! :D
>
> I understood your db idea, so you think to create a languages table,
> ingredients table and users table.
>
> In the ingredients table you have id not primary key and not
> autoincrement so it'll be
>
> languages
> -----------
> id | name
> ------------
> 0  | English
> 1  | Dutch
> 2  | Italian
>
> ingredients
> ---------------------------
> id | FK_id_language | name
> ---------------------------
> 1  | 0              | Milk
> 1  | 1              | Melk
> 2  | 0              | Spelt
> 3  | 0              | Onion
> 4  | 1              | Boter
> 5  | 1              | Eieren
> 1  | 2              | Latte
> 6  | 2              | Miele
>
> But I should start to add every ingredients in the main language
> (english) also if the ingredient doesn't have a translation.
>
> You're the second person who said the same solution to solve my
> "problem" and I understood it's the right solution but... what do you
> think about my first idea to create a main language table with every
> english ingredients and a translation table connected to the main table
> by a FK?
>
> If I use my idea I should copy in the translation table also all english
> ingredients and set them like "english" in the language column!
>
> ^Bart

[Quoted] There is no need to have two tables, because one table can have a foreign key which refererd to the table itself.

see: https://stackoverflow.com/questions/7230145/mysql-foreign-keys-on-self

[Quoted] But i am not an expert in foreign keys.... ;)

-- 
Luuk
Received on Tue Apr 23 2019 - 19:44:46 CEST

Original text of this message