feemelvis
10-02-2007, 11:18 AM
Hi all,
I'm wanting to add language translations to my website. I would like something similar to this site www . luxuryportfolio . com Under languages you can select a different language and the page changes. Not sure how to make that work. Any suggestions?
jquindlen
10-02-2007, 12:42 PM
Hi all,
I'm wanting to add language translations to my website. I would like something similar to this site www . luxuryportfolio . com Under languages you can select a different language and the page changes. Not sure how to make that work. Any suggestions?
You're going to need to hire translators and then create a second copy of your website with the translation. Or, if you're using a CMS system that supports multiple languages, you'll follow the directions applicable to your system.
feemelvis
10-02-2007, 12:55 PM
I found out they're using Systran for language translation. Not sure how they tie it into the website, but I'm going to find out.
infinite_in
10-05-2007, 11:26 PM
Check google language tools; www.google.com/language_tools
triXtyle
10-16-2007, 07:03 AM
..... or make it using PHP and sessions. Simply make separate lang file for every language and in an array add the text. Example:
Address:
mysite.com/index.php?lang=en
Language file:
lang_en.php
Contents:
<?php
$array["title"] = "Welcome"; // the title of the page
$array["maintext"] = "Hello, World!"; // the content of the page
$array["copyright"] = "Copyright 2007 by triXtyle. All rights reserved"; // the copyrights of the page
?>
And for every separate language, just translate "Welcome", "Hello, World!" and etc. into your language.
And here is the code that changes the lang (put it in the begining of every page) :
<?php
session_start() // Don`t forget to start the sessions!!!
if(!isset($_SESSION["language"])) { $_SESSION["language"] = "en"; } // set the default language!
if(isset($_GET["lang"]) && !empty($_GET["lang"])) {
unset($_SESSION["language"]) // to be sure that the lang session variable doesn`t exists
$_SESSION["language"]=$_GET["lang"]; } // change the session`s value to the new language
require_once("lang_".$_SESSION["language"].".php"); // this gets the contents of the file lang_en.php to use it in the page
?>
Looks kind`a messy and difficult, but actually it is very simple way to use lots of languages, by only translating one file, not every page (equivalent, but anyway :) )
and the page must look like this:
<?php
session_start()
if(!isset($_SESSION["language"])) { $_SESSION["language"] = "en"; }
if(isset($_GET["lang"]) && !empty($_GET["lang"])) {
unset($_SESSION["language"])
$_SESSION["language"]=$_GET["lang"]; }
require_once("lang_".$_SESSION["language"].".php");
?>
<html>
<head>
<title><?php echo $array["title"]; ?></title>
</head>
<body>
<?php echo $array["maintext"]; ?><br><br><?php echo $array["copyright"]; ?>
</body>
</html>
Cheers