The Best Cyprus Community

Skip to content


PHP Programmer Required

Feel free to talk about anything that you want.

Postby Gasman » Sat Jun 05, 2010 1:27 am

You are so easily pleased Orifice.

Dreaming and salivating at the prospect of an alliance with Israel and now posting all over to prove that what you said about GR agreeing with you that I am a retard must be true lol!

Have you ever fought a battle on your own two feet? I doubt it. I notice your conspicuous absence from threads once too many start to disagree with you.
Gasman
Main Contributor
Main Contributor
 
Posts: 3561
Joined: Sat May 02, 2009 6:18 pm

Postby Raymanoff » Sat Jun 05, 2010 8:30 am

Free advise to translate your site in 2 languages without database...

Register a default session language

$_SESSION['lang']="en";

Then start a session on each page.

session_start();

Then replace each word in UI, Forms etc with the array caller like this: <?php echo $trans['Next']; ?>

The code above would look into tranlation file and look for an entry "Next"

Now, the translation file...

Lets call it inc.languages.php

the structure is simple....

<?php
if($_SESSION['lang']=="en") {
array $trans(
"Next"=>"Next",
"Yes"=>"Yes",
"No"=>"No");
}


if($_SESSION['lang']=="gr") {
array $trans(
"Next"=>"Επόμενο",
"Yes"=>"Ναί",
"No"=>"Όχι");
}

Obviously you would have to include this lang file on each page...

The encoding of the site should be UTF-8, then you can add more languages on your site by adding new session parameters and new entries in your translation file.

For Big blocks of content just use IF(SESSION) statements. This is supereasy...
User avatar
Raymanoff
Regular Contributor
Regular Contributor
 
Posts: 2119
Joined: Wed Dec 19, 2007 12:36 pm
Location: Vraxonisida

Postby cyprusgrump » Sat Jun 05, 2010 8:43 am

Raymanoff wrote:Free advise to translate your site in 2 languages without database...

Register a default session language

$_SESSION['lang']="en";

Then start a session on each page.

session_start();

Then replace each word in UI, Forms etc with the array caller like this: <?php echo $trans['Next']; ?>

The code above would look into tranlation file and look for an entry "Next"

Now, the translation file...

Lets call it inc.languages.php

the structure is simple....

<?php
if($_SESSION['lang']=="en") {
array $trans(
"Next"=>"Next",
"Yes"=>"Yes",
"No"=>"No");
}


if($_SESSION['lang']=="gr") {
array $trans(
"Next"=>"Επόμενο",
"Yes"=>"Ναί",
"No"=>"Όχι");
}

Obviously you would have to include this lang file on each page...

The encoding of the site should be UTF-8, then you can add more languages on your site by adding new session parameters and new entries in your translation file.

For Big blocks of content just use IF(SESSION) statements. This is supereasy...


Hold on, hold on! :x

Z4 lost you at 'translate'... :lol:
User avatar
cyprusgrump
Main Contributor
Main Contributor
 
Posts: 8520
Joined: Thu Sep 01, 2005 4:35 pm
Location: Pissouri, Cyprus

Postby YFred » Sat Jun 05, 2010 1:39 pm

cyprusgrump wrote:
Raymanoff wrote:Free advise to translate your site in 2 languages without database...

Register a default session language

$_SESSION['lang']="en";

Then start a session on each page.

session_start();

Then replace each word in UI, Forms etc with the array caller like this: <?php echo $trans['Next']; ?>

The code above would look into tranlation file and look for an entry "Next"

Now, the translation file...

Lets call it inc.languages.php

the structure is simple....

<?php
if($_SESSION['lang']=="en") {
array $trans(
"Next"=>"Next",
"Yes"=>"Yes",
"No"=>"No");
}


if($_SESSION['lang']=="gr") {
array $trans(
"Next"=>"Επόμενο",
"Yes"=>"Ναί",
"No"=>"Όχι");
}

Obviously you would have to include this lang file on each page...

The encoding of the site should be UTF-8, then you can add more languages on your site by adding new session parameters and new entries in your translation file.

For Big blocks of content just use IF(SESSION) statements. This is supereasy...


Hold on, hold on! :x

Z4 lost you at 'translate'... :lol:

You are wrong, he lost him after "Trans". The rest was too late.
User avatar
YFred
Leading Contributor
Leading Contributor
 
Posts: 12100
Joined: Mon Jan 05, 2009 1:22 am
Location: Lurucina-Upon-Thames

Postby CBBB » Sat Jun 05, 2010 7:10 pm

YFred wrote:
cyprusgrump wrote:
Raymanoff wrote:Free advise to translate your site in 2 languages without database...

Register a default session language

$_SESSION['lang']="en";

Then start a session on each page.

session_start();

Then replace each word in UI, Forms etc with the array caller like this: <?php echo $trans['Next']; ?>

The code above would look into tranlation file and look for an entry "Next"

Now, the translation file...

Lets call it inc.languages.php

the structure is simple....

<?php
if($_SESSION['lang']=="en") {
array $trans(
"Next"=>"Next",
"Yes"=>"Yes",
"No"=>"No");
}


if($_SESSION['lang']=="gr") {
array $trans(
"Next"=>"Επόμενο",
"Yes"=>"Ναί",
"No"=>"Όχι");
}

Obviously you would have to include this lang file on each page...

The encoding of the site should be UTF-8, then you can add more languages on your site by adding new session parameters and new entries in your translation file.

For Big blocks of content just use IF(SESSION) statements. This is supereasy...


Hold on, hold on! :x

Z4 lost you at 'translate'... :lol:

You are wrong, he lost him after "Trans". The rest was too late.


You are the only "Trans" we know gaYFred, old chap, what?
User avatar
CBBB
Leading Contributor
Leading Contributor
 
Posts: 11521
Joined: Tue May 20, 2008 1:15 pm
Location: Centre of the Universe

Postby YFred » Sat Jun 05, 2010 7:33 pm

CBBB wrote:
YFred wrote:
cyprusgrump wrote:
Raymanoff wrote:Free advise to translate your site in 2 languages without database...

Register a default session language

$_SESSION['lang']="en";

Then start a session on each page.

session_start();

Then replace each word in UI, Forms etc with the array caller like this: <?php echo $trans['Next']; ?>

The code above would look into tranlation file and look for an entry "Next"

Now, the translation file...

Lets call it inc.languages.php

the structure is simple....

<?php
if($_SESSION['lang']=="en") {
array $trans(
"Next"=>"Next",
"Yes"=>"Yes",
"No"=>"No");
}


if($_SESSION['lang']=="gr") {
array $trans(
"Next"=>"Επόμενο",
"Yes"=>"Ναί",
"No"=>"Όχι");
}

Obviously you would have to include this lang file on each page...

The encoding of the site should be UTF-8, then you can add more languages on your site by adding new session parameters and new entries in your translation file.

For Big blocks of content just use IF(SESSION) statements. This is supereasy...


Hold on, hold on! :x

Z4 lost you at 'translate'... :lol:

You are wrong, he lost him after "Trans". The rest was too late.


You are the only "Trans" we know gaYFred, old chap, what?

Come now have can you forget your meetings every Saturday night dressed as sheilas. Or have you forgotten. Dementia setting in good and proper hey.
User avatar
YFred
Leading Contributor
Leading Contributor
 
Posts: 12100
Joined: Mon Jan 05, 2009 1:22 am
Location: Lurucina-Upon-Thames

Previous

Return to General Chat

Who is online

Users browsing this forum: No registered users and 2 guests