From: Peter Bernard West Date: Sat, 29 May 2004 19:25:59 +0000 (+0000) Subject: Added ISO 639-1 2-letter language code support. X-Git-Tag: Defoe_export~119 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=533115e15a26564b13f2d90015812109bafd7837;p=xmlgraphics-fop.git Added ISO 639-1 2-letter language code support. Note: there has been a change in the draft Recommendation, such that is now defined as either an ISO 639-2 3-letter code or an ISO 639-1 2-letter code. As RFC 3066, to which xml:lang values are supposed to conform, expresses a preference for ISO 639-1, and Java Locales are built from the 2-letter codes, this was necessary. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197659 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/datatypes/LanguageType.java b/src/java/org/apache/fop/datatypes/LanguageType.java index b95ef7d78..be437794c 100644 --- a/src/java/org/apache/fop/datatypes/LanguageType.java +++ b/src/java/org/apache/fop/datatypes/LanguageType.java @@ -39,6 +39,8 @@ public class LanguageType extends NCName { private static final String tag = "$Name$"; private static final String revision = "$Revision$"; + private String iso639_1Code = null; + public LanguageType(int property, String languageCode) throws PropertyException { @@ -50,6 +52,7 @@ public class LanguageType extends NCName { throw new PropertyException ("Invalid language code: " + languageCode); setString(code); + iso639_1Code = CountryLanguageScript.canonical639_1Code(code); } public LanguageType(String propertyName, String languageCode) @@ -66,10 +69,14 @@ public class LanguageType extends NCName { } /** - * @return the String language code. + * Gets the ISO 639-2T language code + * @return the code. */ public String getLanguage() { return string; } + public String getISO639_1Language() { + return iso639_1Code; + } }