wiki:ShortCodes

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]

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

[tp lang="es" only="y"]Hola Espaniol[/tp]

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

[tp lang="he" not_in="es,fr"]עברית לא בספרדית וצרפתית[/tp]

  • 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="y"]Hola[/tp]

  • The following will not be translated at all

[tp no_translate="y"]Not translated at all[/tp]

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

[tp mylang="y"] will output the current language

[tp mylang="y" lang="he,es"] will output the current language, but only in Spanish or Hebrew

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="http://s.transposh.net/s/logo[tp mylang="y" lang="he,es"].png" title="transposh logo" width="300" height="86" />

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

  • Widget shortcode - will output the widget
Last modified 3 years ago Last modified on 04/30/12 22:49:41