472,955 Members | 2,446 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,955 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 4198
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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.