Lost Password?


Go Back   CodeCall Programming Forum > Web Development Forum > PHP Forum

PHP Forum Use this forum to discuss all aspects of PHP Development. PHP is a server-side, cross-platform, HTML embedded scripting language that lets you create dynamic web pages.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-30-2008, 09:39 AM
vedran's Avatar   
vedran vedran is offline
Newbie
 
Join Date: Aug 2008
Posts: 18
Rep Power: 1
vedran is on a distinguished road
Default Multi-lang. option in a cms

As I mentioned before, I'm making a simple cms, and I would really appreceate if some could tell me how could I create Multi-langguage options. I've seen the way php-nuke does it, and I relly like it. Could someone tell me where can I find tutorials or something like that?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 08-30-2008, 11:48 AM
Jordan's Avatar   
Jordan Jordan is offline
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Posts: 9,203
Last Blog:
Ext JS or Ext GWT
Rep Power: 20
Jordan is just really niceJordan is just really niceJordan is just really niceJordan is just really nice
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan
Default Re: Multi-lang. option in a cms

How does PHP Nuke do it? vBulletin uses "phrases" which are strings stored in a database. The phrase can be made in any language and vBulletin loads those phrases into an array and calls that variable. IE:

PHP Code:
 echo $phraseDB["somePhrase"]; 
Similarly, Joomla 1.x (not 1.5) does it the same way except with files and it does not use an array to hold the vlaues.
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog
The CodeCall Wiki is now fully integrated with vBulletin users! Check it out and add some new pages!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-30-2008, 11:55 AM
vedran's Avatar   
vedran vedran is offline
Newbie
 
Join Date: Aug 2008
Posts: 18
Rep Power: 1
vedran is on a distinguished road
Default Re: Multi-lang. option in a cms

phpnuke use something similar to that, stores lang files in langauage folder for example:
PHP Code:
define("_TURNOFFMSG","Turn Off Public Messages"); 
The only thing I don't understand is how does it work :S
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 08-30-2008, 12:02 PM
Jordan's Avatar   
Jordan Jordan is offline
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Posts: 9,203
Last Blog:
Ext JS or Ext GWT
Rep Power: 20
Jordan is just really niceJordan is just really niceJordan is just really niceJordan is just really nice
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan
Default Re: Multi-lang. option in a cms

Yup, that looks just like Joomla.

So, say you have an option in your CMS to choose English or French. You have 2 files in your language directory (english.php and french.php). If the user selects English your CMS includess the english.php file. If the user selects French it includes french.php.

The English file contains:
PHP Code:
define("_TURNOFFMSG","Turn Off Public Messages"); 
The French file contains:
PHP Code:
define("_TURNOFFMSG","Désactiver les messages publics"); 

In your CMS where you would normally do this:

PHP Code:
echo "Turn Off Public Messages"
you would change it to

PHP Code:
echo _TURNOFFMSG
Now, depending on what the user has selected it will output the named constant in English or French.
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog
The CodeCall Wiki is now fully integrated with vBulletin users! Check it out and add some new pages!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 08-30-2008, 12:14 PM
vedran's Avatar   
vedran vedran is offline
Newbie
 
Join Date: Aug 2008
Posts: 18
Rep Power: 1
vedran is on a distinguished road
Default Re: Multi-lang. option in a cms

Yes I know that, what I don't know is how to can I make this only a user option. I mean, once user selects different language, I want only THAT user to see the language he has selected, I don't want whole site to change language
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 08-30-2008, 05:19 PM
orjan's Avatar   
orjan orjan is offline
Programming Professional
 
Join Date: Sep 2007
Location: Sunne, Värmland, Sweden
Age: 33
Posts: 328
Last Blog:
Procedural Programming...
Rep Power: 9
orjan has a spectacular aura aboutorjan has a spectacular aura aboutorjan has a spectacular aura about
Default Re: Multi-lang. option in a cms

Then you need to go with the database version, or atleast it's simplest. I'm writing such a system myself at the moment actually, so if you want, I can share my experiences.
I'm also writing a translation website so i can let other ppl translate my app. if someone knows a language I don't know.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 08-30-2008, 06:01 PM
Jordan's Avatar   
Jordan Jordan is offline
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Posts: 9,203
Last Blog:
Ext JS or Ext GWT
Rep Power: 20
Jordan is just really niceJordan is just really niceJordan is just really niceJordan is just really nice
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan
Default

Quote:
Originally Posted by vedran View Post
Yes I know that, what I don't know is how to can I make this only a user option. I mean, once user selects different language, I want only THAT user to see the language he has selected, I don't want whole site to change language
Just allow the user to choose, store that value and load the file based on which lang they choose .
Posted via CodeCall Mobile
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamically update php variables based on option value Hrimthurs PHP Forum 3 05-06-2008 06:00 PM
[Added] Option to hide 'Page Title' aravot easyContact 1 12-13-2007 08:40 AM
URGENT!! Multiple option and argument parsing Linux John386 C and C++ 1 11-17-2007 03:40 AM
Postion of "Show Header Text" config option rolandd ionFiles 2 10-13-2007 11:29 AM
How do I read .mbm (Multi BitMap) files? moondog General Programming 7 08-07-2007 08:08 AM


All times are GMT -5. The time now is 05:09 AM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 97%

Ads