Bug 1035: More work on i18n, this time mostly in adl2controllerclasses
This commit is contained in:
parent
abbdd73ddf
commit
30260bd69e
3 changed files with 83 additions and 57 deletions
|
|
@ -9,8 +9,8 @@
|
|||
Transform ADL into (partial) controller classes
|
||||
|
||||
$Author: sb $
|
||||
$Revision: 1.30 $
|
||||
$Date: 2008-05-21 13:00:56 $
|
||||
$Revision: 1.31 $
|
||||
$Date: 2008-05-27 16:27:27 $
|
||||
-->
|
||||
|
||||
<!-- WARNING WARNING WARNING: Do NOT reformat this file!
|
||||
|
|
@ -32,7 +32,13 @@
|
|||
client's locale -->
|
||||
<xsl:param name="locale" select="en-UK"/>
|
||||
|
||||
<!-- The C# namespace within which I shall generate controllers -->
|
||||
<!-- 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"/>
|
||||
|
||||
<!-- The C# namespace within which I shall generate controllers -->
|
||||
<xsl:param name="controllerns" select="Unset"/>
|
||||
<!-- The C# namespace used by the entities for this project -->
|
||||
<xsl:param name="entityns" select="Unset"/>
|
||||
|
|
@ -66,7 +72,7 @@
|
|||
//
|
||||
// Automatically generated abstract super class for controllers for the
|
||||
// <xsl:value-of select="/adl:application/@name"/> application; generated using
|
||||
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.30 $', 10)"/>
|
||||
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.31 $', 10)"/>
|
||||
//
|
||||
// This file is automatically generated; DO NOT EDIT IT.
|
||||
//
|
||||
|
|
@ -129,7 +135,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
//
|
||||
// Controller for auto-generated forms for editing <xsl:value-of select="@name"/>s
|
||||
// Automatically generated from application description using
|
||||
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.30 $', 10)"/>
|
||||
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.31 $', 10)"/>
|
||||
//
|
||||
// This file is automatically generated; DO NOT EDIT IT.
|
||||
//
|
||||
|
|
@ -454,16 +460,18 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
hibernator.Flush();
|
||||
tx.Commit();
|
||||
|
||||
messages.Add( "Record saved successfully");
|
||||
messages.Add( "<xsl:call-template name="i18n-record-saved"/>");
|
||||
} /* try actually commit */
|
||||
catch ( Exception any) {
|
||||
tx.Rollback();
|
||||
messages.Add( "Record not saved");
|
||||
messages.Add( "<xsl:call-template name="i18n-record-not-saved"/>");
|
||||
throw any;
|
||||
}
|
||||
} /* if ( record != null) */
|
||||
else {
|
||||
throw new ApplicationException( String.Format( "No record of type <xsl:value-of select="@name"/> with the key values supplied was found"));
|
||||
throw new ApplicationException( String.Format( "<xsl:call-template name="i18n-record-not-found">
|
||||
<xsl:with-param name="entity-name" select="@name"/>
|
||||
</xsl:call-template>"));
|
||||
}
|
||||
} /* if ( HasNoErrors()) */
|
||||
} /* try */
|
||||
|
|
@ -697,7 +705,9 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
<xsl:apply-templates select="adl:ifmissing[@locale=$locale]"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
"You must supply a value for <xsl:value-of select="@name"/>"
|
||||
"<xsl:call-template name="i18n-value-required">
|
||||
<xsl:with-param name="property-name" select="@name"/>
|
||||
</xsl:call-template>"
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>);
|
||||
}
|
||||
|
|
@ -714,16 +724,6 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
</xsl:template>
|
||||
|
||||
<xsl:template match="adl:form">
|
||||
<!-- xsl:variable name="key">
|
||||
<xsl:call-template name="primary-key-name">
|
||||
<xsl:with-param name="entity" select="ancestor::adl:entity"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="keytype">
|
||||
<xsl:call-template name="primary-key-csharp-type">
|
||||
<xsl:with-param name="entity" select="ancestor::adl:entity"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable -->
|
||||
/// <summary>
|
||||
/// Handle the submission of the form named <xsl:value-of select="@name"/>
|
||||
/// </summary>
|
||||
|
|
@ -732,7 +732,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
string command = Form[ "command"];
|
||||
|
||||
if ( command == null) {
|
||||
throw new Exception( "No command?");
|
||||
throw new Exception( "<xsl:call-template name="i18n-command-not-found"/>");
|
||||
}
|
||||
else
|
||||
<xsl:for-each select=".//verb">
|
||||
|
|
@ -766,7 +766,9 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
}
|
||||
else
|
||||
{
|
||||
throw new Exception( String.Format("Unrecognised command '{0}'", command));
|
||||
throw new Exception( String.Format("<xsl:call-template name="i18n-command-not-found">
|
||||
<xsl:with-param name="command" select="'{0}'"/>
|
||||
</xsl:call-template>", command));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue