Localisations portlet

From VYRE

Jump to: navigation, search
Localisations portlet
module: Publishing module
supplier: [[{{{supplier}}}]]

This portlet lists all localisation keys and messages. Consists of an editing mode within the portlet, in the basic form this mode can be used to create new localisation keys.

For example:

Locale Message Key: Basket en Basket en_US Cart

This can be used to allow users to freely create new localization keys and edit existing ones from the front end, which will cut down time spent accessing this feature within the backend. Should be used specifically when sites are being built that will be serve multi region users and it is essential to have various language interpretations.

Editing mode

Fig.1 Localisation portlet key
  1. Localisation portlet can be accessed under VYRE portlets
  2. When using the portlet the user will be asked to choose a XLS stylesheet and the default number of items per page. The XSL sheet used will be need to created under Files/XSL/Others
  3. Click on 'Save'
  4. If you do not have a XSL ready or a bare minimal XSL stylesheet, the default configuration for this portlet always shows two options that allows the search for any Key or Message. A paginated output is also shown
  5. You can write the XSL stylesheet to show appropiate data, however note the XML starts as 'l10n'.
  6. The XSL stylesheet can be written to allow creating/editing Keys and their corresponding messages. Use the following code for those actions:


Create Key code fragment:

l10n/create-action

The code below can be used to create a clickable link:

<a href="{l10n/create-action-remembering-page}">Create Key</a>

Note: Clicking on Localisations portlet opens up options where you can click on Key, this opens the create new Key feature.(Fig.1)



Edit Key code fragment:

edit-action , for a clickable link:

<a href="{l10n/key/edit-action-remembering-page}">Edit Key</a>


Delete Key code fragment:

remove-action, for a clickable link:

<a href="{l10n/key/remove-action-remembering-page}">Remove Key</a>

Example XSL

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="html" encoding="UTF-8"/>
 
  <xsl:template match="/">
    <p><a href="{l10n/create-action-remembering-page}">Create Key</a></p>
 
    <table border="1"><tr><td><b>Key</b></td><td colspan="2">Action</td></tr>
     <xsl:apply-templates select="/l10n/key" />
    </table>
  </xsl:template>
 
  <xsl:template match="key">
   <tr>
    <td><xsl:value-of select="id" /><xsl:text> </xsl:text></td>
    <td><a href="{edit-action-remembering-page}">Edit Key</a><xsl:text> </xsl:text></td>
    <td><a href="{remove-action-remembering-page}">Remove Key</a></td>
   </tr>
 
  </xsl:template>
</xsl:stylesheet>
Fig.2 Localisation keys list

The XSL above will display a paginated list of all the localisation keys. From there the user can create new keys by clicking on the Create Key link, edit and remove existing keys.(Fig.2)

Personal tools