Language tag analyzer

Hi all,

as a potential application of the language information data category I have
written a language tag analyzer, see
http://www.w3.org/2008/05/lta/
and an example of an erroneous language tag
http://www.w3.org/2008/05/lta/language-tags/q?input=en-cmn-1901-a-sdfds-a-sds
this is implemented in XSLT, but I am working on a Java implementation, see
attachment. Currently it checks the syntax of language tags, but not against
the subtag registry. You can evoke it e.g. by
public static void main(String[] args) {
    LangTag lt =
        new LangTag(args[0], false); // a language tag (args[0] is created
and analysed. Validation is not here yet, so set to false.
    for (int i = 0; i < lt.getSubtagNum(); i++) { // iterating through all
subtags
        System.out.println(lt.getSubtag(i).subtag + " is of type " +
lt.getSubtag(i).type); // getting the type of the subtag
    }
}
    System.out.println("Wellformed language tag: " + lt.wellformed); // a
flag for checking if the syntax of the language tag is OK.

Maybe that's something to integrate in Yves's java implementation.

Best,

Felix

Received on Tuesday, 24 March 2009 17:35:06 UTC