Make Google Translator Widget Language Labels in English - javascript

I am using a google translator widget on my website. Script below.
var showAllGTLanguages=false;
var listOfGTLanguage="zh-CN,th,ru,en";
function googleTranslateElementInit() {
if(showAllGTLanguages){
new google.translate.TranslateElement({}, 'google_translate_element');
}else{
new google.translate.TranslateElement({includedLanguages:listOfGTLanguage}, 'google_translate_element');
}
}
The translation widget comes up and language switching works fine.
However, the issue is that the text in the Google widget dropdown is being displayed in the language of the user's browser.
As an example, when accessing the website from the Netherlands in Dutch language, the drop-down menu in the Google widget displays "Engels" instead of "English".
I want the widget text to be displayed in English at all times.
I did try adding the Pagelaguage as 'en' but didn't work.
I require assistance in resolving this issue.

Related

Translate certain parts of the page only with Bing translator web widget

Our website is offered in 10 different languages with all static content already translated by external vendors. We have a requirement to translate certain parts of the page we do not have in advance.
The Translator Widget from Bing looks good except that it translates the whole page instead of only certain parts of the page. As a POC, I tried loading the translation API code in a hidden iframe, set the text to translate in a div element, and then called the Translate method and it worked. I was able to extract the translation and use it in my web page.
I would like to know if this kind of use is allowed or am I required to create an API account with BING or show some message somewhere in my page that a part of the content was translated by BING, since the translator widget is hidden inside the iframe?
Thanks in advance for helping me.
According to the documentation on MSDN for the Translate API of the widget, you can exclude elements from being translated by setting the custom attribute 'translate=no'
https://msdn.microsoft.com/en-us/library/dn341982.aspx

How to embed a google-spreadsheet chart in a wordpress?

I would like to embed a chart in a wordpress post.
I am using the script generated by using the publish function in google sheets.
If I add the generated script to a generic html page, I can see the chart.
If I add the generated script to a wordpress post, I get the following error:
"All series on a given axis must be of the same data type×"
Do I need to modify the script or something else in the wordpress page to correctly visualize the chart?
Thanks
here is the code generated by Google-sheets:
<script type="text/javascript" src="//ajax.googleapis.com/ajax/static/modules/gviz/1.0/chart.js"> {"dataSourceUrl":"//docs.google.com/spreadsheet/tq?key=0AgtmZPWzQ7lldEt2S2VLajBRQVNFLV9pRFY2bTRQLVE&transpose=0&headers=1&range=A2%3AB1010&gid=0&pub=1","options":{"titleTextStyle":{"bold":true,"color":"#000","fontSize":16},"curveType":"","animation":{"duration":500},"width":1270,"lineWidth":2,"hAxis":{"useFormatFromData":true,"title":"Data","minValue":null,"viewWindowMode":null,"viewWindow":null,"maxValue":null},"vAxes":[{"useFormatFromData":true,"title":"\u00b5g/m\u00b3","minValue":null,"logScale":false,"viewWindow":{"max":null,"min":null},"maxValue":null},{"useFormatFromData":true,"minValue":null,"logScale":false,"viewWindow":{"max":null,"min":null},"maxValue":null}],"booleanRole":"certainty","title":"Via Ariosto, SO2","height":469,"interpolateNulls":false,"legend":"right","focusTarget":"series","useFirstColumnAsDomain":false,"tooltip":{"trigger":"none"}},"state":{},"view":{},"isDefaultVisualization":false,"chartType":"LineChart","chartName":"Chart 1"} </script>
Another option is to use a WordPress plugin explicitly designed for integrating with the Google Charts API. The Inline Google Spreadsheet Viewer plugin for WordPresss uses a Google Spreadsheet as a datasource and lets you easily display that data in any of a number of Google Charts and graph visualizations.

IF statement to replace script

I bought a responsive website template that I'm trying to edit. I would like to put a search box that I get from another affiliate site, using <script> code, this search box is having a set width and height and it is not responsive.
My website looks fine in desktop but not in mobile version. How can I add IF statement to my html file to replace the <script> for search box with another one based on screen size of viewer.
simply I want to replace <script .....></script> with another one if the visitor is browsing from mobile device.
Thanks
You're going to need a way to see whether you're browsing through a website or not. Wurfle (PHP) is a good way to achieve this.
If if were just graphical, you could also alter the styles using the "media" attributes.

how to add custom javascript to google sites?

How do I get the ability to add/edit the JS on a google sites site? This way I want to use jQuery and jQuery UI to manipulate the look and feel of the site.
To be clear, I am not talking about all google sites, just the create-your-own system google has made, called "Google Sites" -> https://sites.google.com/.
On the howto page, there is this:
Unsupported features
The HTML Box tool currently doesn't support the following features:
iframes JavaScript code can't create any script, image or link tags
Document/window onload and onready functions. You can place any
JavaScript at the end of code that needs to load after the document
loads.
Does that mean HTML tool cannot create tags? even though they are in the demo above?
The Google Sites help explains how to add custom HTML/CSS/JS content:
Go to the Google Sites page that you’d like to embed HTML in.
Go to the Insert menu and select HTML Box.
In the dialog that opens, add HTML, CSS and/or Javascript code.
When you’re done, click Save.
To preview your embedded HTML, click Save on the Google Site page.
It goes on to note that "code from one HTML box can’t interact with or refer to code outside of the HTML box, including other HTML boxes" -- presumably, each "HTML box" is a separately sandboxed iframe element. As such, your ability to use JS to "manipulate the look and feel of the site" will be pretty limited.
Another alternative is writing your own Gadget
"Gadgets are small web applications that can be added to web pages. Gadgets are XML files that typically wrap HTML and JavaScript" as explained by a Google Sites Guru that goes by the name Mori.
https://sites.google.com/site/mori79/html-gadgets
You can also find more information in Google Developers site:
https://developers.google.com/google-apps/sites/gadgets/site_gadgets?hl=en
Hope it helps.
Google Site has a good documentation, and you cannot use any JavaScript against their program policy.
Please read the documentation, it lists details of the steps for inserting custom CSS, JavaScript and general HTML.

Google Charts - Trying to add links or any form of custom html in popup

Is there any way to have links in any part or a google chart?
Or embeded html?
I would idealy like to format the pop-up with my own html.
some(3) and other(4) should be links.
This is the closest I could get to what I would need Dynamic icons.
By reading on the net I am starting to think that my best option would be to not display google's popup and display a custom div instead.
Edit 1:
Google themselfes have a clickable link "Create new annotation" on their google analytics reports, so anything like that would be great.
What you want is the Annotated Time Line from Google Visualizations. Take a look at the first configuration option. :)
http://code.google.com/apis/chart/interactive/docs/gallery/annotatedtimeline.html#Configuration_Options

Categories