• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Website change language

Starmio

Starmio
Joined
Feb 9, 2008
Messages
167
Reaction score
2
Location
...
How can i make this on my website:

You have these flags for example on your website:
flag.jpg

and when you are clicking on it then the language at the website will change.

For example if you click at the swedish flag then all the text we'll be changed to swedish =)

Thanks, Starmio! :huh:

something like this:

[Norwegian Flag] - [Swedish Flag] - [English Flag] - [Polish Flag] - [Spanish Flag] - [Brazilian Flag]
... Click here for more language ...
 
Last edited:

Lol.

Anyways, Starmio, that one is not an easy task and also its not automatic, it is not really like "You click the flag and everything turns to X language", you have to translate everything yourself, the flag is just a link to your translations.

At least thats how I did it when I had a website a year ago, dont remember how I did it thought since I havent messed with php in a while, but Im just here to tell you that sadly its not an easy thing like other applications which are just copy+paste a code, here you actually have to do a lot of work translating everything and linking etc.

Id go to Website Apps subforum and look up there maybe you can find a thread about it.

Good luck.
 
"You click the flag and everything turns to X language"

Thats what i need =)
Thanks..

I dont think that exists mate, or at least if it exists and uses translators, it wouldnt translate things correctly (as most translators) and would be misleading. Read my post again:

it is not really like "You click the flag and everything turns to X language", you have to translate everything yourself
 
I dont think that exists mate, or at least if it exists and uses translators, it wouldnt translate things correctly (as most translators) and would be misleading. Read my post again:

Yeah i know ;p!
I read all the post i just quoted the " "
I have translated some of the website so all i need is the script thing, thanks Guitar Freak


not exist

<a href="http://babelfish.yahoo.com/"><img src="flagpl.jpg" /></a>

What's that o_O?
 
Last edited:
As Guitar Freak explained so well, there is no direct and proper translation tool which you can just download. What you would have to do is to replace every single line of text in every file that you would like to translate into either a variable or a function, and then you would have to make a new function which finds out which language file to locate. Once locating the language file, it should contain all the values of those variables/functions.

I would strongly recommend you to skip this, or simply give it a shot by yourself as I doubt anyone would really feel like making a language system just like that. I'm doing one, but that's for my AAC which isn't going to be released any time soon.
 
As Guitar Freak explained so well, there is no direct and proper translation tool which you can just download. What you would have to do is to replace every single line of text in every file that you would like to translate into either a variable or a function, and then you would have to make a new function which finds out which language file to locate. Once locating the language file, it should contain all the values of those variables/functions.

I would strongly recommend you to skip this, or simply give it a shot by yourself as I doubt anyone would really feel like making a language system just like that. I'm doing one, but that's for my AAC which isn't going to be released any time soon.

Seriously, did you read the post i posted after what Guitar Freak said?


Yeah i know ;p!
I have translated some of the website so all i need is the script thing.

[Shorted]
 
Of course there are more advanced language scripts.
Examples in this script: Spanish, Swedish & English

1) File where you are able to change the language:

Code:
<?php

include ('lang.inc');

echo "$text[1]";
echo "<br /><br />";
echo "$text[2]";
echo "<br /><br />";
?>
<form action="getlang.php" method="get">
<? echo "$text[3]"; ?><br /><br />
<select name="lang">
<option value="se">Svenska</option>
<option value="eng">English</option>
<option value="esp">Español</option>
</select>
<input type="submit" value="<? echo "$text[4]"; ?>">
</form>

2) Getlang.php

Code:
<?

$lang = $_GET['lang'];
$file = "lang.inc";
$fp = fopen($file, 'w');
$execute = file_get_contents($file);

$lang != "" or die;
fwrite($fp, '<?php

include "languages/'.$lang.'.inc";

?>');
?> 
<META HTTP-EQUIV = 'Refresh' Content = '0; URL =index.php'>



3) Lang.inc

Code:
<?php

include ('languages/eng.inc');
include ('languages/esp.inc');
include ('languages/sv.inc');

?>


4) eng.inc (Note, only english made)

Code:
<?php

$text[1]= "Hello and welcome to my website";
$text[2] = "The language on this site is now English";
$text[3] = "Choose Language";
$text[4] = " Submit ";

?>
 
scripts.
Examples in this script: Spanish, Swedish & English

1) File where you are able to change the language:

Code:
<?php

include ('lang.inc');

echo "$text[1]";
echo "<br /><br />";
echo "$text[2]";
echo "<br /><br />";
?>
<form action="getlang.php" method="get">
<? echo "$text[3]"; ?><br /><br />
<select name="lang">
<option value="se">Svenska</option>
<option value="eng">English</option>
<option value="esp">Español</option>
</select>
<input type="submit" value="<? echo "$text[4]"; ?>">
</form>

2) Getlang.php

Code:
<?

$lang = $_GET['lang'];
$file = "lang.inc";
$fp = fopen($file, 'w');
$execute = file_get_contents($file);

$lang != "" or die;
fwrite($fp, '<?php

include "languages/'.$lang.'.inc";

?>');
?> 
<META HTTP-EQUIV = 'Refresh' Content = '0; URL =index.php'>



3) Lang.inc

Code:
<?php

include ('languages/eng.inc');
include ('languages/esp.inc');
include ('languages/sv.inc');

?>


4) eng.inc (Note, only english made)

Code:
<?php

$text[1]= "Hello and welcome to my website";
$text[2] = "The language on this site is now English";
$text[3] = "Choose Language";
$text[4] = " Submit ";

?>

How does that work?
 
Are you kidding me?
How does WHAT work? You want me to explain every letter of that script or could you just maybe look it up yourself?
 
Back
Top