bug 1896: Added i18n-en-GB-include.xslt, containing templates for all the user-visible boilerplate text generated in views. Unfortunately I haven't yet worked out how to do conditional includes in XSLT, so this is a step on the way to a solution, not a solution in itself.

This commit is contained in:
sb 2008-05-26 14:40:08 +00:00
parent be2cc24ea7
commit 8d0c2a00f6
2 changed files with 245 additions and 93 deletions

View file

@ -13,16 +13,12 @@
Transform ADL into velocity view templates Transform ADL into velocity view templates
$Author: sb $ $Author: sb $
$Revision: 1.21 $ $Revision: 1.22 $
$Date: 2008-05-21 13:00:57 $ $Date: 2008-05-26 14:40:08 $
--> -->
<!-- WARNING WARNING WARNING: Do NOT reformat this file! <!-- WARNING WARNING WARNING: Do NOT reformat this file!
Whitespace (or lack of it) is significant! --> Whitespace (or lack of it) is significant! -->
<!--
TODO: this transform BADLY needs to be refactored! It is /crap/!
-->
<xsl:include href="base-type-include.xslt"/> <xsl:include href="base-type-include.xslt"/>
<xsl:output method="xml" indent="yes" encoding="UTF-8" omit-xml-declaration="yes"/> <xsl:output method="xml" indent="yes" encoding="UTF-8" omit-xml-declaration="yes"/>
@ -30,7 +26,13 @@
<!-- The locale for which these views are generated <!-- The locale for which these views are generated
TODO: we need to generate views for each available locale, but this is not TODO: we need to generate views for each available locale, but this is not
yet implemented. When it is we will almost certainly still need a 'default locale' --> yet implemented. When it is we will almost certainly still need a 'default locale' -->
<xsl:param name="locale" select="en-UK"/> <xsl:param name="locale" select="en-GB"/>
<!-- bug 1896 : boilerplate text in views should be tailored to the locale of
the expected user. Unfortunately I haven't yet worked out how to do
conditional includes in XSLT, so this is a step on the way to a solution,
not a solution in itself. -->
<xsl:include href="i18n-en-GB-include.xslt"/>
<!-- whether or not to auto-generate site navigation - by default, don't --> <!-- whether or not to auto-generate site navigation - by default, don't -->
<xsl:param name="generate-site-navigation" select="'false'"/> <xsl:param name="generate-site-navigation" select="'false'"/>
@ -112,14 +114,17 @@
<xsl:comment> [ cut here: next file '<xsl:value-of select="concat( @name, '/maybedelete.auto.vm')"/>' ] </xsl:comment> <xsl:comment> [ cut here: next file '<xsl:value-of select="concat( @name, '/maybedelete.auto.vm')"/>' ] </xsl:comment>
<xsl:text> <xsl:text>
</xsl:text> </xsl:text>
#set( $title = "<xsl:value-of select="concat( 'Really delete ', @name)"/> $instance.UserIdentifier") <xsl:variable name="really-delete">
<xsl:call-template name="i18n-really-delete"/>
</xsl:variable>
#set( $title = "<xsl:value-of select="concat( $really-delete, ' ', @name)"/> $instance.UserIdentifier")
<xsl:comment> <xsl:comment>
<xsl:value-of select="$product-version"/> <xsl:value-of select="$product-version"/>
Auto generated Velocity maybe-delete form for <xsl:value-of select="@name"/>, Auto generated Velocity maybe-delete form for <xsl:value-of select="@name"/>,
generated from ADL. generated from ADL.
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.21 $', 10)"/> Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.22 $', 10)"/>
</xsl:comment> </xsl:comment>
<xsl:call-template name="maybe-delete"> <xsl:call-template name="maybe-delete">
<xsl:with-param name="entity" select="."/> <xsl:with-param name="entity" select="."/>
@ -146,7 +151,10 @@
<xsl:text> <xsl:text>
</xsl:text> </xsl:text>
<html> <html>
#set( $title = "<xsl:value-of select="concat( 'Really delete ', @name)"/> $instance.UserIdentifier") <xsl:variable name="really-delete">
<xsl:call-template name="i18n-really-delete"/>
</xsl:variable>
#set( $title = "<xsl:value-of select="concat( $really-delete, ' ', @name)"/> $instance.UserIdentifier")
<head> <head>
<title>$!title</title> <title>$!title</title>
<xsl:call-template name="head"/> <xsl:call-template name="head"/>
@ -154,7 +162,7 @@
Auto generated Velocity maybe-delete form for <xsl:value-of select="@name"/>, Auto generated Velocity maybe-delete form for <xsl:value-of select="@name"/>,
generated from ADL. generated from ADL.
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.21 $', 10)"/> Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.22 $', 10)"/>
</xsl:comment> </xsl:comment>
<xsl:call-template name="install-scripts"/> <xsl:call-template name="install-scripts"/>
</head> </head>
@ -201,12 +209,16 @@
<table> <table>
<tr align="left" valign="top" class="actionDangerous"> <tr align="left" valign="top" class="actionDangerous">
<td class="actionDangerous"> <td class="actionDangerous">
Really delete? <xsl:call-template name="i18n-really-delete"/>
</td> </td>
<td class="widget"> <td class="widget">
<select name="reallydelete"> <select name="reallydelete">
<option value="false">No, don't delete it</option> <option value="false">
<option value="true">Yes, do delete it</option> <xsl:call-template name="i18n-really-delete-no"/>
</option>
<option value="true">
<xsl:call-template name="i18n-really-delete-yes"/>
</option>
</select> </select>
</td> </td>
<td class="actionDangerous" style="text-align:right"> <td class="actionDangerous" style="text-align:right">
@ -221,15 +233,10 @@
<xsl:template match="adl:form" mode="non-empty-layout"> <xsl:template match="adl:form" mode="non-empty-layout">
<xsl:variable name="formname" select="@name"/> <xsl:variable name="formname" select="@name"/>
<xsl:variable name="aoran"> <xsl:variable name="aoran">
<xsl:call-template name="i18n-indefinite-article">
<xsl:with-param name="noun" select="ancestor::adl:entity/@name"/>
</xsl:call-template>
<xsl:variable name="initial" select="substring( ancestor::adl:entity/@name, 1, 1)"/> <xsl:variable name="initial" select="substring( ancestor::adl:entity/@name, 1, 1)"/>
<xsl:choose>
<xsl:when test="$initial = 'A'">an</xsl:when>
<xsl:when test="$initial = 'E'">an</xsl:when>
<xsl:when test="$initial = 'I'">an</xsl:when>
<xsl:when test="$initial = 'O'">an</xsl:when>
<xsl:when test="$initial = 'U'">an</xsl:when>
<xsl:otherwise>a</xsl:otherwise>
</xsl:choose>
</xsl:variable> </xsl:variable>
<xsl:text> <xsl:text>
</xsl:text> </xsl:text>
@ -242,13 +249,15 @@
Auto generated Velocity <xsl:value-of select="@name"/> form for <xsl:value-of select="ancestor::adl:entity/@name"/>, Auto generated Velocity <xsl:value-of select="@name"/> form for <xsl:value-of select="ancestor::adl:entity/@name"/>,
generated from ADL. generated from ADL.
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.21 $', 10)"/> Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.22 $', 10)"/>
</xsl:comment> </xsl:comment>
#capturefor( title) #capturefor( title)
#if ( $instance) #if ( $instance)
<xsl:value-of select="concat( 'Edit ', ' ', ancestor::adl:entity/@name)"/> $instance.UserIdentifier <xsl:value-of select="concat( 'Edit ', ' ', ancestor::adl:entity/@name)"/> $instance.UserIdentifier
#else #else
Add a new <xsl:value-of select="ancestor::adl:entity/@name"/> <xsl:call-template name="i18n-add-a-new">
<xsl:with-param name="entity-name" select="ancestor::adl:entity/@name"/>
</xsl:call-template>
#end #end
#end #end
#capturefor( headextras) #capturefor( headextras)
@ -281,7 +290,9 @@
<xsl:apply-templates select="adl:help[@locale=$locale]"/> <xsl:apply-templates select="adl:help[@locale=$locale]"/>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
Does not meet the format requirements for <xsl:value-of select="@name"/> <xsl:call-template name="i18n-bad-format">
<xsl:with-param name="format-name" select="@name"/>
</xsl:call-template>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:variable> </xsl:variable>
@ -335,15 +346,10 @@
<xsl:template match="adl:form" mode="empty-layout"> <xsl:template match="adl:form" mode="empty-layout">
<xsl:variable name="formname" select="@name"/> <xsl:variable name="formname" select="@name"/>
<xsl:variable name="aoran"> <xsl:variable name="aoran">
<xsl:call-template name="i18n-indefinite-article">
<xsl:with-param name="noun" select="ancestor::adl:entity/@name"/>
</xsl:call-template>
<xsl:variable name="initial" select="substring( ancestor::adl:entity/@name, 1, 1)"/> <xsl:variable name="initial" select="substring( ancestor::adl:entity/@name, 1, 1)"/>
<xsl:choose>
<xsl:when test="$initial = 'A'">an</xsl:when>
<xsl:when test="$initial = 'E'">an</xsl:when>
<xsl:when test="$initial = 'I'">an</xsl:when>
<xsl:when test="$initial = 'O'">an</xsl:when>
<xsl:when test="$initial = 'U'">an</xsl:when>
<xsl:otherwise>a</xsl:otherwise>
</xsl:choose>
</xsl:variable> </xsl:variable>
<xsl:text> <xsl:text>
</xsl:text> </xsl:text>
@ -355,7 +361,9 @@
#if ( $instance) #if ( $instance)
#set( $title = "<xsl:value-of select="concat( 'Edit ', ' ', ancestor::adl:entity/@name)"/> $instance.UserIdentifier") #set( $title = "<xsl:value-of select="concat( 'Edit ', ' ', ancestor::adl:entity/@name)"/> $instance.UserIdentifier")
#else #else
#set( $title = "Add a new <xsl:value-of select="ancestor::adl:entity/@name"/>") #set( $title = "<xsl:call-template name="i18n-add-a-new">
<xsl:with-param name="entity-name" select="ancestor::adl:entity/@name"/>
</xsl:call-template>")
#end #end
</xsl:comment> </xsl:comment>
<head> <head>
@ -367,7 +375,7 @@
Auto generated Velocity form for <xsl:value-of select="ancestor::adl:entity/@name"/>, Auto generated Velocity form for <xsl:value-of select="ancestor::adl:entity/@name"/>,
generated from ADL. generated from ADL.
Generated using adl2views.xsl <xsl:value-of select="substring( '$Revision: 1.21 $', 10)"/> Generated using adl2views.xsl <xsl:value-of select="substring( '$Revision: 1.22 $', 10)"/>
</xsl:comment> </xsl:comment>
<xsl:call-template name="install-scripts"/> <xsl:call-template name="install-scripts"/>
<script type='text/javascript' language='JavaScript1.2'> <script type='text/javascript' language='JavaScript1.2'>
@ -385,7 +393,7 @@
<xsl:for-each select="../property[@type='link']"> <xsl:for-each select="../property[@type='link']">
document.<xsl:value-of select="$formname"/>.<xsl:value-of select="@name"/>.submitHandler = shuffleSubmitHandler; document.<xsl:value-of select="$formname"/>.<xsl:value-of select="@name"/>.submitHandler = shuffleSubmitHandler;
</xsl:for-each> </xsl:for-each>
var validator = new Validation('<xsl:value-of select="$formname"/>', {immediate : true, useTitles : true}); var validator = new Validation('<xsl:value-of select="$formname"/>', {immediate : true, useTitles : true});
<xsl:if test="fieldgroup"> <xsl:if test="fieldgroup">
switchtab( '<xsl:value-of select="fieldgroup[1]/@name"/>'); switchtab( '<xsl:value-of select="fieldgroup[1]/@name"/>');
</xsl:if> </xsl:if>
@ -397,7 +405,9 @@
<xsl:apply-templates select="adl:help[@locale=$locale]"/> <xsl:apply-templates select="adl:help[@locale=$locale]"/>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
Does not meet the format requirements for <xsl:value-of select="@name"/> <xsl:call-template name="i18n-bad-format">
<xsl:with-param name="format-name" select="@name"/>
</xsl:call-template>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:variable> </xsl:variable>
@ -542,7 +552,7 @@
</xsl:choose> </xsl:choose>
<tr class="actionSafe"> <tr class="actionSafe">
<td class="actionSafe" colspan="2"> <td class="actionSafe" colspan="2">
To save this record <xsl:call-template name='i18n-save-prompt'/>
</td> </td>
<td class="actionSafe" style="text-align:right"> <td class="actionSafe" style="text-align:right">
<button type="submit" name="command" value="store">Save this!</button> <button type="submit" name="command" value="store">Save this!</button>
@ -555,7 +565,7 @@
#if ( $instance.NoDeleteReason) #if ( $instance.NoDeleteReason)
[ $instance.NoDeleteReason ] [ $instance.NoDeleteReason ]
#else #else
To delete this record <xsl:call-template name="i18n-delete-prompt"/>
#end #end
#end #end
</td> </td>
@ -632,14 +642,6 @@
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:variable> </xsl:variable>
<xsl:comment>
$listprop = <xsl:value-of select="$listprop"/>;
$farent = <xsl:value-of select="$farent"/>;
$nearent = <xsl:value-of select="$nearent"/>;
$farid = <xsl:value-of select="$farid"/>;
$farkey = <xsl:value-of select="$farkey"/>;
$nearkey = <xsl:value-of select="$nearkey"/>;
</xsl:comment>
<xsl:variable name="action" select="concat( '../', $farent, '/', @onselect)"/> <xsl:variable name="action" select="concat( '../', $farent, '/', @onselect)"/>
<xsl:if test="@canadd='true'"> <xsl:if test="@canadd='true'">
<tr> <tr>
@ -651,7 +653,9 @@
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="concat( $action, '.rails?', $farkey, '=$instance.', $nearkey)"/> <xsl:value-of select="concat( $action, '.rails?', $farkey, '=$instance.', $nearkey)"/>
</xsl:attribute> </xsl:attribute>
Add a new <xsl:value-of select="$farent"/> <xsl:call-template name="i18n-add-a-new">
<xsl:with-param name="entity-name" select="$farent"/>
</xsl:call-template>
</a> </a>
</td> </td>
</tr> </tr>
@ -879,16 +883,27 @@
<xsl:value-of select="adl:if-missing[@locale = $locale]"/> <xsl:value-of select="adl:if-missing[@locale = $locale]"/>
</xsl:when> </xsl:when>
<xsl:when test="@required='true'"> <xsl:when test="@required='true'">
You must provide a value for <xsl:value-of select="@name"/> <xsl:call-template name="i18n-value-required">
<xsl:with-param name="propert-name" select="@name"/>
</xsl:call-template>
</xsl:when> </xsl:when>
<xsl:when test="@type='defined'"> <xsl:when test="@type='defined'">
The value for <xsl:value-of select="@name"/> must be <xsl:value-of select="@definition"/> <xsl:call-template name="i18n-value-defined">
<xsl:with-param name="property-name" select="@name"/>
<xsl:with-param name="definition-name" select="@typedef"/>
</xsl:call-template>
</xsl:when> </xsl:when>
<xsl:when test="@type='entity'"> <xsl:when test="@type='entity'">
The value for <xsl:value-of select="@name"/> must be an instance of <xsl:value-of select="@entity"/> <xsl:call-template name="i18n-value-entity">
<xsl:with-param name="property-name" select="@name"/>
<xsl:with-param name="entity-name" select="@entity"/>
</xsl:call-template>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
The value for <xsl:value-of select="@name"/> must be <xsl:value-of select="@type"/> <xsl:call-template name="i18n-value-type">
<xsl:with-param name="property-name" select="@name"/>
<xsl:with-param name="type-name" select="@type"/>
</xsl:call-template>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:variable> </xsl:variable>
@ -974,19 +989,9 @@
<xsl:text> <xsl:text>
</xsl:text> </xsl:text>
<xsl:variable name="withpluralsuffix"> <xsl:variable name="withpluralsuffix">
<!-- English-laguage syntactic sugar of entity name --> <xsl:call-template name="i18n-plural">
<xsl:choose> <xsl:with-param name="noun" select="ancestor::adl:entity/@name"/>
<xsl:when test="../@name='Person'">People</xsl:when> </xsl:call-template>
<xsl:when test="starts-with( substring(../@name, string-length(../@name) ), 's')">
<xsl:value-of select="../@name"/>es
</xsl:when>
<xsl:when test="starts-with( substring(../@name, string-length(../@name) ), 'y')">
<xsl:value-of select="substring( ../@name, 0, string-length(../@name) )"/>ies
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="../@name"/>s
</xsl:otherwise>
</xsl:choose>
</xsl:variable> </xsl:variable>
<xsl:comment> <xsl:comment>
<xsl:value-of select="$product-version"/> <xsl:value-of select="$product-version"/>
@ -994,7 +999,7 @@
Auto generated Velocity list for <xsl:value-of select="@name"/>, Auto generated Velocity list for <xsl:value-of select="@name"/>,
generated from ADL. generated from ADL.
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.21 $', 10)"/> Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.22 $', 10)"/>
</xsl:comment> </xsl:comment>
#capturefor( title) #capturefor( title)
@ -1011,30 +1016,19 @@
</xsl:template> </xsl:template>
<!-- layout of a list assuming an empty layout --> <!-- layout of a list assuming an empty layout -->
<xsl:template match="adl:list" mode="empty-layout"> <xsl:template match="adl:list" mode="empty-layout">
<xsl:variable name="action" select="@onselect"/> <xsl:variable name="action" select="@onselect"/>
<xsl:text> <xsl:text>
</xsl:text> </xsl:text>
<xsl:comment> [ cut here: next file '<xsl:value-of select="concat( ../@name, '/', @name)"/>.auto.vm' ] </xsl:comment> <xsl:comment>[ cut here: next file '<xsl:value-of select="concat( ../@name, '/', @name)"/>.auto.vm' ]</xsl:comment>
<xsl:text> <xsl:text>
</xsl:text> </xsl:text>
<xsl:variable name="withpluralsuffix"> <xsl:variable name="withpluralsuffix">
<!-- English-laguage syntactic sugar of entity name. TODO (bug 1896): This really /must/ not be here. <xsl:call-template name="i18n-plural">
some means of doing i18n syntactic sugar needs to be spliced in. --> <xsl:with-param name="noun" select="ancestor::adl:entity/@name"/>
<xsl:choose> </xsl:call-template>
<xsl:when test="../@name='Person'">People</xsl:when> </xsl:variable>
<xsl:when test="starts-with( substring(../@name, string-length(../@name) ), 's')"> <html>
<xsl:value-of select="../@name"/>es
</xsl:when>
<xsl:when test="starts-with( substring(../@name, string-length(../@name) ), 'y')">
<xsl:value-of select="substring( ../@name, 0, string-length(../@name) )"/>ies
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="../@name"/>s
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<html>
<head> <head>
#set( $title = "<xsl:value-of select="normalize-space( concat( 'List ', $withpluralsuffix))"/>") #set( $title = "<xsl:value-of select="normalize-space( concat( 'List ', $withpluralsuffix))"/>")
<title>$!title</title> <title>$!title</title>
@ -1044,7 +1038,7 @@
Auto generated Velocity list for <xsl:value-of select="ancestor::adl:entity/@name"/>, Auto generated Velocity list for <xsl:value-of select="ancestor::adl:entity/@name"/>,
generated from ADL. generated from ADL.
Generated using adl2listview.xsl <xsl:value-of select="substring( '$Revision: 1.21 $', 10)"/> Generated using adl2listview.xsl <xsl:value-of select="substring( '$Revision: 1.22 $', 10)"/>
</xsl:comment> </xsl:comment>
<xsl:call-template name="install-scripts"/> <xsl:call-template name="install-scripts"/>
</head> </head>
@ -1089,7 +1083,9 @@
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="concat( ancestor::adl:entity/adl:form[position()=1]/@name, '.rails')"/> <xsl:value-of select="concat( ancestor::adl:entity/adl:form[position()=1]/@name, '.rails')"/>
</xsl:attribute> </xsl:attribute>
Add a new <xsl:value-of select="ancestor::adl:entity/@name"/> <xsl:call-template name="i18n-add-a-new">
<xsl:with-param name="entity-name" select="ancestor::adl:entity/@name"/>
</xsl:call-template>
</a> </a>
</span> </span>
</xsl:if> </xsl:if>

View file

@ -0,0 +1,156 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns="http://cygnets.co.uk/schemas/adl-1.2"
xmlns:adl="http://cygnets.co.uk/schemas/adl-1.2"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<!--
Application Description Language framework
i18n-en-GB-include.xsl
(c) 2007 Cygnet Solutions Ltd
Internationalisation support for British English; use
this as a template to provide internationalisation support
for other natural languages.
In general all templates in this file are
(i) named;
(ii) have names starting with 'i18n-';
(iii) take arguments which are strings only, not nodesets.
Templates are listed in alphabetical order.
$Author: sb $
$Revision: 1.1 $
$Date: 2008-05-26 14:40:08 $
-->
<xsl:output method="xml" indent="yes"/>
<xsl:template name="i18n-add-a-new">
<!-- a string, presumed to be the name of a domain entity -->
<xsl:param name="entity-name"/>
<xsl:value-of select="concat( 'Add a new ', $entity-name)"/>
</xsl:template>
<xsl:template name="i18n-bad-format">
<!-- a string, presumed to be the name of a format definition -->
<xsl:param name="format-name"/>
<xsl:value-of select="concat( 'Does not meet the format requirements for', $format-name)"/>
</xsl:template>
<xsl:template name="i18n-delete-prompt">
<xsl:value-of select="'To delete this record'"/>
</xsl:template>
<xsl:template name="i18n-indefinite-article">
<!-- a string, presumed to be a noun- e.g. the name of an entity -->
<xsl:param name="noun"/>
<xsl:variable name="initial" select="substring( $noun, 1, 1)"/>
<xsl:choose>
<xsl:when test="$initial = 'A' or $initial = 'a'">an</xsl:when>
<xsl:when test="$initial = 'E' or $initial = 'e'">an</xsl:when>
<xsl:when test="$initial = 'I' or $initial = 'i'">an</xsl:when>
<xsl:when test="$initial = 'O' or $initial = 'o'">an</xsl:when>
<xsl:when test="$initial = 'U' or $initial = 'u'">an</xsl:when>
<xsl:otherwise>a</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="i18n-list">
<!-- a string, presumed to be the name of a domain entity -->
<xsl:param name="entity-name"/>
<xsl:variable name="plural">
<xsl:call-template name="i18n-plural">
<xsl:with-param name="noun" select="entity-name"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="concat( 'List', $plural)"/>
</xsl:template>
<xsl:template name="i18n-plural">
<!-- a string, presumed to be a noun -->
<xsl:param name="noun"/>
<!-- English-laguage syntactic sugar of entity name -->
<xsl:choose>
<xsl:when test="$noun='Person'">People</xsl:when>
<!-- add other special cases here -->
<xsl:when test="starts-with( substring($noun, string-length($noun) ), 's')">
<xsl:value-of select="concat( $noun, 'es')"/>
</xsl:when>
<xsl:when test="starts-with( substring($noun, string-length($noun) ), 'y')">
<xsl:value-of select="concat( substring( $noun, 0, string-length($noun)), 'ies')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat( $noun, 's')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- the 'really delete' message, used in two-phase delete process -->
<xsl:template name="i18n-really-delete">
<xsl:value-of select="'Really delete'"/>
</xsl:template>
<!-- the 'cancel delete' message, used in two-phase delete process -->
<xsl:template name="i18n-really-delete-no">
<xsl:value-of select="'No, do not delete it'"/>
</xsl:template>
<!-- the 'confirm delete' message, used in two-phase delete process -->
<xsl:template name="i18n-really-delete-yes">
<xsl:value-of select="'Yes, do delete it'"/>
</xsl:template>
<xsl:template name="i18n-save-prompt">
<xsl:value-of select="'To save this record'"/>
</xsl:template>
<xsl:template name="i18n-value-defined">
<!-- a string, presumed to be the name of a property -->
<xsl:param name="property-name"/>
<!-- a string, presumed to be the name of a defined type -->
<xsl:param name="definition-name"/>
<xsl:variable name="aoran">
<xsl:call-template name="i18n-indefinite-article">
<xsl:with-param name="noun" select="$definition-name"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="concat( 'The value for ', $property-name, ' must be ', $aoran, ' ', $definition-name)"/>
</xsl:template>
<xsl:template name="i18n-value-entity">
<!-- a string, presumed to be the name of a property -->
<xsl:param name="property-name"/>
<!-- a string, presumed to be the name of a domain entity -->
<xsl:param name="entity-name"/>
<xsl:variable name="aoran">
<xsl:call-template name="i18n-indefinite-article">
<xsl:with-param name="noun" select="$entity-name"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="concat( 'The value for ', $property-name, ' must be ', $aoran, ' ', $entity-name)"/>
</xsl:template>
<xsl:template name="i18n-value-required">
<!-- a string, presumed to be the name of a property -->
<xsl:param name="property-name"/>
<xsl:value-of select="concat( 'You must provide a value for', $property-name)"/>
</xsl:template>
<xsl:template name="i18n-value-type">
<!-- a string, presumed to be the name of a property -->
<xsl:param name="property-name"/>
<!-- a string, presumed to be the name of a type -->
<xsl:param name="type-name"/>
<xsl:variable name="aoran">
<xsl:call-template name="i18n-indefinite-article">
<xsl:with-param name="noun" select="$type-name"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="concat( 'The value for ', $property-name, ' must be ', $aoran, ' ', $type-name)"/>
</xsl:template>
</xsl:stylesheet>