Localization of the word "table" or "figure"

Issue

User is trying to output in a non-English output from DITA and wants to make the labels for the tables or figures to have the native language instead of saying "Table" or "Figure"

Solution

This requires a modification of the default.wwconfig file located by default in the ..\Adapters\xml\scripts\dita directory. You will locate the following:

<!-- Number examples -->
    <!--                 -->
    <xsl:if test="contains(parent::*/@class, ' topic/example ')">
     <xsl:variable name="VarExamplePosition" select="count(preceding::*[contains(@class,' topic/example ')]/*[contains(@class,' topic/title ')]) + 1"/>

     <wwdoc:Number value="{$VarExamplePosition}">
      <wwdoc:Style>
       <wwdoc:Attribute name="list-style-type" value="decimal" />
       <wwdoc:Attribute name="wwdoc-list-level" value="{$VarExamplePosition}" />
      </wwdoc:Style>

      <wwdoc:Text value="Example {$VarExamplePosition}. " />
     </wwdoc:Number>
    </xsl:if>
   </wwditaconfig:Head>
  </Style>

  <Style match="//*[contains(@class, ' topic/title ') and contains(parent::*/@class, ' topic/fig ')]">
   <xsl:variable name="VarName">
    <xsl:choose>
     <xsl:when test="string-length(@outputclass) &gt; 0">
      <xsl:value-of select="@outputclass" />
     </xsl:when>

     <xsl:otherwise>
      <xsl:text>Figure Title</xsl:text>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:variable>

   <wwditaconfig:Head name="{$VarName}">
    <!-- Number figures -->
    <!--                -->
    <xsl:variable name="VarFigurePosition" select="count(preceding::*[contains(@class,' topic/fig ')]/*[contains(@class,' topic/title ')]) + 1"/>

    <wwdoc:Number value="{$VarFigurePosition}">
     <wwdoc:Style>
      <wwdoc:Attribute name="list-style-type" value="decimal" />
      <wwdoc:Attribute name="wwdoc-list-level" value="{$VarFigurePosition}" />
     </wwdoc:Style>

     <wwdoc:Text value="Figure {$VarFigurePosition}. " />
    </wwdoc:Number>
   </wwditaconfig:Head>
  </Style>

  <Style match="//*[contains(@class, ' topic/title ') and contains(parent::*/@class, ' topic/table ')]">
   <xsl:variable name="VarName">
    <xsl:choose>
     <xsl:when test="string-length(@outputclass) &gt; 0">
      <xsl:value-of select="@outputclass" />
     </xsl:when>

     <xsl:otherwise>
      <xsl:text>Table Title</xsl:text>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:variable>

   <wwditaconfig:Head name="{$VarName}">
    <!-- Number tables -->
    <!--               -->
    <xsl:variable name="VarTablePosition" select="count(preceding::*[contains(@class,' topic/table ')]/*[contains(@class,' topic/title ')]) + 1"/>

    <wwdoc:Number value="{$VarTablePosition}">
     <wwdoc:Style>
      <wwdoc:Attribute name="list-style-type" value="decimal" />
      <wwdoc:Attribute name="wwdoc-list-level" value="{$VarTablePosition}" />
     </wwdoc:Style>

     <wwdoc:Text value="Table {$VarTablePosition}. " />
    </wwdoc:Number>
   </wwditaconfig:Head>
  </Style>

Where you see the code

<wwdoc:Text value="

You will change what is in quotations language of your choice for "example", "figure" or "table". Note: if you are using a Unicode language, you will have to use a text editor that supports this encoding.

Permalinks/Solutions/Input/DITA/FigureLocalization (last edited 2010-04-20 19:46:42 by LaurenLever)