L Posted July 30, 2007 Share Posted July 30, 2007 hey, i was wondering if it were possible to convert english into another language with php... For example, the google translator pages...except i want to do this with my own pages and not using their apps My purpose is to provide little flags at the footer, and when a user clicks their flag the page is translated to the language...for example...one clicks a japanese flag so the page makes the English to japanese thank your for your time ~L Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted July 30, 2007 Share Posted July 30, 2007 You can't translate from one language to another directly. The way that other sites have multiple languages is by providing a "language file" that contains variables for each text display, then depending on which language file is included, it sets those variables to the language, which is then displayed. Quote Link to comment Share on other sites More sharing options...
L Posted July 30, 2007 Author Share Posted July 30, 2007 so do u mean they have phrases = to variables? so like in the language file they would have the = $the; he = $he; I = $i but then in each other language file the same variables are set to the language like watashi = $i; if the jap link is clicked... then it would replace all the "I"s with "watashi"s? -Thank you for your help ~L Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted July 30, 2007 Share Posted July 30, 2007 More like strings, rather than individual words or characters.... //english lanugage file $page_title = "This site's name"; $welcome = "Welcome to our site!!"; $goodbye = "Thanks for visiting!!"; //gibberish language file $page_title = "alksdjffweiu laksjfd a"; $welcome = "alksjdf oiweurn ba"; $goodbye = "lawieurw ksnwopiu"; Your php file: <?php include("./languages/english.lang.php"); //or gibberish.lang.php, etc ?> <html> <head> <title><?php echo $page_title; ?><?title> </head> <body> <?php echo $welcome; ?> Blah <?php echo $goodbye; ?> </body> </html> Quote Link to comment Share on other sites More sharing options...
L Posted July 30, 2007 Author Share Posted July 30, 2007 sweet, that's pretty cool...i modified it so it includes the language clicked on like this <?php if ($_GET['language'] == 'jap') { require("japanese.php"); } else { require("english.php"); } ?> it works good...but do u know how i can display the actual charecters?...because when i just paste it as the japanese charecters it shows up as ??...is this php or does this have to do with my operating system? Thank you for your time ~L Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.