(no commit message)
[paste/261.git] / flux-labels.xsl
1 <?xml version="1.0" encoding="utf-8"?>
2 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3                 xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
4                 xmlns:flux="http://typo3.org/ns/FluidTYPO3/Flux/ViewHelpers"
5                 exclude-result-prefixes="f flux"
6 >
7   <!--
8       Generates translation label file entries for a fluidcontent element
9
10       $ xsltproc flux-labels.xsl Resources/Private/Templates/Content/Elem.html
11
12       @author Christian Weiske <weiske@mogic.com>
13   -->
14   <xsl:output omit-xml-declaration="no" indent="yes" method="xml"/>
15
16   <xsl:template match="/">
17     <xsl:for-each select=".//f:section[@name='Configuration']">
18       <xliff version="1.0">
19         <file source-language="en" datatype="plaintext">
20           <header/>
21           <body>
22             <xsl:call-template name="config">
23               <xsl:with-param name="formid" select="flux:form/@id"/>
24             </xsl:call-template>
25           </body>
26         </file>
27       </xliff>
28     </xsl:for-each>
29   </xsl:template>
30
31   <xsl:template name="config">
32     <xsl:param name="formid"/>
33
34     <xsl:call-template name="transunit">
35       <xsl:with-param name="genid">flux.<xsl:value-of select="$formid"/></xsl:with-param>
36     </xsl:call-template>
37     <xsl:call-template name="transunit">
38       <xsl:with-param name="genid">flux.<xsl:value-of select="$formid"/>.description</xsl:with-param>
39     </xsl:call-template>
40
41     <xsl:for-each select=".//*[@name]">
42       <xsl:call-template name="element">
43         <xsl:with-param name="formid" select="$formid"/>
44         <xsl:with-param name="elemid" select="@name"/>
45       </xsl:call-template>
46     </xsl:for-each>
47   </xsl:template>
48
49   <xsl:template name="element">
50     <xsl:param name="formid"/>
51     <xsl:param name="elemid"/>
52
53     <xsl:if test="starts-with(name(), 'flux:field.input') or starts-with(name(), 'flux:field.inline')">
54       <xsl:call-template name="transunit">
55         <xsl:with-param name="genid">
56           <xsl:text>flux.</xsl:text><xsl:value-of select="$formid"/>
57           <xsl:text>.fields.</xsl:text><xsl:value-of select="$elemid"/>
58         </xsl:with-param>
59       </xsl:call-template>
60     </xsl:if>
61
62     <xsl:if test="name()='flux:grid.column'">
63       <xsl:call-template name="transunit">
64         <xsl:with-param name="genid">
65           <xsl:text>flux.</xsl:text><xsl:value-of select="$formid"/>
66           <xsl:text>.columns.</xsl:text><xsl:value-of select="$elemid"/>
67         </xsl:with-param>
68       </xsl:call-template>
69     </xsl:if>
70
71     <xsl:if test="name()='flux:form.object'">
72       <xsl:call-template name="transunit">
73         <xsl:with-param name="genid">
74           <xsl:text>flux.</xsl:text><xsl:value-of select="$formid"/>
75           <xsl:text>.objects.</xsl:text><xsl:value-of select="$elemid"/>
76         </xsl:with-param>
77       </xsl:call-template>
78     </xsl:if>
79
80
81   </xsl:template>
82
83   <xsl:template name="transunit">
84     <xsl:param name="genid"/>
85     <trans-unit>
86       <xsl:attribute name="id"><xsl:value-of select="$genid"/></xsl:attribute>
87       <source>FIXME</source>
88     </trans-unit>
89   </xsl:template>
90 </xsl:stylesheet>