Posts Tagged ‘javascript’

Using Google Translate

Thursday, June 3rd, 2010

As my blog has grown in traffic I’ve noticed more and more readers coming from outside of the US, and while not surprising it does pose new issues. As more and more non-english (or non-native) speaking readers began to read my blog started looking for an automated way to translate into their language of choice. My Spanish is extremely rusty, and my German has been whittled down to a few words, so Google Translate seemed to be a great option.

By including a div and a few lines of Javascript into my page I was able to use Google’s powerful translation engine to add multiple language support to my blog through a simple drop down.

Here is the code for translating from English into all supported languages.

<div id="google_translate_element"></div>
<script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'en'
}, 'google_translate_element');
 }
</script>
<script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit">
</script>

When setting up your site you select your original language, choose output languages and Google will output a code snippet for your site. Right now I am only translating my main blog page, but will be rolling out Translate to every page of my site in the near future.

Selecting a new language will instantly change all text on your website if your site is using good design practices. It won’t help you out if you are using images for text (which is generally a no no) and won’t translate text created using SIFR. I haven’t tested every font replacement technology, but Google Translate works great with Typekit.

Customize Google Translate for your site here.

Flash Runtime Written Entirely in Javascript

Monday, April 26th, 2010

Gordon is a open source Javascript based Flash Player written by Tobey Tailor that allows users to playback Flash content without having the plugin. It currently only supports Flash 1 & 2 so Actionscript users are out of luck. Right now browser support is pretty limited but it’s an interesting project worth keeping your eyes on if you are hoping to playback Flash animations on platforms (Apple) that don’t support the plugin.

Check out the project on GitHub.

Twitter launches @anywhere

Thursday, April 15th, 2010

Yesterday Twitter launched it’s @anywhere service which makes integrating most Twitter functions as simple as adding a few lines of Javascript code. You can easily:

Auto-link @usernames
Create Hovercards for @usernames
Create follow buttons that don’t require users to leave your site
Add a “Tweet Box” which allows users to tweet without leaving your site
Integrate Twitter login & signup into your site

Check out the new Twitter dev site.
Check out the @anywhere documentation.

@anywhere homepage

JQuery Plugin for the iPhone

Tuesday, March 30th, 2010

JQTouch is a JQuery Plugin for the iPhone that lets you add animation to mobile websites similar to the interactions found in native applications. Developers just need to include the most recent version of JQuery from Google code, a JQTouch js file and some css to get up and running with native webkit animations, swipe events and image preloading.

Check out JQTouch here.

Check out JQTouch in action on a device here.

JQTouch

Type on the Web

Thursday, October 22nd, 2009

Smashing Magazine has a great new article on options for typography on the web. It covers javascript image replacement, Flash image replacement and the use of actual fonts on the web through new services like Typekit.

Check out the article.

typekit

Flexible Scalable Background Images

Thursday, May 21st, 2009

My friend Michael Bester (another former WMG Digital Properties employee) has a great blog post about creating scalable background images. I’ve built similar components for Flash Projects but this is the first really great example of this I’ve seen using javascript. 

Check it out.

Improving upon Lightbox

Sunday, April 27th, 2008

I’ve been a user of Lightbox for years. It’s an amazing step forward in usability for websites, a beautiful way to display modular information without annoying pop-ups. Recently two new frameworks have come to my attention. 

Slimbox is a Lightbox compatible framework that is MUCH smaller than the slightly large Lightbox framework. Built off a different codebase it clocks in at about 7KB. It does one thing, and does it well.

Shadowbox serves a different, complimentary purpose, expanding greatly on the simple functionality LIghtbox is known for. It allows for modular display of images, image sets, flash, flash, video, quicktime and wmv (which worked great on my mac).