This post describes how to make a custom Google Translate Menu. Here is the finished menu. Note that the key item here is that half the links translate the website, and the other half take you to external links.
The objective of this post is to play around with the Google translate widget, and find a way to integrate Google translate into a custom menu, so you can get it to match the look of your site and also have a translation link in the same menu as a regular URL, say to a foreign version of a site. This way on a company site you can link to a translated version of the site, or to a complete mirror version of the site, depending on what is preferable for that country/language.
Let’s start with a sample of the regular Google Translate Dropdown Widget:
To set up one of these normal widgets go to Translate Setup Wizard where you can pick the specific languages to display and pick from a few visual styles.
But we want a completely different style, a custom menu where half the links translate an english page, and half the links go to a completely different site that is native in that language. To accomplish this we will need to activate the translation plugin with a simple URL injection:
The instructions are all on that google page, but basically we specify which languages we are trying to translate from and to in the URL itself.
NOTE: You must include the http:// in your URL or else this will break, in wordpress at least. This directs wordpress to an outside domain, otherwise it will think it’s a page within your site.
Another quick example for this site just so we can be certain this is working with wordpress.
For this to work you will need to make sure that you have the Google translation snippet inserted into your footer:
note that I have set my div style to “display: none;” since I don’t want the google widget to actually be visible, it just needs to be there for the URL injection to function.
Now lets go ahead and add a CSS3 based menu,and add our links:
So there you go, we have a custom menu that mixes google translate links with outside URL’s. Hope you found this useful!