Examples and descriptions

Hi everyone,

I had the two action items:

http://www.w3.org/2006/07/21-i18nits-minutes.html#action04
(Fixing Example 22 and 23)

http://www.w3.org/2006/07/21-i18nits-minutes.html#action05
(Writing example descriptions)


The result is below. I've used locNote not locInfo as decided.
I've attached a zip file with the source of each example and its XLIFF extraction to check the rules (and my filter) were working as
expected. I plundered Richard's article, as encouraged.




Example 22: The locNote element

The locNoteRule element associates the content of locNote with the message with the identifier 'DisableInfo' and flags it as
important. This would also work if the rule was in an external file, allowing to provide notes without modifying the source
document.

<myRes>
 <head>
  <its:rules xmlns:its="http://www.w3.org/2005/11/its" its:version="1.0" its:translate="no">
   <its:locNoteRule locNoteType="alert" selector="//msg[@id='DisableInfo']">
    <its:locNote>The variable {0} has three possible values: 'printer', 'stacker' and 'stapler options'.</its:locNote>
   </its:locNoteRule>
  </its:rules>
 </head>
 <body>
  <msg id="DisableInfo">The {0} has been disabled.</msg>
 </body>
</myRes>



Example 23:  The locNoteRef attribute

The locNoteRule element specifies that the message with the identifier 'NotFound' has a corresponding explanation note in an
external file. The URI for the extact location of the note is stored in the locNoteRef attribute.

<myRes>
 <head>
  <its:rules xmlns:its="http://www.w3.org/2005/11/its" its:version="1.0">
   <its:locNoteRule locNoteType="description"
    selector="//msg[@id='NotFound']"
    locNoteRef="ErrorsInfo.html/#NotFound" />
  </its:rules>
 </head>
 <body>
  <msg id="NotFound">Cannot find {0} on {1}.</msg>
 </body>
</myRes>



Example 24:

The locNoteRule element specifies that each data element in a msg element has a corresponding descriptive localization note in a
sibling element called notes. The translateRule element indicates that notes elements are not to be translated.

<Res>
 <prolog>
  <its:rules xmlns:its="http://www.w3.org/2005/11/its" its:version="1.0">
   <its:translateRule selector="//notes" translate="no"/>
   <its:locNoteRule locNoteType="description"
     selector="//msg/data"
     locNotePointer="../notes"/>
  </its:rules>
 </prolog>
 <body>
  <msg id="FileNotFound">
   <notes>The resource file {0} could not be loaded.</notes>
   <data>Cannot find the file {0}.</data>
  </msg>
  <msg id="DivByZero">
   <notes>Indicates a division by zero.</notes>
   <data>Invalid parameter.</data>
  </msg>
 </body>
</Res>



Example 25: The locNoteRefPointer attribute

The locNoteRule element specifies that the parent of each data element has an attribute noteFile that contains the URI of a
descriptive localization note for the content of data.

<data>
 <prolog>
  <its:rules xmlns:its="http://www.w3.org/2005/11/its" its:version="1.0">
   <its:locNoteRule locNoteType="description"
     selector="//data"
     locNoteRefPointer="../@noteFile"/>
  </its:rules>
 </prolog>
 <body>
  <string id="FileNotFound" noteFile="Comments.html/#FileNotFound">
   <data>Cannot find the file {0}.</data>
  </string>
  <string id="DivByZero" noteFile="Comments.html/#DivByZero">
   <data>Invalid parameter.</data>
  </string>
 </body>
</data>



Example 26: Localization information expressed locally in a document

The locNote attributes hold localization notes for their respective msg elements. The locNoteType attribute is optional locally. In
its absence the default value 'description' is assumed.

<messages xmlns:its="http://www.w3.org/2005/11/its" its:version="1.0">
 <msg id="ERR_CONTEXTINFO"
  its:locNote="Usage: [Error message] near '[token]' at line [Line#]"
 >%s near '%s' at line %d</msg>
 <msg id="STR_MASSRESULT"
  its:locNote="'mcg' = microgram (one millionth of a gram)"
 >Mass = %d mcg</msg>
</messages>

Received on Monday, 24 July 2006 21:34:29 UTC