Content last modified Monday 6 March 2017
hop to #bottom
Author:
Jukka Svahn
Current version:
0.1
About It:
Rate it:
  • Helpful?
  • 3 Yes
  • 1 No
Flag it:

If you'd like to provide updated information and do not have access to directly edit, please contact the site admin; thanks!

rah_google_translate

This plugin is deemed useless and its development has been dropped. Rah_google_translate was a widget that generated preset HTML. And fact is, this plugin isn’t needed for that markup. It’s very easy to generate the same output and functionality with Textpattern’s core tags, which also gives you more flexibility than rah_google_translate’s widget could provide.

Functionality wise what the plugin ever did was to link to Google’s Translation service’s end-point links. This links have the following format:

http://translate.google.com/translate?u={url}&langpair={from}|{to}

Where u parameter is the translated page’s URL and langpair consists of the site’s language and the translated language (i.e. en|de). An working translation URL would like this:

http://translate.google.com/translate?u=http://rahforum.biz/plugins/rah_google_translate&langpair=en|fi

Which translates into a form painlessly. The following snippet generates a working translation form that has the same structure as rah_google_translate’s widget:

<form method="get" action="http://translate.google.com/translate">
	<input type="hidden" name="u" value="<txp:site_url /><txp:php> echo ltrim(page_url(array('type' => 'page_url')), '/'); </txp:php>" />
	<select name="langpair">
		<option value="en|de">German</option>
		<option value="en|fi">Finnish</option>
	</select>
	<button type="submit">Translate this page</button>
</form>

There you have it. The same thing, no plugin required. More flexibility. The snippet uses site_url and page_url to generate the current (translated) page’s location. Page_url provides the requested URL, while site_url gives out the site’s url.

Article Request Count:

Archived [?]: not-needed, dropped

Keywords/tags:
Initially released:
2008/10/28
Posted here:
30 Oct 2008
Article modified:
29 Jul 2012

If there is a comment form at the Information URL, you may want to leave your comments/questions there or at the Forum thread for quicker feedback. Otherwise, comment away:

Your comment will NOT be submitted until you click the 'Submit' button on the next pageload.

Subscribe to this article's comments RSS feed. [ ? ]   View Recent Comments across the site.

You know you want to visit the Archives.

Browse

Categories


Articles

There are also tag clouds, 'cause those are fun.
Published with Textpattern