I'm trying to create a multi-language supported site as efficiently as possible.
As of now a user specifies their language on registration and then after logging in a variable is set.
Code: Select all
$iLang = mysql_result($userinfo,0,'language');Code: Select all
<?PHP
switch ($iLang) {
// ----------------------- ENGLISH -----------------------
default:
// BASIC SITE INFORMATION
$LangSiteName = "Site Name";
$LangSiteUrl = "http://www.site.com";
$LangAutomatedEmail = "Forum@Site.com";
$LangSiteTitle = "Site.com";
// TOP BAR TEXT
$LangWelcome = "Welcome";
$LangGuest = "Guest";
$LangLogOut = "Log out";
$LangCreateAccount = "Create an account";
$LangPrivateMessages = "Private Messages";
$LangGold = "Gold";I know there are a few problems with this:
1) All languages are loaded, when you only need one. Solution: Create a different PHP file for each language containing the translations?
2) All text of x language is loaded, when only some of the text is needed. For example I don't need the phrases for the registration page if i'm on the login page. Solution: Specify your page and load phrases by page individually.
Now this is just me brainstorming. I'd love to hear your advice, and your thoughts on this subject.
Thank you!
Jordan Berry
PS. First post, Hi!