PageTranslations

Release 1.0 - ...

PageTranslations enable you to define page-local translations that behave just like normal translations, except that they are scoped to the current rendering.

Example 1

Smartsite SXML CopyCode image Copy Code
<se:pagetranslations id="dates"> 
  <se:collection>
    <se:member name="display(date)">
      {datetime.format(translation.arg(1), 'd MMMM yyyy, HH:mm')}
    </se:member>
  </se:collection>
</se:pagetranslations>
Smartsite SXML CopyCode image Copy Code
<se:pagetranslations id="links">
  <se:collection>            
    <se:member name="menu(number)">   
      <se:xlinks displayfields="nr, title, adddate, moddate" parent="{translation.arg(1)}">
        <se:parameters>
          <se:parameter name="format">
            <se:rowformat>
              <li>
                <a href="{this.location()}">{this.field(title)}</a>
                <br />
                <small>Added {translation.dates.display(this.field(adddate))},
                  last modified {translation.dates.display(this.field(moddate))}
                </small>
              </li>
            </se:rowformat>
          </se:parameter>
          <se:parameter name="resultformat">
            <ul>
              {this.result()}
            </ul>
          </se:parameter>
        </se:parameters>
      </se:xlinks>
    </se:member>
  </se:collection>
</se:pagetranslations>

...so we can use the following syntax:

Smartsite SXML CopyCode image Copy Code
{translation.links.menu(1675)}

Example 2

Smartsite SXML CopyCode image Copy Code
<se:pagetranslations id="images">
  <se:collection>
    <se:member name="thumb(location, width, alttext)">
      <se:image 
       location="{translation.arg(1)}" 
       width="{translation.arg(2, default=100)}" 
       alttext="{translation.arg(3)}" 
      />
    </se:member>
  </se:collection>
</se:pagetranslations>
Smartsite SXML CopyCode image Copy Code
{translation.images.thumb(3,,'Smartsite iXperion Logo as thumbnail')}

...resulting in:

HTML CopyCode image Copy Code
<img 
 src="/smartsite.net?id=IMG_IXPERIONLOGO&hid=img;w=100" 
 alt="Smartsite iXperion Logo as thumbnail" 
 style="width:100;height:24" 
/>

Conclusion

Page-local translations are ideal for modularizing your business logic. They behave exactly like normal translations but are scoped to the current page rendering. Consider them as your utility toolbox: you can even place them in normal translations and use them like you would use javascript libraries.