libcmml: Internationalisation support in CMML

# Internationalisation support in CMML

CMML is designed to provide full internationalisation (i18n) support, covering different character sets as well as languages and their differing directionality. Any tag or attribute that could end up containing text in a different language to the other tags may specify their own language.

As a CMML file is an XML file by definition, the xml processing instruction provides for a file-specific specification of the encoding format in its "encoding" tag. A potentially differing character set for an INPUT media file will be specified in the "contenttype" attribute of the source tag as a parameter to the MIME type.

Different languages and their directionality for display purposes are given for every tag that contains human-readable text as a value of either an attribute or a tag. They are specified in the lang and dir attributes.

The root cmml tag's "lang" and "dir" attributes provide the default language for the whole CMML file.

The source tag in the stream tag has i18n support as its "title" attribute may contain human readable text.

The head tag has i18n support to provide a default language to its contained tags such as the title and meta tags. Both of them may incidentally overrun the defaults by having a language specification of their own.

The clip tag again contains a default language for the clip itself. The a, img, desc, and meta tags may each override the default language.

Here is an example of a multi-lingual CMML file:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <!DOCTYPE cmml SYSTEM "cmml.dtd">

    <cmml lang="pl">

    <stream basetime="npt:0">
      <import contenttype="video/mpeg" src="fish.mpg" start="npt:0"/>
    </stream>

    <head lang="en" dir="ltr" profile="http://www.annodex.net/profile.tst">
      <title lang="en" dir="ltr" id="fishtitle">Types of fish</title>
      <base id="base" href="http://www.annodex.net/"/>
      <meta name="Producer" content="Joe Ordinary"/>
      <meta name="DC.Author" content="Joe's friend"/>
      <meta id="dc" lang="en" dir="ltr" name="DC.DESCRIPTION"
            content="A composition of fish" scheme="Dublin Core"/>
      <link id="linktest" lang="en" dir="ltr" title="test the link tag"
            class="head.link" href="i18n.css" type="stylesheet"
            rel="stylesheet" rev="dunno" media="screen"/>
    </head>

    <clip lang="de" id="intro" start="npt:0">
      <a href="http://www.blah.au/fish.html">Lesen Sie mehr &#252;ber Fische.</a>
      <desc lang="en">This is the introduction to the film Joe made about fish.</desc>
    </clip>

    <clip lang="en" id="goldfish" start="npt:5:5.9">
      <a class="clip.a" title="there's always more fish"
         href="http://www.blah.au/morefish.anx?id=goldfish">More video clips on goldfish.</a>
      <img class="clip.img" title="sweety" src="http://www.blah.au/goldfish.jpg"/>
      <desc class="clip.desc" title="tanked fish">Joe has a fishtank at home with many colourful fish. The common goldfish is one of them and Joe's favourite. Here are some fabulous pictures he has taken of them.</desc>
      <meta name="Location" content="Joe's fishtank"/>
      <meta name="Subject" content="goldfish"/>
      <meta lang="fr" name="sujet" content="poisson d'or"/>
    </clip>

    </cmml>

The document is generally in Polish (see lang attribute of cmml tag). The lang atttribute of the head tag makes all head tags and attributes be English. The lang attribute of the first clip tag makes all of them be German, though this is overrun by the lang attribute of the desc tag, making that one English. The last clip tag is in English, but it has a meta tag in French.