Usage

Greg pointed out that there is no obvious entry point in the jar file. This section attempts to explain entry points and how programmers might extend the packages.

Entry points

The code needed to use the package as it is, i.e. for en-UK braille is shown below. Note that this is pro-tem, until I can mate this code with an XML parser.



import org.dpawson.impl.BrailleEngineFactory;
import org.dpawson.impl.BrailleTable;
import org.dpawson.impl.TextToBraille;
import org.dpawson.util.*;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileOutputStream;


     
String braille;
int grade = 2;

  BrailleEngineFactory factory = new BrailleEngineFactory();
  BrailleTable table = factory.createBrailleTable("en");
  TextToBraille t2 = new TextToBraille(table); // t1.getTranslator();


 braille = t2.Translate("The quick brown fox jumps over the lazy dog.");



This calls up the en-UK braille table, then translates into grade 2 btraille the text passed to translate. That's it.

Extending

In order to extend the code to use your own braille table, a number of steps are necessary, the first of which is to know (or have access to) a braille user (familiar with your braille rules rather than being able to read braille, they are not necessarily the same thing) willing to spend time with you. You may find that your national braille committee does, or does not, charge for their braille rules. In the UK RNIB charges for them.

The first step is to implement org.dpawson.imple.BrailleTable for your language. Prefix it with your language code from Sun, which is probably more appropriate, since I'm intending to use the Sun java locale and language codes for their I18N support (another todo). This might result in hyBrailleTable as your class name. this provides a more complete list of country codes. See the code section (code) for more details of how that works. Then you'll need to implement some of the special methods which I believe to be language dependent. This may be:

addAcronym()
doDate()
isAcronym()
isDate()
etc.

Take a look at the ENBrailleTable class for examples. It depends on how easy it might be to add all the rules necessary for your braille rules. Just make sure that your language specific methods are within your XXBrailleTable class.

If you are aware of TDD, you may like to test as you go along. I found it nearly essential, since one rule can mess up another without much problem. Your choice. I used the org.dpawson.test.TestTranslate class for this. All the hooks are there. Please help yourself.

If you want to ask questions, please don't hesitate.