faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

7 of 21 people (33%) answered Yes
Recently 4 of 10 people (40%) answered Yes

Entry

JavaScript: Does it allow me to translate a website to another language at the click of a button?

Apr 7th, 2008 23:11
ha mo, Knud van Eeden, Colin Fraser, Andy Wright,


As it stands right now, this is beyond the capability of Javascript.
What you are asking is far too complex, it is easier to translate the
original pages and have links between them for people. I do understand
that translation programs are available, in Java and perhaps PHP or
Python, but not in Javascript.
The manner of your question though leads me to suspect you are asking if
you can have a javascript that allows you to translate pages you have
downloaded to your native language. Please forgive me if I am wrong
here,   but this is impossible.
------------------------------------------------------------------------
--- Knud van Eeden - 18 October 2001 - 09:55 am ------------------------
[Internet: see also: 
http://www.faqts.com/knowledge_base/view.phtml/aid/12038/fid/51]
You can use e.g. the translation engine at www.freetranslation.com to
translate your website, by passing that url, the to and from language.
Possible choices are: English to/from French, German, Spanish, Italian,
Portuguese and Norwegian.
A possible JavaScript program where you can set the URL, to and from
variables and creating a link to this translation page is for example:
<HTML>
 <HEAD>
  <TITLE>
  </TITLE>
 </HEAD>
 <BODY
   onLoad=' PROCLanguageNaturalUrlTranslate
( "www.knudvaneeden.com", "English", "Spanish" );'
 >
 </BODY>
</HTML>
<SCRIPT LANGUAGE = "JavaScript">
<!--
<!-- library: language: natural: translate: website: 
www.freetranslation.com -->
function PROCLanguageNaturalUrlTranslate( myurlS, languagefromS, 
languagetoS ) {
 var url1S = "http://fets3.freetranslation.com:5081/?Language=";
 var url2S = "%2F";
 var url3S = "&Url=http%3A%2F%2F";
 var url4S = "&Sequence=core";
 var urlS = url1S + languagefromS + url2S + languagetoS + url3S + 
myurlS + url4S;
 document.write( "The website being translated = " );
 document.write( myurlS );
 document.write( " from " );
 document.write( languagefromS );
 document.write( " to" );
 document.write( languagetoS );
 document.write( " " );
 document.write( '<A HREF="' + urlS + '">' + "translate" + "</A>" );
}
// -->
</SCRIPT>
------------------------------------------------------------------------
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com