Shortcodes allow you to make transposh relate to some language information that you can provide it with.

The support already existed with some html classes and tags, and is simplified with the tp shortcode, see examples below:

  • Specify language of the enclosed phrase, in the example, we know its in Spanish

[tp lang="es"]hola[/tp]
This is the same as using:
<span lang="es">hola</span>

  • Specifiy that the phrase is in Spanish and will only be displayed to Spanish users

[tp lang="es" only]Hola Espaniol[/tp]
This is the same as using:
<span lang="es" class="only_thislanguage">hola</span>

  • The following Hebrew phrase will be hidden from Spanish and French users

[tp lang="he" not_in="es,fr"]עברית לא בספרדית וצרפתית[/tp]
We have no class replacement for this one yet

  • The following default language phrase will not be seen by Spanish and French users

[tp not_in="es,fr"]Not in francis, espanol[/tp]

A combination of the above two example might prove useful if you already have a segment translated to some language but you still want to have it automated for other languages, just wrap your current content with the not_in attribute, and add the new content with the only attribute:

[tp not_in="es"]Hello[/tp] [tp lang="es" only]Hola[/tp]

  • The following will not be translated at all

[tp no_translate]Not translated at all[/tp]

This is the same as using:

<span class="no_translate">hola</span>

The following are self enclosed, and since v0.9.7.2 should be used with the tpe shortcode and not tp

  • Allow output of current target language, useful for example in including specific images for specific languages

[tpe mylang] will output the current language

[tpe mylang lang='he,es'] will output the current language, but only in Spanish or Hebrew

  • Allow output of current target locale, useful for example in including specific scripts

[tpe locale] will output the current locale

<script src="[tpe locale]/all.js#xfbml=1"></script> this will make facebook load the appropriate locale files

an example for using this is when you have an image, and a translation of said image to a few languages, you can use something like <img src="[tpe mylang lang='he,es'].png" title="transposh logo" width="300" height="86" />

[tpe widget="subswidget"] for example, [tpe widget="flags/tpw_flags.php"]

  • Widget shortcode - will output the widget
Last modified 20 months ago Last modified on 07/28/15 23:49:47