Jump to content
Larry Ullman's Book Forums

Include A Language System


Recommended Posts

Hello,

 

i'm reading the 4th chapter and i see some same error messages. Like "Please enter a valid email address!".

I think including a language system could be a good idea.

 

By including the file language-eng.php in the config.inc.php.

This file could contain variable like

$err01= "[i]Please enter a valid email address![/i]";

 

And in case of using

$login_errors['email'] = 'Please enter a valid email address!';

We would have

$login_errors['email'] = $err01;

 

This system can avoid repeatition and can be easily translated.

 

Is this idea is good ? Is this method good to implement this system ?

 

Thank you.

Link to comment
Share on other sites

Including a language system would definitely be a good idea IF the site is expected to handle users in multiple languages. If not, then it's a lot of work and performance degradations for nothing.

 

As for implementing it, you've got the right idea, but I would use a database and make sure EVERYTHING is represented in all possible languages. Then you need to create a system for the user to select their language, and store a language preference in a cookie. Then use that cookie to retrieve all the data into a global array and use that global array for all messages, labels, and such.

Link to comment
Share on other sites

Thank you for the answer.

I've the idea to move to another country if i do enough benefits with my website. So, i'll follow your advice and wait to see then if necessary i'll make this system.

I keep your advices in mind.

Link to comment
Share on other sites

 Share

×
×
  • Create New...