Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

translating a website in php or mysql?

i need to translate my site in multiple languages. i was thinking to use a database called language and put the translation there.

database : translation
tables:  language
column: id, english, french, german, italian, spanish

or i was thinking about a php solution like:

english.php
french.php
german.php
italian.php
spanish.php

so you simply include the file you need.

now, i can see pros and cons for both, what i want to know is what is consider the standard in the industry to do something like this?

like image 535
Adam Avatar asked Dec 05 '11 02:12

Adam


1 Answers

You can use gettext, this function is proposed for this feature, not a "standard" but fast enough.

The second options in the use of a PHP file with a big array (really big, for each string), this is the most common solution.

To the database content (the big problem here, don't forget), if all your content must have the translation, one column for each language, otherwise use a flag of language for each line on database.

like image 161
Paulo H. Avatar answered Oct 20 '22 18:10

Paulo H.