From: Peter Bernard West Date: Sun, 30 May 2004 06:33:51 +0000 (+0000) Subject: Added getISO639_1Language(PropertyValue) X-Git-Tag: Defoe_export~109 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3ae3b81343a83c34c97d2e5f5e0d46f1f8509b39;p=xmlgraphics-fop.git Added getISO639_1Language(PropertyValue) and getLanguage(PropertyValue) git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197670 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 be437794c..812627982 100644 --- a/src/java/org/apache/fop/datatypes/LanguageType.java +++ b/src/java/org/apache/fop/datatypes/LanguageType.java @@ -76,7 +76,41 @@ public class LanguageType extends NCName { return string; } + /** + * Gets the ISO 639-2T language code from a PropertyValue + * @param pv + * @return the language code + * @exception PropertyException if the PropertyValue is not + * a LanguageType + */ + public static String getLanguage(PropertyValue pv) + throws PropertyException { + if (pv.getType() == PropertyValue.LANGUAGE) { + return ((LanguageType)pv).getLanguage(); + } + throw new PropertyException("PropertyValue not an LANGUAGE type"); + } + + /** + * Gets the ISO 639-1 language code + * @return the language code + */ public String getISO639_1Language() { return iso639_1Code; } + + /** + * Gets the ISO 639-1 language code from a PropertyValue + * @param pv + * @return the language code + * @exception PropertyException if the PropertyValue is not + * a LanguageType + */ + public static String getISO639_1Language(PropertyValue pv) + throws PropertyException { + if (pv.getType() == PropertyValue.LANGUAGE) { + return ((LanguageType)pv).getISO639_1Language(); + } + throw new PropertyException("PropertyValue not an LANGUAGE type"); + } }