OASIS XML Localisation Interchange File Format (XLIFF) TC

 View Only

Re: [xliff] Localization Directives...

  • 1.  Re: [xliff] Localization Directives...

    Posted 10-21-2002 22:11
    At Mon, 21 Oct 2002 11:59:00 +0100, Enda McDonnell wrote: > > We are due to discuss these issues at an xliff meeting tomorrow, where we > can use this input. An outline of how you provide for this at GlobalSight > with some samples would be very useful for this discussion, if it is > possible. I don't know how much I can disclose the information, but I can talk about an outline. When you import an XML file into the system, you can specify a XML rule file to use for the import. The rule file describes which elements and attributes are to be translated. If no rule file is specified, a default rule is applied. The default rule is that all element contents are translatable and all attribute values are not. A rule file itself is an XML document. Basically, a rule file consists of <translate> and <dont-translate> elements. Both elements have a path attribute which selects a certain part of the document by XPath expression. Obviously <translate> selects translatable element or attribute and <dont-translate> selects non-translatable parts. And these rules are applied on top of the default rule. So you don't need to write <dont-translate> rule for attribute, which is non-translatable by default. <translate> optionally has a inline attribute. If the value of the attribute is yes, the selected element by the path attribute is treated as inline element. An inline element is an element that is included in the other element. The parser doesn't break the segment at the element so the translation can be done on a whole segmented unit (sentence, paragraph, etc). Examples of inline element are <b> or <i> elements of XHTML. There are some other elements and attributes in the rule file, but these are not essential for the discussion. Example: Source XML: <foo> <bar> <baz>This is <bold>translatable</bold> text.</baz> </bar> <baz>This is not translatable.</baz> </foo> Rule file: <rule> <dont-translate path="/foo/baz" /> <translate path="//bold" inline="yes" /> </rule> If the rule file is applied to the source xml, "This is <bold>translatable</bold> text." is parsed as translatable as a whole. "This is not translatable." is parsed as non-translatable. A rule file for a sample xml file in your Attribute.html can be written as below. <rule> <!-- select all elements as non-translatable --> <dont-translate path="//*" /> <translate path="/window/menubar/menu/menupopup/menuitem/@value" /> <translate path="/window/menubar/menu/menupopup/menuitem[@value!='Redo']/@accesskey" /> </rule> ------------------- Shigemichi Yazawa yazawa@globalsight.com