rah_google_translate
Published under current TXP projects
A simple Textpattern plugin that allows visitors to translate your website to their desired language by using Google Translate. The plugin works exactly like Google Translate widgets, but is completely JavaScript free and allows customization of the code – and of course works with simple Textpattern tags.
Image: rah_google_translate
Intro and description
A Textpattern plugin used to translate Textpattern powered site’s by using Google Translate. The plugin comes with tag, <txp:rah_google_translate /> that outputs a customizable drop down menu form of desired translation languages. By selecting the language and submitting the form, Google Translate activates and automatically translates the page – with out messy JavaScripts, frames and multiple redirects.
List of features
- Outputs XHTML valid translation language selection form; and translates.
- Customizable with tag attributes and CSS.
Requirements
- PHP 4.3.0+
- Textpattern 4.0.3+
Installation and usage
The general behavior stands: paste plugin code to the plugin installer textarea and run the automatic setup. Then just activate the plugin and you are ready to use new tags that plugin includes like others.
Attributes
The tag is <txp:rah_google_translate /> and attributes for it follow. The tag outputs form and select field of the translation languages.
languages
List of languages that appear in the language select field drop down. Allowed languages are all that Google translate can handle and appear in the Google translate language translation list. To define languages, you must use following writing rules; Every language must have two infos, a language name and a two lettered prefix, seperated with a | mark. In example “English” would become en|English and “Finnish” fi|Finnish. Every language must be seperate by comma.
Example: languages="en|English,fi|Finnish" Default: "en|English, ca|Catala, cs|Cesky, da|Dansk, de|Deutsch, es|Espanol, fi|suomi, fr|Francais, sv|Svenska"
site_language
Your site’s language as a two lettered prefix.
Example: site_language="fi" Default: "en"
label
Label text.
Example: label="Select language:" Default: "Google Translate:"
button
Submit button’s label text.
Example: button="Go" Default: "Translate this page"
Example
Code:
<txp:rah_google_translate languages="en|English,fi|Finnish" site_language="ru" label="Languages:" />
Outputs:
<form id="rah_google_translate" method="get" action="">
<div id="rah_google_translate_container">
<label for="rah_google_language">Languages:</label>
<select name="rah_google_language" id="rah_google_language">
<option value="en">English</option>
<option value="fi">Finnish</option>
</select>
<input type="submit" class="rah_google_button" value="Translate this page" />
<input type="hidden" name="rah_site_language" value="ru" />
<input type="hidden" name="rah_translate_page" value="" />
</div>
</form>
Changelog
Version 0.1
- First release
Known issues
Language URL redirects might not always work on old fast-cgi.