Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #18104

DB with a main language table and different kind of translations

From ^Bart <gabriele1NOSPAM@hotmail.com>
Newsgroups comp.lang.php
Subject DB with a main language table and different kind of translations
Date 2019-11-09 18:58 +0100
Organization Aioe.org NNTP Server
Message-ID <qq6un7$c5j$1@gioia.aioe.org> (permalink)

Show all headers | View raw


Hi everybody!

I'd like to create a db where I should store food recipes with 
ingredients translations, I thought to create these tables in MariaDB:

ingredients
------------------------
id_ingredient   name
1		sugar
2		eggs
3		flour

recipes
------------------------
id_recipe name	  FK_id_ingredient
1	  pasta   2
2	  pasta   3

languages
-------------------------
id_language	name
1		Italian
2		French
3		Spanish

ingredienttranslations
--------------------------
FK_id_ingredient FK_id_language name
1		 1		zucchero
2		 1		uova
3		 1		farina

I thought to create as primary key, in ingredienttranslations table, 
FK_id_ingredient+FK_id_language.

The user (I got also a table named users linked to languages!) will see 
ingredients in his own language but ingredients will be stored in 
recipe's table in main language (English), I'd like to use this idea 
because I could enable a fall back language feature when it's not 
available an ingredient translation!

I could have also two different table for recipes, one just to store 
recipe's name and another one just to store its ingredients!

I should create PHP code but I'd like to know your opinion!

Is my idea correct?
How could I improve my project?
Should I use tables without id column because the ingredient's name will 
never change?

Regards.
^Bart

Back to comp.lang.php | Previous | NextNext in thread | Find similar | Unroll thread


Thread

DB with a main language table and different kind of translations ^Bart <gabriele1NOSPAM@hotmail.com> - 2019-11-09 18:58 +0100
  Re: DB with a main language table and different kind of translations "J.O. Aho" <user@example.net> - 2019-11-09 20:33 +0100
    Re: DB with a main language table and different kind of translations robamman2019@gmail.com - 2019-12-22 02:53 -0800
  Re: DB with a main language table and different kind of translations Arno Welzel <usenet@arnowelzel.de> - 2019-11-09 23:52 +0100
    Re: DB with a main language table and different kind of translations ^Bart <gabriele1NOSPAM@hotmail.com> - 2019-11-10 10:19 +0100
      Re: DB with a main language table and different kind of translations Martin Leese <please@see.Web.for.e-mail.INVALID> - 2019-11-10 10:35 -0700
  Re: DB with a main language table and different kind of translations robamman2019@gmail.com - 2019-12-25 00:01 -0800
    Re: DB with a main language table and different kind of translations Jerry Stuckle <jstucklex@attglobal.net> - 2019-12-25 09:39 -0500
      Re: DB with a main language table and different kind of translations robamman2019@gmail.com - 2019-12-26 04:09 -0800
        Re: DB with a main language table and different kind of translations "J.O. Aho" <user@example.net> - 2019-12-26 14:01 +0100
          Re: DB with a main language table and different kind of translations robamman2019@gmail.com - 2019-12-26 08:28 -0800
            Re: DB with a main language table and different kind of translations "J.O. Aho" <user@example.net> - 2019-12-26 19:14 +0100
              Re: DB with a main language table and different kind of translations robamman2019@gmail.com - 2019-12-26 10:28 -0800
                Re: DB with a main language table and different kind of translations "J.O. Aho" <user@example.net> - 2019-12-26 20:40 +0100
                Re: DB with a main language table and different kind of translations robamman2019@gmail.com - 2019-12-26 12:23 -0800
                Re: DB with a main language table and different kind of translations Jerry Stuckle <jstucklex@attglobal.net> - 2019-12-26 17:08 -0500
                Re: DB with a main language table and different kind of translations robamman2019@gmail.com - 2019-12-26 17:41 -0800
                Re: DB with a main language table and different kind of translations Jerry Stuckle <jstucklex@attglobal.net> - 2019-12-27 10:33 -0500
                Re: DB with a main language table and different kind of translations robamman2019@gmail.com - 2019-12-27 12:55 -0800
                Re: DB with a main language table and different kind of translations Jerry Stuckle <jstucklex@attglobal.net> - 2019-12-27 17:51 -0500
                Re: DB with a main language table and different kind of translations kristjanman2k20@gmail.com - 2020-03-03 07:14 -0800
                Re: DB with a main language table and different kind of translations Jerry Stuckle <jstucklex@attglobal.net> - 2020-03-03 16:39 -0500
                Re: DB with a main language table and different kind of translations kristjanman2k20@gmail.com - 2020-03-03 14:43 -0800
                Re: DB with a main language table and different kind of translations Jerry Stuckle <jstucklex@attglobal.net> - 2020-03-03 21:39 -0500
                Re: DB with a main language table and different kind of translations kristjanman2k20@gmail.com - 2020-03-04 05:35 -0800
                Re: DB with a main language table and different kind of translations Jerry Stuckle <jstucklex@attglobal.net> - 2020-03-04 11:11 -0500
                Re: DB with a main language table and different kind of translations kristjanman2k20@gmail.com - 2020-03-04 08:17 -0800
                Re: DB with a main language table and different kind of translations Arno Welzel <usenet@arnowelzel.de> - 2020-03-04 08:08 +0100
                Re: DB with a main language table and different kind of translations kristjanman2k20@gmail.com - 2020-03-04 05:31 -0800
                Re: DB with a main language table and different kind of translations robamman2019@gmail.com - 2019-12-26 17:44 -0800
                Re: DB with a main language table and different kind of translations "J.O. Aho" <user@example.net> - 2019-12-27 10:55 +0100
                Re: DB with a main language table and different kind of translations robamman2019@gmail.com - 2019-12-27 13:20 -0800
                Re: DB with a main language table and different kind of translations "J.O. Aho" <user@example.net> - 2019-12-28 00:21 +0100
                Re: DB with a main language table and different kind of translations kristjanman2k20@gmail.com - 2020-03-03 07:22 -0800
                Re: DB with a main language table and different kind of translations "J.O. Aho" <user@example.net> - 2019-12-27 10:49 +0100
        Re: DB with a main language table and different kind of translations Jerry Stuckle <jstucklex@attglobal.net> - 2019-12-26 10:48 -0500
  Re: DB with a main language table and different kind of translations Richard Damon <Richard@Damon-Family.org> - 2019-12-25 09:36 -0500

csiph-web