[Yanel-commits] rev 37959 - in public/yanel/trunk/src/realms/from-scratch-realm-template: data-repo/data/app/xslt res-configs res-configs/navigation

michi at wyona.com michi at wyona.com
Wed Aug 13 17:13:29 CEST 2008


Author: michi
Date: 2008-08-13 17:13:28 +0200 (Wed, 13 Aug 2008)
New Revision: 37959

Added:
   public/yanel/trunk/src/realms/from-scratch-realm-template/data-repo/data/app/xslt/translations.xsl
   public/yanel/trunk/src/realms/from-scratch-realm-template/res-configs/navigation/
   public/yanel/trunk/src/realms/from-scratch-realm-template/res-configs/navigation/translations.xml.yanel-rc
Log:
translations framework added

Added: public/yanel/trunk/src/realms/from-scratch-realm-template/data-repo/data/app/xslt/translations.xsl
===================================================================
--- public/yanel/trunk/src/realms/from-scratch-realm-template/data-repo/data/app/xslt/translations.xsl	                        (rev 0)
+++ public/yanel/trunk/src/realms/from-scratch-realm-template/data-repo/data/app/xslt/translations.xsl	2008-08-13 15:13:28 UTC (rev 37959)
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet version="1.0" 
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns="http://www.w3.org/1999/xhtml"
+  xmlns:xhtml="http://www.w3.org/1999/xhtml"
+  xmlns:yanel="http://www.wyona.org/yanel/1.0"
+  exclude-result-prefixes="xhtml">
+  
+  <xsl:param name="yanel.path.name" select="'NAME_IS_NULL'"/>
+  <xsl:param name="yanel.path" select="'PATH_IS_NULL'"/>
+  <xsl:param name="yanel.back2context" select="'BACK2CONTEXT_IS_NULL'"/>
+  <xsl:param name="yarep.back2realm" select="'BACK2REALM_IS_NULL'"/>
+  <xsl:variable name="name-without-suffix" select="substring-before($yanel.path.name, '.')"/>
+  <xsl:param name="language" select="'LANGUAGE_IS_NULL'"/>
+  <xsl:param name="languages" select="'LANGUAGES_IS_NULL'"/>
+  <xsl:param name="currentPath" select="'CURRENTPATH_IS_NULL'"/>
+
+  <xsl:template match="yanel:translations">
+    <span id="translations" class="language_choice">
+      <xsl:if test="count(yanel:translation[@exists='true']) > 1">
+        <xsl:apply-templates select="yanel:translation[@exists='true']"/>
+      </xsl:if>
+    </span>
+  </xsl:template>
+
+  <xsl:template match="yanel:translation">
+    <xsl:choose>
+      <xsl:when test="@current='true'">
+        <span><xsl:call-template name="label"/></span>
+      </xsl:when>
+      <xsl:otherwise>
+        <span><a href="{$yarep.back2realm}{substring-after(@path, '/')}"><xsl:call-template name="label"/></a></span>
+      </xsl:otherwise>
+    </xsl:choose>
+<!--
+    <xsl:if test="position() != last()">
+      <xsl:text> | </xsl:text>
+    </xsl:if>
+-->
+  </xsl:template>
+  
+  <!-- Maybe one should just use English, Deutsch ... -->
+  <xsl:template name="label">
+    <xsl:choose>
+      <xsl:when test="@language = 'de'">
+        Deutsch
+      </xsl:when>
+      <xsl:when test="@language = 'en'">
+        English
+      </xsl:when>
+<!--
+      <xsl:when test="@language = 'de' and @current = 'true'">
+        Deutsch
+      </xsl:when>
+      <xsl:when test="@language = 'de' and not(@current)">
+        German
+      </xsl:when>
+      <xsl:when test="@language = 'en' and @current = 'true'">
+        English
+      </xsl:when>
+      <xsl:when test="@language = 'en' and not(@current)">
+        Englisch
+      </xsl:when>
+-->
+      <xsl:otherwise>
+    <xsl:value-of select="translate(@language, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+</xsl:stylesheet>

Added: public/yanel/trunk/src/realms/from-scratch-realm-template/res-configs/navigation/translations.xml.yanel-rc
===================================================================
--- public/yanel/trunk/src/realms/from-scratch-realm-template/res-configs/navigation/translations.xml.yanel-rc	                        (rev 0)
+++ public/yanel/trunk/src/realms/from-scratch-realm-template/res-configs/navigation/translations.xml.yanel-rc	2008-08-13 15:13:28 UTC (rev 37959)
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+
+<yanel:resource-config xmlns:yanel="http://www.wyona.org/yanel/rti/1.0">
+  <yanel:rti name="translation" namespace="http://www.wyona.org/yanel/resource/1.0"/>
+
+  <yanel:property name="mime-type" value="application/xhtml+xml"/>
+  <yanel:property name="xslt" value="/app/xslt/translations.xsl"/>
+  
+</yanel:resource-config>



More information about the Yanel-commits mailing list