W3C home > Mailing lists > Public > public-i18n-its-ig@w3.org > March 2009

Language tag analyzer

From: Felix Sasaki <felix.sasaki@fh-potsdam.de>
Date: Wed, 25 Mar 2009 02:34:25 +0900
Message-ID: <ba4134970903241034h7978bf05u29e322c2a58194d1@mail.gmail.com>
To: public-i18n-its-ig@w3.org
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 2 June 2009 18:33:00 GMT