summaryrefslogtreecommitdiff
path: root/doc/yelp-xsl/C/l10n.format.mode.page
blob: 945821e2994741024cf122be7abd19b49cb59f2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" xmlns:xsl="FIXME" style="xslt-mode" id="l10n.format.mode">
 <info>
  <link type="guide" xref="l10n" group="modes"/>
  <link type="guide" xref="modes" group="l10n"/>
  <desc>Process format strings from <code xref="l10n.gettext">l10n.gettext</code>.</desc>
  <revision version="3.18" date="2015-08-13" status="final"/>
 </info>
 <title>l10n.format.mode</title>
 <synopsis>
  <title>Parameters</title>
  <terms>
   <item>
    <title><code>$node</code></title>
    <p>The node being processed in the original document.</p>
   </item>
   <item>
    <title><code>$string</code></title>
    <p>String content to use for certain message format nodes.</p>
   </item>
  </terms>
 </synopsis>
 <p>This mode is called by <code xref="l10n.gettext">l10n.gettext</code> when its <sys>format</sys> parameter is set to
 true. It is applied to the elements and text children of the translated message
 that <code xref="l10n.gettext">l10n.gettext</code> finds. This allows you to insert content in format strings,
 rather than concatenating multiple translations to create a translated message.</p>
 <p>By default, this stylesheet provides matching templates in this mode for the
 elements <sys>node</sys> and <sys>string</sys>. The template for <sys>node</sys> applies templates with
 no mode to the <code>$node</code> parameter passed to <code xref="l10n.gettext">l10n.gettext</code>. The template for
 <sys>string</sys> copies the text in the <code>$string</code> parameter passed to <code xref="l10n.gettext">l10n.gettext</code>.
 Both parameters are passed to templates in this mode. Templates matching this
 mode should pass those parameters to child content if they process child
 content in <code xref="l10n.format.mode">l10n.format.mode</code>.</p>
 <p>To use format strings in your own translations, use elements with names of
 your choosing in your message. You can use the <sys>node</sys> and <sys>string</sys> elements
 without further implementation, if they fit your needs. Otherwise, take care
 to use element names that are unlikely to conflict with other templates using
 this mode.</p>
</page>