473,403 Members | 2,323 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

CSS: load a class that translates that pages language???

elamberdor
Hi All!

I have a working dropdown language selector powered by google that loads the page in your chosen langauge:

Expand|Select|Wrap|Line Numbers
  1. <p align="center"><font size="2">Translate&nbsp; : 
  2. <SCRIPT language=javascript1.2 type=text/javascript>document.write('
  3. <select name="to_lang" onchange="lp=this.options[this.selectedIndex].value; if(lp!=\'\') window.location=\'http://www.google.com/translate?hl=en&ie=UTF-8&oe=UTF-8&u=http://WWW.WEBSITE.COM/PAGE.ASP</select>
  4.  
From here, i've done two things:
- Got rid of the "google frame" onload:
Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript1.1" type="text/JavaScript"> if (parent.frames.length > 0) top.location.replace(document.location);</script>
  2.  
then it works also when putting:
'http://www.google.com/translate?hl=en&ie=UTF-8&oe=UTF-8&u=
Expand|Select|Wrap|Line Numbers
  1.  
  2. ' + location.href +'
&langpair=\'+lp;"
to make the code load that specific page you're on, so I don't have to cut & paste the URL constantly in the code...


PROBLEM is, as soon as you start adding css styles to the pages, it freaks!
the styles go all over the place!

Is there a way to make some sort of <p class="translate"> or something that when you click a flag, it loads the translated script from google???

Any ideas?
Thanks!
=)
Sep 5 '07 #1
4 4555
phvfl
173 Expert 100+
Hi,

You may want to check the T&Cs but I think that it would be against the terms to automatically remove the Google banners from a page that they have translated. Looking through the Universal terms here the following stands out:
5.3 You agree not to access (or attempt to access) any of the Services by any means other than through the interface that is provided by Google, unless you have been specifically allowed to do so in a separate agreement with Google. You specifically agree not to access (or attempt to access) any of the Services through any automated means (including use of scripts or web crawlers) and shall ensure that you comply with the instructions set out in any robots.txt file present on the Services.
If it is determined that you are in breach of terms then it is within Google's power to remove your site from their results, this would generally be very bad and avoided where possible.
Sep 5 '07 #2
That's okay, i'm realising the script won't work whilst removing the frame now, So that i've scrapped orginal idea .

That scrapped: Any ideas how it might work?

Thanks,
=)
Hi,

You may want to check the T&Cs but I think that it would be against the terms to automatically remove the Google banners from a page that they have translated. Looking through the Universal terms here the following stands out:


If it is determined that you are in breach of terms then it is within Google's power to remove your site from their results, this would generally be very bad and avoided where possible.
Sep 5 '07 #3
Well, update,

Even the stripped back me-not-touching-anything to styleize it, when the page refreshes with the google frame, it completely breaks all the css design on the page!


I know the url of the page changes accordingly, but how do we get it to read our css okay still... Any ideas??

Thanks! =)
Sep 6 '07 #4
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.    <meta charset="UTF-8">
  5.    <title> Google Translater for Website </title> 
  6. </head> 
  7. <body>
  8. <h2>Your Web Page</h2>
  9.  <p>Click on the dropdown button to translate.</p>
  10.  <p>Translate this page:</p>
  11.  
  12. <div id="google_translate_element"></div>
  13.  
  14.  <script type="text/javascript">
  15.   function googleTranslateElementInit() {
  16.   new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element');
  17.   }
  18. </script>
  19.  
  20. <script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
  21. <p class="notranslate"> This Paragraph will remain same because it is using notranslate class.</p>
  22.  
  23. <p class="translate"> This Paragraph will change because it is using translate class. </p> 
  24. </body>
  25. </html>    
  26.  
Mar 9 '21 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Julie Miles | last post by:
I need to pull several tables of data from Excel into a web page, but when I use Excel's "Save as web page" function, I get an enormous file containing a massive amount of css formatting. I'd like...
8
by: Zak McGregor | last post by:
Hi all I have a simple 3 column css layout here: http://www.carfolio.com/newlook.dhtml However, when the centre column is wider than the screen (yes, it does happen on some pages on the site...
59
by: Mason A. Clark | last post by:
Is there information content in this observation? use html tables for layout: http://www.microsoft.com and http://www.netscape.com uses styles: http://www.opera.com
30
by: Diane Wilson | last post by:
I'm trying (once again) to figure out how to make a robust CSS layout style that can replace tables. I'd like to be able to do a basic two-column layout, with a one-column header, a two column...
3
by: Stephen Costanzo | last post by:
This is my first attempt at working with style sheets so I am probably missing something obvious. I created a default ASP.NET Web Application and added 3 elements to it, a label, a text box, and...
4
by: Mikaël PLOUHINEC | last post by:
Hello, I have created a master page with a css. How can I use css in the children pages? The css must be declared in the <head</headsection. Does I have to import all my css in my master? Is...
0
by: dixonjm | last post by:
Hi, I have a master page & various pages that will use this master page. Each content page will have a CSS & JS file which will be named the same as the content page. When I try to load the CSS...
3
by: Queez | last post by:
Very quick question. I have a master page (M1) and three content pages (C1, C2, C3). In M1, there's a list of three anchors (A1, A2, A3) which point towards the three content pages. The...
1
by: dustylane | last post by:
I know very little about HTML and CSS but I've been able to decipher most of what I've needed to know based on trial and error. I had a friend coding me a website long ago and he abandoned the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.