[jsword-svn] r1156 - in trunk: bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop common/src/main/java/org/crosswire/common/xml jsword/src/main/java/org/crosswire/jsword/book jsword/src/main/java/org/crosswire/jsword/book/filter/thml jsword/src/main/java/org/crosswire/jsword/book/sword jsword/src/main/java/org/crosswire/jsword/util jsword/src/main/java/org/crosswire/jsword/versification jsword/src/test/java

dmsmith at www.crosswire.org dmsmith at www.crosswire.org
Wed Oct 11 05:40:36 MST 2006


Author: dmsmith
Date: 2006-10-11 05:40:09 -0700 (Wed, 11 Oct 2006)
New Revision: 1156

Added:
   trunk/jsword/src/main/java/org/crosswire/jsword/util/OSType.java
   trunk/jsword/src/main/java/org/crosswire/jsword/versification/package.html
Modified:
   trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java
   trunk/common/src/main/java/org/crosswire/common/xml/XMLFeatureSet.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/CaseType.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/SentenceUtil.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/CustomHandler.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ConfigEntryType.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookMetaData.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordDailyDevotion.java
   trunk/jsword/src/main/java/org/crosswire/jsword/util/Project.java
   trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleNames.java
   trunk/jsword/src/main/java/org/crosswire/jsword/versification/OSISNames.java
   trunk/jsword/src/main/java/org/crosswire/jsword/versification/SectionNames.java
   trunk/jsword/src/test/java/Bench.java
Log:
Fixing i18n problems

Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java	2006-10-10 23:34:40 UTC (rev 1155)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java	2006-10-11 12:40:09 UTC (rev 1156)
@@ -42,6 +42,7 @@
 import javax.swing.ButtonGroup;
 import javax.swing.ImageIcon;
 import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JComponent;
 import javax.swing.JFrame;
 import javax.swing.JMenu;
 import javax.swing.JMenuBar;
@@ -497,8 +498,11 @@
     public void establishPreferredSize()
     {
         Container contentPane = getContentPane();
-        contentPane.setPreferredSize(contentPane.getSize());
-        log.warn("The size of the contentpane is: " + contentPane.getSize()); //$NON-NLS-1$
+        if (contentPane instanceof JComponent)
+        {
+            ((JComponent) contentPane).setPreferredSize(contentPane.getSize());
+            log.warn("The size of the contentpane is: " + contentPane.getSize()); //$NON-NLS-1$
+        }
     }
 
     /**

Modified: trunk/common/src/main/java/org/crosswire/common/xml/XMLFeatureSet.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/xml/XMLFeatureSet.java	2006-10-10 23:34:40 UTC (rev 1155)
+++ trunk/common/src/main/java/org/crosswire/common/xml/XMLFeatureSet.java	2006-10-11 12:40:09 UTC (rev 1156)
@@ -43,6 +43,7 @@
 package org.crosswire.common.xml;
 
 import java.util.Iterator;
+import java.util.Locale;
 import java.util.Map;
 import java.util.TreeMap;
 import java.util.Map.Entry;
@@ -97,7 +98,7 @@
             if (arg.startsWith("-")) //$NON-NLS-1$
             {
                 String option = arg.substring(1);
-                String key = option.toLowerCase();
+                String key = option.toLowerCase(Locale.ENGLISH);
                 XMLFeatureState feature = (XMLFeatureState) features.get(key);
                 if (feature != null)
                 {

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/CaseType.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/CaseType.java	2006-10-10 23:34:40 UTC (rev 1155)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/CaseType.java	2006-10-11 12:40:09 UTC (rev 1156)
@@ -22,6 +22,7 @@
 package org.crosswire.jsword.book;
 
 import java.io.Serializable;
+import java.util.Locale;
 
 /**
  * Types of Sentence Case.
@@ -37,7 +38,7 @@
     {
         public String setCase(String word)
         {
-            return word.toLowerCase();
+            return word.toLowerCase(Locale.getDefault());
         }
 
         /**
@@ -87,7 +88,7 @@
     {
         public String setCase(String word)
         {
-            return word.toUpperCase();
+            return word.toUpperCase(Locale.getDefault());
         }
 
         /**
@@ -120,7 +121,7 @@
             return ""; //$NON-NLS-1$
         }
 
-        return Character.toUpperCase(word.charAt(0)) + word.substring(1).toLowerCase();
+        return Character.toUpperCase(word.charAt(0)) + word.substring(1).toLowerCase(Locale.getDefault());
     }
 
     /**
@@ -147,14 +148,14 @@
         }
 
         // Lower case?
-        if (word.equals(word.toLowerCase()))
+        if (word.equals(word.toLowerCase(Locale.getDefault())))
         {
             return LOWER;
         }
 
         // Upper case?
         // A string length of 1 is no good ('I' or 'A' is sentence case)
-        if (word.equals(word.toUpperCase()) && word.length() != 1)
+        if (word.equals(word.toUpperCase(Locale.getDefault())) && word.length() != 1)
         {
             return UPPER;
         }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/SentenceUtil.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/SentenceUtil.java	2006-10-10 23:34:40 UTC (rev 1155)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/SentenceUtil.java	2006-10-11 12:40:09 UTC (rev 1156)
@@ -24,6 +24,7 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 
 import org.crosswire.common.util.StringUtil;
 
@@ -212,7 +213,7 @@
         // Remove the punctuation from the ends of the words.
         for (int i = 0; i < words.length; i++)
         {
-            retcode[i] = stripPunctuationWord(words[i]).toLowerCase();
+            retcode[i] = stripPunctuationWord(words[i]).toLowerCase(Locale.ENGLISH);
         }
 
         return retcode;

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/CustomHandler.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/CustomHandler.java	2006-10-10 23:34:40 UTC (rev 1155)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/CustomHandler.java	2006-10-11 12:40:09 UTC (rev 1156)
@@ -23,6 +23,7 @@
 
 import java.util.HashMap;
 import java.util.LinkedList;
+import java.util.Locale;
 import java.util.Map;
 
 import org.crosswire.common.util.Logger;
@@ -153,7 +154,7 @@
         // look out for them
         if (t == null)
         {
-            t = (Tag) TAG_MAP.get(qname.toLowerCase());
+            t = (Tag) TAG_MAP.get(qname.toLowerCase(Locale.ENGLISH));
 
             if (t == null)
             {

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ConfigEntryType.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ConfigEntryType.java	2006-10-10 23:34:40 UTC (rev 1155)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ConfigEntryType.java	2006-10-11 12:40:09 UTC (rev 1156)
@@ -24,6 +24,7 @@
 import java.io.Serializable;
 import java.util.Arrays;
 import java.util.HashSet;
+import java.util.Locale;
 import java.util.Set;
 import java.util.regex.Pattern;
 
@@ -163,7 +164,7 @@
          */
         public String filter(String value)
         {
-            return value.toUpperCase();
+            return value.toUpperCase(Locale.ENGLISH);
         }
 
         /* (non-Javadoc)
@@ -274,7 +275,7 @@
          */
         public String filter(String value)
         {
-            return value.toUpperCase();
+            return value.toUpperCase(Locale.ENGLISH);
         }
 
         /* (non-Javadoc)

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookMetaData.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookMetaData.java	2006-10-10 23:34:40 UTC (rev 1155)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookMetaData.java	2006-10-11 12:40:09 UTC (rev 1156)
@@ -28,6 +28,7 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 
 import org.crosswire.common.util.NetUtil;
@@ -187,7 +188,7 @@
      */
     public String getConfPath()
     {
-        return SwordConstants.DIR_CONF + '/' + getInitials().toLowerCase() + SwordConstants.EXTENSION_CONF;
+        return SwordConstants.DIR_CONF + '/' + getInitials().toLowerCase(Locale.ENGLISH) + SwordConstants.EXTENSION_CONF;
     }
 
     /**

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordDailyDevotion.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordDailyDevotion.java	2006-10-10 23:34:40 UTC (rev 1155)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordDailyDevotion.java	2006-10-11 12:40:09 UTC (rev 1156)
@@ -20,7 +20,6 @@
 package org.crosswire.jsword.book.sword;
 
 import java.text.DateFormat;
-import java.text.SimpleDateFormat;
 import java.util.Date;
 
 import org.crosswire.jsword.book.sword.RawLDBackend.IndexKey;
@@ -54,7 +53,7 @@
     }
 
     /**
-     * Date formatter
+     * Date formatter, fully internationalized.
      */
-    private static final DateFormat NAME_DF = new SimpleDateFormat("d MMMM"); //$NON-NLS-1$
+    private static final DateFormat NAME_DF = DateFormat.getDateInstance(DateFormat.MEDIUM);
 }

Added: trunk/jsword/src/main/java/org/crosswire/jsword/util/OSType.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/util/OSType.java	2006-10-10 23:34:40 UTC (rev 1155)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/util/OSType.java	2006-10-11 12:40:09 UTC (rev 1156)
@@ -0,0 +1,289 @@
+/**
+ * Distribution License:
+ * JSword is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License, version 2.1 as published by
+ * the Free Software Foundation. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The License is available on the internet at:
+ *       http://www.gnu.org/copyleft/lgpl.html
+ * or by writing to:
+ *      Free Software Foundation, Inc.
+ *      59 Temple Place - Suite 330
+ *      Boston, MA 02111-1307, USA
+ *
+ * Copyright: 2005
+ *     The copyright to this program is held by it's authors.
+ *
+ * ID: $Id: CaseType.java 1068 2006-04-08 02:20:41Z dmsmith $
+ */
+package org.crosswire.jsword.util;
+
+import java.io.Serializable;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.crosswire.common.util.Logger;
+import org.crosswire.common.util.NetUtil;
+
+/**
+ * Types of Operating Systems for which specialized behavior is needed.
+ * 
+ * @see gnu.lgpl.License for license details.
+ *      The copyright to this program is held by it's authors.
+ * @author DM Smith [dmsmith555 at yahoo dot com]
+ */
+public abstract class OSType implements Serializable
+{
+    public static final OSType MAC = new OSType("Mac OS X") //$NON-NLS-1$
+    {
+        /* (non-Javadoc)
+         * @see org.crosswire.jsword.util.OSType#getUserArea()
+         */
+        public URL getUserArea()
+        {
+            if (userArea == null)
+            {
+                userArea = NetUtil.lengthenURL(getUserHome(), MAC_USER_DATA_AREA);
+            }
+            return userArea;
+        }
+
+        /* (non-Javadoc)
+         * @see org.crosswire.jsword.util.OSType#getUserAreaFolder(java.lang.String, java.lang.String)
+         */
+        public URL getUserAreaFolder(String hiddenFolderName, String visibleFolderName)
+        {
+            return NetUtil.lengthenURL(getUserArea(), visibleFolderName);
+        }
+
+        /**
+         * Serialization ID
+         */
+        private static final long serialVersionUID = -1575982665011980783L;
+    };
+
+    public static final OSType WIN32 = new OSType("Windows") //$NON-NLS-1$
+    {
+        /* (non-Javadoc)
+         * @see org.crosswire.jsword.util.OSType#getUserArea()
+         */
+        public URL getUserArea()
+        {
+            if (userArea == null)
+            {
+                userArea = NetUtil.lengthenURL(userHome, WIN32_USER_DATA_AREA);
+            }
+            return userArea;
+        }
+
+        /* (non-Javadoc)
+         * @see org.crosswire.jsword.util.OSType#getUserAreaFolder(java.lang.String, java.lang.String)
+         */
+        public URL getUserAreaFolder(String hiddenFolderName, String visibleFolderName)
+        {
+            return NetUtil.lengthenURL(getUserArea(), visibleFolderName);
+        }
+
+        /**
+         * Serialization ID
+         */
+        private static final long serialVersionUID = 2448098399487879399L;
+    };
+
+    public static final OSType DEFAULT = new OSType("*nix") //$NON-NLS-1$
+    {
+        /* (non-Javadoc)
+         * @see org.crosswire.jsword.util.OSType#getUserArea()
+         */
+        public URL getUserArea()
+        {
+            return userHome;
+        }
+
+        /* (non-Javadoc)
+         * @see org.crosswire.jsword.util.OSType#getUserAreaFolder(java.lang.String, java.lang.String)
+         */
+        public URL getUserAreaFolder(String hiddenFolderName, String visibleFolderName)
+        {
+            return NetUtil.lengthenURL(getUserArea(), hiddenFolderName);
+        }
+
+        /**
+         * Serialization ID
+         */
+        private static final long serialVersionUID = 8260119208395182688L;
+     };
+
+    /**
+     * Simple ctor
+     */
+    public OSType(String name)
+    {
+        this.name = name;
+    }
+
+    /**
+     * Get the user area for this OSType.
+     * @return the user area
+     */
+    public abstract URL getUserArea();
+
+    /**
+     * A folder in the user area. This osType will determine which to use in constructing
+     * the URL to the folder.
+     * 
+     * @param hiddenFolderName is typically a "unix" hidden folder name such as .jsword.
+     * @param visibleFolderName is an visible folder name, such as JSword.
+     * 
+     * @return the user area folder
+     */
+    public abstract URL getUserAreaFolder(String hiddenFolderName, String visibleFolderName);
+
+    public static URL getUserHome()
+    {
+        if (userHome == null)
+        {
+            try
+            {
+                userHome = new URL(NetUtil.PROTOCOL_FILE, null, System.getProperty("user.home")); //$NON-NLS-1$
+            }
+            catch (MalformedURLException e)
+            {
+                log.fatal("Failed to find user's home folder", e); //$NON-NLS-1$
+                assert false : e;
+            }
+        }
+        return userHome;
+    }
+
+    /**
+     * Get an integer representation for this CaseType
+     */
+    public int toInteger()
+    {
+        for (int i = 0; i < VALUES.length; i++)
+        {
+            if (equals(VALUES[i]))
+            {
+                return i;
+            }
+        }
+        // cannot get here
+        assert false;
+        return -1;
+    }
+
+    /**
+     * Get the machine's OSType.
+     * 
+     * @return the machine's OSType
+     */
+    public static OSType getOSType()
+    {
+        return osType;
+    }
+
+    /**
+     * Lookup method to convert from a String
+     */
+    public static OSType fromString(String name)
+    {
+        for (int i = 0; i < VALUES.length; i++)
+        {
+            OSType o = VALUES[i];
+            if (o.name.startsWith(name))
+            {
+                return o;
+            }
+        }
+        return DEFAULT;
+    }
+
+    /**
+     * Lookup method to convert from an integer
+     */
+    public static OSType fromInteger(int i)
+    {
+        return VALUES[i];
+    }
+
+    /**
+     * Prevent subclasses from overriding canonical identity based Object methods
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    public final boolean equals(Object o)
+    {
+        return super.equals(o);
+    }
+
+    /**
+     * Prevent subclasses from overriding canonical identity based Object methods
+     * @see java.lang.Object#hashCode()
+     */
+    public final int hashCode()
+    {
+        return super.hashCode();
+    }
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#toString()
+     */
+    public String toString()
+    {
+        return name;
+    }
+
+    /**
+     * The name of the type
+     */
+    private String name;
+
+    // Support for serialization
+    private static int nextObj;
+    private final int obj = nextObj++;
+
+    Object readResolve()
+    {
+        return VALUES[obj];
+    }
+
+    private static final OSType[] VALUES =
+    {
+        MAC,
+        WIN32,
+        DEFAULT,
+    };
+
+    /**
+     * The user's private data area.
+     */
+    protected URL userArea;
+
+    /**
+     * The Windows user settings parent directory
+     */
+    private static final String WIN32_USER_DATA_AREA = "Application Data"; //$NON-NLS-1$
+
+    /**
+     * The Mac user settings parent directory
+     */
+    private static final String MAC_USER_DATA_AREA = "Library/Application Support"; //$NON-NLS-1$
+
+    /**
+     * The machine's osType
+     */
+    private static OSType osType = fromString(System.getProperty("os.name")); //$NON-NLS-1$
+
+    /**
+     * The user's home directory.
+     */
+    protected static URL userHome;
+
+    /**
+     * The log stream
+     */
+    private static final Logger log = Logger.getLogger(OSType.class);
+}

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/util/Project.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/util/Project.java	2006-10-10 23:34:40 UTC (rev 1155)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/util/Project.java	2006-10-11 12:40:09 UTC (rev 1156)
@@ -71,16 +71,6 @@
     public static final String DIR_PROJECT_ALT = "JSword"; //$NON-NLS-1$
 
     /**
-     * The Windows user settings parent directory
-     */
-    public static final String WIN32_USER_DATA_AREA = "Application Data"; //$NON-NLS-1$
-
-    /**
-     * The Mac user settings parent directory
-     */
-    public static final String MAC_USER_DATA_AREA = "Library/Application Support"; //$NON-NLS-1$
-
-    /**
      * Accessor for the resource singleton.
      */
     public static Project instance()
@@ -117,42 +107,9 @@
      * Establishes the user's project directory.
      * @throws MalformedURLException
      */
-    public URL getUserProjectDir(String unixDefault, String winMacDefault)
+    public URL getUserProjectDir(String hiddenFolderName, String visibleFolderName)
     {
-        String projectDir = winMacDefault;
-        URL path = null;
-        try
-        {
-            if (userArea == null)
-            {
-                String user = System.getProperty("user.home"); //$NON-NLS-1$
-                String osName = System.getProperty("os.name"); //$NON-NLS-1$
-
-                path = new URL(NetUtil.PROTOCOL_FILE, null, user);
-
-                if (osName.startsWith("Mac OS X")) //$NON-NLS-1$
-                {
-                    path = NetUtil.lengthenURL(path, MAC_USER_DATA_AREA);
-                }
-                else if (osName.startsWith("Windows")) //$NON-NLS-1$
-                {
-                    path = NetUtil.lengthenURL(path, WIN32_USER_DATA_AREA);
-                }
-                else
-                {
-                    projectDir = unixDefault;
-                }
-                userArea = path;
-            }
-            path = NetUtil.lengthenURL(userArea, projectDir);
-        }
-        catch (MalformedURLException ex)
-        {
-            log.fatal("Failed to find user's private data area", ex); //$NON-NLS-1$
-            assert false : ex;
-        }
-
-        return path;
+        return OSType.getOSType().getUserAreaFolder(hiddenFolderName, visibleFolderName);
     }
 
     /**
@@ -179,21 +136,7 @@
      */
     public URL getDeprecatedUserProjectDir()
     {
-        try
-        {
-            String user = System.getProperty("user.home"); //$NON-NLS-1$
-
-            URL path = new URL(NetUtil.PROTOCOL_FILE, null, user);
-            path = NetUtil.lengthenURL(path, DIR_PROJECT);
-
-            return path;
-        }
-        catch (MalformedURLException ex)
-        {
-            log.fatal("Failed to create home directory URL", ex); //$NON-NLS-1$
-            assert false : ex;
-        }
-        return null;
+        return OSType.DEFAULT.getUserAreaFolder(DIR_PROJECT, DIR_PROJECT_ALT);
     }
 
     /**
@@ -268,11 +211,6 @@
     }
 
     /**
-     * The parent directory for the home of this application
-     */
-    private URL userArea;
-
-    /**
      * The home for this application
      */
     private URL home;

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleNames.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleNames.java	2006-10-10 23:34:40 UTC (rev 1155)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleNames.java	2006-10-11 12:40:09 UTC (rev 1156)
@@ -85,12 +85,12 @@
 
             if (bookCase == CaseType.LOWER)
             {
-                return fullBooks[book - 1].toLowerCase();
+                return fullBooks[book - 1].toLowerCase(locale);
             }
 
             if (bookCase == CaseType.UPPER)
             {
-                return fullBooks[book - 1].toUpperCase();
+                return fullBooks[book - 1].toUpperCase(locale);
             }
 
             return fullBooks[book - 1];
@@ -119,12 +119,12 @@
 
             if (bookCase.equals(CaseType.LOWER))
             {
-                return shortBooks[book - 1].toLowerCase();
+                return shortBooks[book - 1].toLowerCase(locale);
             }
 
             if (bookCase.equals(CaseType.UPPER))
             {
-                return shortBooks[book - 1].toUpperCase();
+                return shortBooks[book - 1].toUpperCase(locale);
             }
 
             return shortBooks[book - 1];
@@ -215,7 +215,7 @@
      */
     private String normalize(String str)
     {
-        return normPattern.matcher(str).replaceAll("").toLowerCase(); //$NON-NLS-1$
+        return normPattern.matcher(str).replaceAll("").toLowerCase(locale); //$NON-NLS-1$
     }
 
     /**

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/versification/OSISNames.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/versification/OSISNames.java	2006-10-10 23:34:40 UTC (rev 1155)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/versification/OSISNames.java	2006-10-11 12:40:09 UTC (rev 1156)
@@ -109,7 +109,7 @@
      */
     private static String normalize(String str)
     {
-        return normPattern.matcher(str).replaceAll("").toLowerCase(); //$NON-NLS-1$
+        return normPattern.matcher(str).replaceAll("").toLowerCase(OSIS_LOCALE); //$NON-NLS-1$
     }
 
     /**
@@ -123,7 +123,7 @@
         osisMap = new HashMap(booksInBible);
 
         // Get all the OSIS standard book names
-        ResourceBundle resources = ResourceBundle.getBundle(OSISNames.class.getName(), Locale.getDefault(), new CWClassLoader(OSISNames.class));
+        ResourceBundle resources = ResourceBundle.getBundle(OSISNames.class.getName(), OSIS_LOCALE, new CWClassLoader(OSISNames.class));
 
         for (int i = 0; i < osisBooks.length; i++)
         {
@@ -151,6 +151,9 @@
     /** remove spaces and punctuation in Bible Names */
     private static Pattern      normPattern    = Pattern.compile("[. ]"); //$NON-NLS-1$
 
+    /** The Locale of OSIS Names */
+    private static final Locale OSIS_LOCALE = new Locale("en"); //$NON-NLS-1$
+
     /**
      * A singleton used to do initialization. Could be used to change static methods to non-static
      */

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/versification/SectionNames.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/versification/SectionNames.java	2006-10-10 23:34:40 UTC (rev 1155)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/versification/SectionNames.java	2006-10-11 12:40:09 UTC (rev 1156)
@@ -194,12 +194,12 @@
 
             if (bookCase.equals(CaseType.LOWER))
             {
-                return sections[section - 1].toLowerCase();
+                return sections[section - 1].toLowerCase(Locale.getDefault());
             }
 
             if (bookCase.equals(CaseType.UPPER))
             {
-                return sections[section - 1].toUpperCase();
+                return sections[section - 1].toUpperCase(Locale.getDefault());
             }
 
             return sections[section - 1];
@@ -250,7 +250,7 @@
 
     /**
      * Handy section finder. There is a bit of moderately bad programming
-     * here because org.crosswire.jsword.control.map.sw*ng.GroupVerseColor
+     * here because org.crosswire.biblemapper.sw*ng.GroupVerseColor
      * uses these numbers as an index into an array, so we shouldn't
      * change these numbers without fixing that, however I don't imagine
      * that this section could ever change without breaking

Added: trunk/jsword/src/main/java/org/crosswire/jsword/versification/package.html
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/versification/package.html	2006-10-10 23:34:40 UTC (rev 1155)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/versification/package.html	2006-10-11 12:40:09 UTC (rev 1156)
@@ -0,0 +1,23 @@
+<html>
+<body>
+
+<p>
+  The core responsibility of the versification package is to understand verse references.
+  It standardizes on OSIS book names and on a KJV versification. Each book in the KJV is
+  numbered sequentially and each verse of the KJV is numbered sequentially.
+</p>
+
+<p>
+  The primary abilities of this package are to flexibly understand Bible book names
+  as might be found in a reference work or supplied by a user, to convert between
+  these and OSIS book names and KJV book number.
+</p>
+
+<p>
+  One can also request information concerning books of the Bible: The number of chapters
+  or verses in a book, the number of verses in a particular chapter, the ordinal position
+  of a verse in the KJV and so forth.
+</p>
+
+</body>
+</html>

Modified: trunk/jsword/src/test/java/Bench.java
===================================================================
--- trunk/jsword/src/test/java/Bench.java	2006-10-10 23:34:40 UTC (rev 1155)
+++ trunk/jsword/src/test/java/Bench.java	2006-10-11 12:40:09 UTC (rev 1156)
@@ -1,11 +1,9 @@
 import java.util.Iterator;
 import java.util.List;
 
-import org.crosswire.common.util.Reporter;
 import org.crosswire.jsword.book.Book;
 import org.crosswire.jsword.book.BookFilters;
 import org.crosswire.jsword.book.Books;
-import org.crosswire.jsword.book.filter.FilterException;
 import org.crosswire.jsword.book.test.Speed;
 
 /**




More information about the jsword-svn mailing list