multilingual.xml 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: ps
  5. (C) Copyright IBM Corp. 2005, 2011
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <!--
  9. Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  10. Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  11. -->
  12. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" exclude-result-prefixes="bus cm">
  13. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  14. <xsl:template match="root">
  15. <!--
  16. Create currently available content_locale entries in the /root/multiLangs/lang structure used in properties_general.xts.
  17. -->
  18. <xts:sequence>
  19. <xts:append>
  20. <multiLangs>
  21. <xsl:variable name="mynodeset" select="/root/cm:queryResponse/*/cm:name/*|/root/cm:queryResponse/*/cm:screenTip/*|/root/cm:queryResponse/*/cm:description/*"/>
  22. <!-- get a list of the locales that have been defined in cm or is currently being added to the list-->
  23. <xsl:variable name="locales">
  24. <xsl:choose>
  25. <xsl:when test="not(/root/env/param[@name='pty_activeLang'])">
  26. <xsl:for-each select="$mynodeset">
  27. <xsl:variable name="locid" select="@xml:lang"/>
  28. <xsl:if test="not(preceding-sibling::*[@xml:lang = $locid])">
  29. <name locale="{@xml:lang}" displayName="{/root/config/param[@name='locale']/locale[@type='contentLocale' and id=$locid]/displayName}"><xsl:value-of select="@xml:lang"/></name>
  30. </xsl:if>
  31. </xsl:for-each>
  32. </xsl:when>
  33. <xsl:otherwise>
  34. <xsl:for-each select="/root/env/param[starts-with(@name, 'm_t_default_screenTip_')] | /root/env/param[starts-with(@name, 'm_t_default_description_')] | /root/env/param[starts-with(@name, 'm_t_default_name_')]">
  35. <xsl:variable name="locid">
  36. <xsl:choose>
  37. <xsl:when test="starts-with(@name, 'm_t_default_screenTip_')"><xsl:value-of select="substring-after(@name,'m_t_default_screenTip_')"/></xsl:when>
  38. <xsl:when test="starts-with(@name, 'm_t_default_description_')"><xsl:value-of select="substring-after(@name,'m_t_default_description_')"/></xsl:when>
  39. <xsl:when test="starts-with(@name, 'm_t_default_name_')"><xsl:value-of select="substring-after(@name,'m_t_default_name_')"/></xsl:when>
  40. </xsl:choose>
  41. </xsl:variable>
  42. <xsl:if test="not(preceding-sibling::*[@xml:lang = $locid])">
  43. <name locale="{$locid}" displayName="{/root/config/param[@name='locale']/locale[@type='contentLocale' and id=$locid]/displayName}"><xsl:value-of select="$locid"/></name>
  44. </xsl:if>
  45. </xsl:for-each>
  46. <xsl:if test="string(/root/env/param[@name='pty_activeLang']) != ''">
  47. <xsl:variable name="locid" select="/root/env/param[@name='pty_activeLang']"/>
  48. <name locale="{$locid}" displayName="{/root/config/param[@name='locale']/locale[@type='contentLocale' and id=$locid]/displayName}"><xsl:value-of select="$locid"/></name>
  49. </xsl:if>
  50. </xsl:otherwise>
  51. </xsl:choose>
  52. </xsl:variable>
  53. <xsl:for-each select="$locales/name">
  54. <xsl:sort select="@displayName"/>
  55. <xsl:copy-of select="."/>
  56. </xsl:for-each>
  57. </multiLangs>
  58. </xts:append>
  59. <xts:append select="/root/multiLangs">
  60. <useLangAsDefault>
  61. <xts:function name="getLocalizedName">
  62. <xts:param name="locale"><xts:queryValue select="/root/user/param[@name='contentLocale']"/></xts:param>
  63. <xts:param name="namelist"><xts:queryNode select="/root/multiLangs/name"/></xts:param>
  64. <xts:param name="default">NOMATCH</xts:param>
  65. <xts:param name="normalize">true</xts:param>
  66. </xts:function>
  67. </useLangAsDefault>
  68. </xts:append>
  69. </xts:sequence>
  70. </xsl:template>
  71. </xsl:stylesheet>