[jsword-svn] r1542 - in trunk/jsword/src/main/java/org/crosswire/jsword/book: basic readings
dmsmith at www.crosswire.org
dmsmith at www.crosswire.org
Wed Jul 25 12:49:17 MST 2007
Author: dmsmith
Date: 2007-07-25 12:49:17 -0700 (Wed, 25 Jul 2007)
New Revision: 1542
Modified:
trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/DefaultBookMetaData.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/readings/ReadingsBook.java
Log:
Fixed the rtl orientation of ReadingsBook
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/DefaultBookMetaData.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/DefaultBookMetaData.java 2007-07-25 19:05:33 UTC (rev 1541)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/DefaultBookMetaData.java 2007-07-25 19:49:17 UTC (rev 1542)
@@ -21,6 +21,8 @@
*/
package org.crosswire.jsword.book.basic;
+import java.awt.ComponentOrientation;
+import java.util.Locale;
import java.util.Map;
import org.crosswire.common.util.Languages;
@@ -48,7 +50,7 @@
* The copyright to this program is held by it's authors.
* @author Joe Walker [joe at eireneh dot com]
*/
-public final class DefaultBookMetaData extends AbstractBookMetaData
+public class DefaultBookMetaData extends AbstractBookMetaData
{
/**
* Ctor with a properties from which to get values.
@@ -61,7 +63,9 @@
setProperties(prop);
setName((String) prop.get(BookMetaData.KEY_NAME));
setType((String) prop.get(BookMetaData.KEY_CATEGORY));
- setLanguage((String) prop.get(BookMetaData.KEY_LANGUAGE));
+ String lang = (String) prop.get(BookMetaData.KEY_LANGUAGE);
+ putProperty(BookMetaData.KEY_XML_LANG, lang);
+ setLanguage(lang);
IndexManager imanager = IndexManagerFactory.getIndexManager();
if (imanager.isIndexed(book))
@@ -115,8 +119,15 @@
*/
public boolean isLeftToRight()
{
- // TODO(joe): Do this correctly
- return true;
+ String lang = getProperty(BookMetaData.KEY_XML_LANG);
+
+ // Java does not know that the following languages are right to left
+ if ("fa".equals(lang) || "syr".equals(lang)) //$NON-NLS-1$ //$NON-NLS-2$
+ {
+ return false;
+ }
+
+ return ComponentOrientation.getOrientation(new Locale(lang)).isLeftToRight();
}
/**
@@ -124,6 +135,7 @@
*/
public void setLanguage(String language)
{
+ putProperty(BookMetaData.KEY_XML_LANG, language);
putProperty(KEY_LANGUAGE, Languages.getLanguage(language));
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/readings/ReadingsBook.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/readings/ReadingsBook.java 2007-07-25 19:05:33 UTC (rev 1541)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/readings/ReadingsBook.java 2007-07-25 19:49:17 UTC (rev 1542)
@@ -84,6 +84,7 @@
DefaultBookMetaData bmd = new DefaultBookMetaData(driver, name, type);
bmd.setInitials(setname);
+ bmd.setLanguage(Locale.getDefault().getLanguage());
setBookMetaData(bmd);
// Go through the current year
More information about the jsword-svn
mailing list