473,664 Members | 3,035 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

elamberdor
39 New Member
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="translat e"> or something that when you click a flag, it loads the translated script from google???

Any ideas?
Thanks!
=)
Sep 5 '07 #1
4 4612
phvfl
173 Recognized Expert New Member
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
elamberdor
39 New Member
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
elamberdor
39 New Member
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
kuldeepbisht310
1 New Member
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
8891
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 to strip out this css so that I can apply my own style sheet; does anyone know whether there is a way to do this, other than manually? Either a way to export the data from Excel that doesn't include the css formatting, or a utility that will...
8
3306
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 and no it can't happen differently) then the 3rd column overlays itself over the middle column's content. Is there a css-based 3 column layout without ugly hacks that will give me a 3rd column as far to the right as need be? Can anyone suggest a...
59
4560
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
3132
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 body, and a two-column footer. The problem, and one that always sends me back to using tables, is that word "robust." Absolute positioning gets squirrelly, because it takes the positioned elements completely out of the float scheme, and stuff...
3
2571
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 a hyperlink. I changed the default style sheet to have the label color be purple (added color: purple; to the Body {}). I changed the hover for the hyper link to lime (changed color: lime; in the
4
2362
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 there a way to import only one css for one children page? Thanks a lot.
0
2744
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 & JS files using the code behind of the content page, my buttons aren't rendered and Im not sure why? Here is the code for my content page - Properties.aspx:- <%@ Page Language="C#" AutoEventWireup="true" Title="Properties"...
3
6659
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 anchors have some CSS to make them look pretty. I'd like to be able to dynamically set the CSS for A1 when I navigate to C1 so it looks slightly different to the other two (e.g. to indicate this is the currently selected item). Below is what I have so...
1
2488
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 project but gave me what he had finished. I modified it to fit my needs, but now I'm at a stop. I have these sliding gallery tabs that I need to be able to click and they will open the galleries below them. I know I need to add in some sort of CSS...
0
8348
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8861
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8778
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8636
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7375
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5660
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4351
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2003
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1759
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.