Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,151,184 members, 7,811,467 topics. Date: Sunday, 28 April 2024 at 12:11 PM

Help! How Do I Make My Website Have Two Different Languages? - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Help! How Do I Make My Website Have Two Different Languages? (9819 Views)

How Can I Make My Blog Appear On Top Google Search / Make My Site Url Display "index.php?action=about-us / Learn How To Design Website In Different Languages And Generate Worldwide Traffi (2) (3) (4)

(1) (Reply) (Go Down)

Help! How Do I Make My Website Have Two Different Languages? by gdcomms: 9:48pm On Apr 14, 2010
Hello guys,I have a website but want to make it readable in two different languages, English and French.Please how do I code it? I don't want to insert any automated multilingual code translator.
Do I need to create two different folders in one directory?Help me out!
Check out this website (English and French versions all inclusive): www.mtn.cm

In anticipation!
Re: Help! How Do I Make My Website Have Two Different Languages? by DualCore1: 11:38pm On Apr 14, 2010
One way will be to build your site in a way that every text block is referenced as a variable and is being read from a seperate file.

So you have all the english declared as variables in a file called english.php
you have all the french equivalent declared as variables in a file called french.php

here's an example I just wrote.

index.php
<?php
if($_GET['lang']=="english"wink{
include("english.php"wink;
}
elseif($_GET['lang']=="french"wink{
include("french.php"wink;
}
else{
include("english.php"wink;
}
?>
<html>
<head>
<title><?php echo $title ?></title>

</head>
<body>
<p><?php echo $greeting ?></p>

</body>
</html>

english.php
<?php
$greeting = "Hello, how are you today";
$title = "Welcome to our site";
?>

french.php
<?php
$greeting = "Bonjour, comment cava?";
$title = "Bien venue a la site"; //lol i need go french skool
?>

So english language will be called up by default. to get french you pass the variable "lang=french" as a GET method in the link.

so you could have something like

<p>Choose your language please</p>
<ul>
<li><a href="yoursite.com/?lang=english">English</a></li>
<li><a href="yoursite.com/?lang=french">French</a></li>
</ul>
This is just me, you can develop my idea and come up with something better.

Sorry, my french sucks.   tongue
Re: Help! How Do I Make My Website Have Two Different Languages? by DualCore1: 11:52pm On Apr 14, 2010
Another way, which I will not recommend. Will be to build your site and replicate the site files in different folders. So for english you have the folder "en", for french you'll have the folder "fr". You can then have something like

<p>Choose your language please</p>
<ul>
<li><a href="yoursite.com/en">English</a></li>
<li><a href="yoursite.com/fr">French</a></li>
</ul>

Brother, this will just give you plenty headache during site maintenance. You can reduce the headache if all derivatives of the site share common stylesheet files. but its still headache.
Re: Help! How Do I Make My Website Have Two Different Languages? by Nobody: 7:23am On Apr 15, 2010
Go and use a proper framework like drupal or joomla with language packs to help you with the translation. Or employ
google translation services or pay someone to help you do it professionally
Re: Help! How Do I Make My Website Have Two Different Languages? by joomla: 10:01am On Apr 15, 2010
I worked on a similar site like that (though a small site) so i decided to replicate the files in different folders. But i have to hire a translator that translated it into French for me. Its important you hire a translator for accuracy purpose because using a translator like google will just translate it word for word (you can imagine translating an idiomatic expression). You may check out the site http://enco-services.com
Re: Help! How Do I Make My Website Have Two Different Languages? by Nobody: 10:44am On Apr 15, 2010
The translation methods of joomla and drupal are very good. They help translate simple words and also sentences.
If they are complicated, you can display them directly. This is not a tutorial, so i cant get too explicit, you may check
google for those stuffs. However, the ultimate thing is to get a translator to assist you.
Immagine for instance, you create a mulilingual site where people can post stuffs in one languages and read it in another
language. . .how will you go about that?
Re: Help! How Do I Make My Website Have Two Different Languages? by gdcomms: 11:26am On Apr 15, 2010
Thanks guys for all your comments.French/English are no barrier to me though, cos am that bilingual type.For accuracy purpose I am more comfortable with Dual Core!
@*dhtml, @joomla I do also appreciate ur comments.They gave me options.
@Dual Core your codes are so eplicit and down to earth.I don't much about that php stuff, but ur codes are just exactly what I needed.Will get in touch from time to time.If you won't mind drop me a mail: restoringh@yahoo.com
Your French is not that bad anyway shocked

Merci a vous tous!
Re: Help! How Do I Make My Website Have Two Different Languages? by gdcomms: 11:30am On Apr 15, 2010
@Dual Core,but a site like this www.mtn.cm, which of the options have they used,any idea?
Re: Help! How Do I Make My Website Have Two Different Languages? by Nobody: 12:54pm On Apr 15, 2010
For a site with few pages, dual core's method is the best. If the pages are very much like on a portal, then it is better to use frameworks like drupal and joomla.
Re: Help! How Do I Make My Website Have Two Different Languages? by DualCore1: 2:01pm On Apr 15, 2010
@GDComms, glad I could be of help. I have no concrete idea how mtn.cm was done. From the link to the english version of the website, it appears it was done using CGI, which I have no idea about.
Re: Help! How Do I Make My Website Have Two Different Languages? by gdcomms: 2:39pm On Apr 15, 2010
Thanks anyway! I have learned a great deal already and will never stop doing so.
Re: Help! How Do I Make My Website Have Two Different Languages? by Nobody: 9:01pm On Apr 15, 2010
Good that you have at least realized that it can be done in more than one way. As a developer/programmer, it
is good to know the various options available so that you know what is best to choose from in any given job.

(1) (Reply)

Google Launches Google+ To Battle Facebook [pics] / Hot Naija Forum / How Do I Add "Like Me On Facebook" On My Blog?

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 21
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.