trans

An article by Gaspard Bucher

Translate static content using the loaded dictionary or gettext strings.

  1. action
  2. ajax
  3. API
  4. classes
  5. common attributes
  6. conditions
  7. context
  8. dates
  9. display
  10. forms
  11. i18n
    1. lang_links
    2. load
    3. trans
    4. wrong_lang
  12. meta
  13. SQLiss
  14. urls

Translate static content using the loaded dictionary or gettext strings.

  • attr find value as attribute
  • eval evaluate a RubyLess expression
  • text, t RubyLess evaluated string.
see attr, eval, load, text, t, zena 1.0

You can use the content of the inner html as key for the translation:

<h3 do='trans'>documents list</h3>

If your translation keys do not correspond to the template’s dummy text, you should use text:

<h3 do='t' text='doc_list'>documents list</h3>

or even:

<h3 do='t("doc_#{ref_lang}")'>english docs</h3>

You can create your own translations by writing them in a node. The translations are loaded with the “load” method.

links

If you want to link to a page but have a static text instead of the node’s title, you have to use translate:

<span do='link' anchor='comments' do='t'>comments</span>

We force the use of do='t' so that we can keep dummy text in templates for the designers.

RubyLess integration

You can translate the result of a RubyLess parsing with either of these syntaxes (v is an alias for version):

<p do='trans' eval='v.lang'/>
<p do='trans(v.lang)'/>