Reputation: 177
My database structure is something like this :
'Article'
title
text
user_id
language_id
'User'
id
language_id
'language'
id
language name
Is it good practice to manage such a language list using a mysql database?
I'm a designer, but as far as I understand, queering a database less is better. Since the languages will be more or less static, expanding gradually, yet be loaded several places on the site (user options, writing articles, changing site language etc) I'm thinking that my structure is terrible. I don't know how to pul it off or how it would replace my current list. I'm thinking JSON.
I'd like to get some sort of confirmation before I start rewriting everything.
Upvotes: 0
Views: 111
Reputation: 19899
The only issue I can see is: What if a user writes in more than one language? If that is the case, you shouldn't be storing the language id in the user's table, simply because it would be much more simpler to query the Article table to find all of the languages that a user has written articles in:
'Article'
id
title
text
user_id
language_id
'User'
id
'Language'
id
language name
Upvotes: 1
Reputation: 920
It all depends on how big the list of translations will be. The fastest solution would be to store the languages in files, and include the right file based on the users selection.
Edit: I might have misunderstood this completely. My impression was that you are building a list of translations so that the user can choose to view the website in different languages. You need to clarify.
Upvotes: 0