Translation

Provides a simple API and Tempcode symbol for translating text, via Google Translate. The symbol is designed for assistive translations of user-supplied content, not for wholesale/transparent content translation.

Google Translate will need configuring in the standard Composr config option for this to work:
Admin Zone > Setup > Configuration > Site options > Internationalisation > Google translate API key

To use the symbol just wrap it around text that needs translating in templates, e.g.:

Code

{$PROVIDE_WITH_TRANSLATION,{TEXT},{$TRANS_TEXT_CONTEXT_html_block},FR}
This example translates French in {TEXT} to the site\'s current language, within the context of a block of HTML. The original text is followed by the translated text, and as it is a block of HTML it also includes the "Powered by Google Translate" message.

Here are the available translation modes:
  1. {$TRANS_TEXT_CONTEXT_plain} – translate plain text
  2. {$TRANS_TEXT_CONTEXT_html_block} – translate a block of HTML (with a credit message to Google)
  3. {$TRANS_TEXT_CONTEXT_html_inline} – translate inline HTML (without a credit message to Google)

If you omit the source language then it will be autodetected.

Licence

Licensed on the same terms as Composr

Images

Back to Top