From 3ae3b81343a83c34c97d2e5f5e0d46f1f8509b39 Mon Sep 17 00:00:00 2001 From: Peter Bernard West Date: Sun, 30 May 2004 06:33:51 +0000 Subject: [PATCH] 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 --- .../apache/fop/datatypes/LanguageType.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) 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"); + } } -- 2.39.5