multilanguage website, translating categories+subcategories

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
matteoraggi
Forum Newbie
Posts: 2
Joined: Sun Feb 03, 2008 3:42 pm
Location: Italy
Contact:

multilanguage website, translating categories+subcategories

Post by matteoraggi »

1)
I to all, I have a web site about hotel supplies in php, not yet internazionalyzed, and I need to translate it, not only in simple text,
but categories and subcategories, for example here:
http://www.hotel-supplies.biz
I desire to translate it also in italian language: http://www.forniture-alberghiere.net and german: http://hotelbedarf.biz

which is the best way to do this work in this case?
I just not have any multi-language script in this moment installed..

2)
It is real that use external .inc .php files is not good if web site hava many visits and instea working directly to DB (for eample mysql) the web site will be more quick to open?
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Re: multilanguage website, translating categories+subcategories

Post by JAM »

1.
You could add add languagefiles that look similiar to the following (english vs. swedish, but you get the point)...

Code: Select all

 
 // english.php
 $lang['header'] = 'Welcome to this site...';
 $lang['title'] = 'This site is about kittens and foo!';
 // swedish.php
 $lang['header'] = 'Välkommen till denna site...';
 $lang['title'] = 'Denna site handlar om kattungar och foo!';
 
...then by using whatever means you feel like, you could require()/include() either of those files prior to displaying the website. The template themselves could look like;

Code: Select all

<html>
  <body>
    <h1><?php echo $lang['header']; ?></h1>
    <b><?php echo $lang['title']; ?></b>
  </body>
</html>
Just to give you ideas. setlocale() is also a function you could read up on. Very good to have dealing with time and currency as examples. Note, that it's usually easier to start doing this when starting the design of a site, rather than translating it later.

2.
I can't tell for sure as I personallt never benchmarked it. Personally, I think you need badly written code, slow webhost-drives, massive amount of visitors/second (to mention some issues) to notice any difference. When calling upon the mysql database, you are sending data first to the db, then retrieving the data from it, so there is still X amount of data in need to be transfered, harddrives to spin to fetch data etc....
Hope I made sence. And the gurus of these boards, please do agree or disagree. Only personal thoughts on the subject. :wink:
Post Reply