Changes between Version 4 and Version 5 of ShortCodes


Ignore:
Timestamp:
07/28/15 23:49:47 (21 months ago)
Author:
ofer
Comment:

Changes soon out in 0.9.7.2 adding the tpe shortcode, removing the unneeded "y" and better documentation all in all

Legend:

Unmodified
Added
Removed
Modified
  • ShortCodes

    v4 v5  
    1 Shortcodes allow you to make transposh relate to some language information that you can provide it with.
     1== Shortcodes allow you to make transposh relate to some language information that you can provide it with. ==
    22
    33The support already existed with some html classes and tags, and is simplified with the tp shortcode, see examples below:
     
    55
    66* Specify language of the enclosed phrase, in the example, we know its in Spanish
    7 {{{[tp lang="es"]hola[/tp]}}}
     7{{{[tp lang="es"]hola[/tp]}}}[[BR]]
     8This is the same as using:[[BR]]
     9{{{<span lang="es">hola</span>}}}
     10
     11[[BR]]
    812
    913* Specifiy that the phrase is in Spanish and will only be displayed to Spanish users
    10 {{{[tp lang="es" only="y"]Hola Espaniol[/tp]}}}
     14{{{[tp lang="es" only]Hola Espaniol[/tp]}}}[[BR]]
     15This is the same as using:[[BR]]
     16{{{<span lang="es" class="only_thislanguage">hola</span>}}}
     17
     18[[BR]]
    1119
    1220* The following Hebrew phrase will be hidden from Spanish and French users
    13 {{{[tp lang="he" not_in="es,fr"]עברית לא בספרדית וצרפתית[/tp]}}}
     21{{{[tp lang="he" not_in="es,fr"]עברית לא בספרדית וצרפתית[/tp]}}}[[BR]]
     22We have no class replacement for this one yet
     23
     24[[BR]]
    1425
    1526* The following default language phrase will not be seen by Spanish and French users
    1627{{{[tp not_in="es,fr"]Not in francis, espanol[/tp]}}}
    1728
     29
    1830A 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:
    1931
    20 {{{[tp not_in="es"]Hello[/tp] [tp lang="es" only="y"]Hola[/tp]}}}
     32{{{[tp not_in="es"]Hello[/tp] [tp lang="es" only]Hola[/tp]}}}
     33
     34[[BR]]
    2135
    2236* The following will not be translated at all
    23 {{{[tp no_translate="y"]Not translated at all[/tp]}}}
     37{{{[tp no_translate]Not translated at all[/tp]}}}[[BR]]
     38
     39This is the same as using:[[BR]]
     40
     41{{{<span class="no_translate">hola</span>}}}
     42
     43[[BR]]
    2444
    2545
     46== The following are self enclosed, and since v0.9.7.2 should be used with the tpe shortcode and not tp ==
     47
    2648* Allow output of current target language, useful for example in including specific images for specific languages
    27 {{{[tp mylang="y"]}}} will output the current language
     49{{{[tpe mylang]}}} will output the current language
    2850
    29 {{{[tp locale="y"]}}} will output the current locale
     51{{{[tpe mylang lang='he,es']}}} will output the current language, but only in Spanish or Hebrew
    3052
    31 {{{[tp mylang="y" lang="he,es"]}}} will output the current language, but only in Spanish or Hebrew
     53* Allow output of current target locale, useful for example in including specific scripts
     54
     55{{{[tpe locale]}}} will output the current locale
     56
     57{{{<script src="http://connect.facebook.net/[tpe locale]/all.js#xfbml=1"></script>}}} this will make facebook load the appropriate locale files
     58
    3259
    3360an 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
    34 {{{<img src="http://s.transposh.net/s/logo[tp mylang='y' lang='he,es'].png" title="transposh logo" width="300" height="86" />}}}
     61{{{<img src="http://s.transposh.net/s/logo[tpe mylang lang='he,es'].png" title="transposh logo" width="300" height="86" />}}}
    3562
    36 {{{[tp widget="subswidget"]}}}
    37 for example, {{{[tp widget="flags/tpw_flags.php"]}}}
     63{{{[tpe widget="subswidget"]}}}
     64for example, {{{[tpe widget="flags/tpw_flags.php"]}}}
    3865* Widget shortcode - will output the widget