Let me give you a few thoughts to ponder about.
Seeing you use PHP, you can use the gettext library. As far as I know, it does not use a database at all, but just translation files. See
for a nice explanation.
If you do want to use the database, think of what your entities are. I had the same problem once, and it led me to creating an "abstract"(*) table called "Phrase" with just an autonumber primary key. Together with a "Language" table, you could then look up the translation from the "Translation" table, which had foreign keys to both Phrase and Language. This way, any table could have a PhraseId for a column that would need translation (such as most lookup tables). Be prepared that this structure will have quite an impact on your database design and makes most records less recognizable by lack of text.
(*) A table with only one autonumber field may look funny, but there is nothing wrong about it. You can Issue queries like:
Code:
INSERT INTO Phrase() VALUES();
to insert a new phrase and use the last_insert_id mechanism to see what the (unique) ID is.
If you start your MySQL connection with a SET command, you can set the language for the whole connection as well:
Code:
SET @LanguageId=5;-- Just an example ID that should exist as a record in the Language Table. This sets the language.
SELECT RoleId, TranslatedText FROM Role INNER JOIN Translation ON Translation.LanguageId=@LanguageId AND Translation.PhraseId=Role.PhraseId;
As you see, The second query now uses the correct language ID but can be the same for all your page visits. As the Phrase entity is abstract, it guarantees that the PhraseIds are unique, but it does not show up in "concrete" queries.
+++ Despite being wrong in every important aspect, that is a very good analogy +++
Hex (in Darwin's Watch)