Projects:Go Bible/Go Bible Creator

From CrossWire Bible Society
Revision as of 09:41, 16 March 2011 by David Haslam (talk | contribs) (Source-Text format: added text)

Jump to: navigation, search
New page under construction.

Introduction

Go Bible Creator is a tool for converting Bible texts into Go Bible Java ME applications that can be loaded onto suitable mobile phones. Go Bible Creator is a Java application and requires Java SE (Runtime Environment).

Download Go Bible Creator

Before running Go Bible Creator

Before Go Bible Creator can be used you will need to obtain or create suitable input text containing the Bible translation or Bible version.

Input file formats

Go Bible Creator can now handle input text in each of the following formats:

  • OSIS – a single XML file using OSIS format
  • ThML – a single XML file using ThML format
  • USFM – multiple text files using USFM format
  • XHTML-TE – a single XHTML file using an extended HTML format for the SIL Translation Editor

All the input files must be Unicode text encoded as UTF-8 (without BOM).

For use with Go Bible Creator, an OSIS must be of the container type, not the milestone type.

A sample ThML file for the book of Hebrews is provided. Further ThML files may be downloaded from CCEL.

The developer must ensure that permission has been obtained in writing for using any copyrighted material as input text.

Preprocessing

It is often the case that some preprocessing will be required to ensure that the input text is compatible for use with Go Bible Creator. It should not be assumed that input text files obtained directly from third parties will meet the exacting requirements.

Running Go Bible Creator

GoBibleCreator is run with the following command line and by default would be run from the directory containing the GoBibleCreator.jar file:

java -Xmx128m -jar GoBibleCreator.jar [PathToCollectionsFile | PathToXMLfile]+

Enhanced techniques

It is possible to specify the location for the GoBibleCreator.jar file as follows, in this example by means of a suitably defined environment variable:

java -Xmx128m -jar %GBC_PATH%\GoBibleCreator.jar ...

Windows users can redirect the generated messages by sending standard output and error output to suitably named log files:

java -Xmx128m -jar %GBC_PATH%\GoBibleCreator.jar %1 1>.\java.log 2>.\error.log

In the above example, it is assumed that %1 is a passed parameter. This technique can be readily adapted by Unix users.

Windows users can also test for success or failure by examining the errorlevel value. Here is what I have in my Windows command file called MakeGoBible.cmd :

REM Using a defined environment variable and command line parameter
java -Xmx128m -jar %GBC_PATH%\GoBibleCreator.jar %1 1>.\java.log 2>.\error.log
if not errorlevel 1 goto end 
start .\error.log
start .\java.log
:end
rem pause

To use this technique with multiple files, just replace the command line parameter %1 by %1 %2 %3 %4 %5 %6 %7 %8 %9

Tip: For Windows users, it is best to avoid using paths containing a space, which gets confused as a parameter delimniter.

Required parameters

-xmx128m
Go Bible Creator loads the entire source text file[s] into memory and therefore requires the -Xmx128m parameter to increase the total memory available in Java to 128MB.
PathToCollectionsFile
Go Bible Creator can optionally process multiple files at once by specifying several PathToCollectionsFiles on the command line.
PathToXMLfile
This is a alternative use of GoBibleCreator described further below. This secondary use appertains only to input files in either OSIS or ThML formats.
Invoking GoBibleCreator with an XML file as the specified parameter does not generate any JAD/JAR files, only a new collections.txt file prefilled with extracted book names. To produce the JAD/JAR files you would need to run GoBibleCreator again but this time with the collections.txt file as the only parameter. However, you would normally need to manually edit the Collections.txt file before doing that.

Optional parameters

There are two optional parameters:

-d PathToMainSourceTextDirectory
Specifies a source text directory where all Source-Text folders will be relative to. See below for more details on the Source-Text property in the "collections text" file.
-u
Update option: Using this option Go Bible Creator will update existing JAR files if they exist rather than create new ones. The source text will not be parsed nor will new Bible data be generated however everything else will be updated including the GoBibleCore, book names, UI properties, JAD file, manifest, etc. This option is useful if the source text hasn't changed and there hasn't been any change to the Go Bible Data Format, as it will be much quicker to process each collection. This option first makes a backup copy of the original JAD and JAR files.

Collections text files

To produce the JAD and JAR files run GoBibleCreator with a suitable "collections text" file. This example uses the Hebrews collections.txt file included with GoBibleCreator:

java -Xmx128m -jar GoBibleCreator.jar Hebrews/Collections.txt

GoBibleCreator will generate JAD and JAR files and place them in the same directory as the specified collections text file.

The format and content of a "collections text" file is described further below. Typically, the developer will need to carefully construct a collections text file (using a suitable text editor) in order to obtain all the required properties and features of the created Go Bible application[s].

Notes

  1. Any suitable filename may be chosen for a "collections text" file; it does not have to be called collections.txt
  2. Collections text files may optionally contain blank lines and remark lines.
  3. Collections text files must be Unicode text files that should be encoded as UTF-8 without BOM. If the BOM is included inadvertently, the first line will not be correctly processed (unless it happens to be a blank line).
  4. Collections text files may specify more than one collection of books. This is useful when the developer wishes to provide split collections in addition to one for a complete Bible.

Source-Text location

Source-Text format

The format must now be specified using the following property:

Source-Text: [ OSIS | ThML | USFM | XHTML-TE ]

Example:

Source-Text: ThML 

Omitting this line will result in a message being sent to standard output, but no JAR or JAD files are created. The argument for this property is not case-sensitive.

Collections

The Info Property

Mapping book names

The book names in the source text may need mapping to book names that are more suitable for use in the Go Bible application. This feature may be used to cover various situations:

  • Book names for (non-English) Bible translations
  • Shorter or longer book names than used in the source text
  • Case changes, etc

Many source text files use English book names even though the text is in the native language. Go Bible Creator supports changing the book names using the Book-Name-Map property. Specify this property for every book whose (English name) must be mapped to another name, for example:

Source-Text: ../Hebrews.thml
Book-Name-Map: Hebrews, The Book of Hebrews
Collection: Hebrews
Book: Hebrews

In the second line above, the first string "Hebrews" is the name of the book as it appears in the input file, while the second string "The Book of Hebrews" is what will appear to the user. Note: The Book-Name-Map property does not change the usage of book names in the rest of the collections text file, they must still specify the book names used in the source text file. The position of book name mapping is not important. The following would work just as well.

Source-Text: ../Hebrews.thml

Collection: Hebrews
Book: Hebrews

Book-Name-Map: Hebrews, The Book of Hebrews

To map all the book names for the whole Bible, it is usually more legible for all these lines to be grouped together in one section of the collections text file.

Translating the User Interface

Right Aligned Text

Splitting Books

Support for MIDP 1.0

Language Codes

Creating Files for WAP Download

After running Go Bible Creator

It should not be assumed that an absence of error message means that the generated Go Bible applications are without error due to either text or markup issues.

Testing Go Bible applications

Go Bible applications should be thoroughly tested before being distributed. There are two main ways to do this:

Using a Java ME emulator
Using suitable mobile phones

Help