OK, I will deal with the last two points.* Invoking xml2brl from inside an app probably is the "poor mans" way of doing it, for the best experience I would imagine an app should do it by calling the library directly. There are ways to improve performance of checking about tables by having some sort of cache file and then identifying when the directory has been modified. This would complicate things and I don't know too much on the methods to do this. Anyway to add this sort of feature (the cache) should not concern the applications using the libs and so could be implemented later. * If there are two matches, for the example you give I doubt all three Swedish tables would be returned, by the look one is grade 1 so would be filtered out by the grade option (if given, if not then we should possibly set the most common default). The other two look like tables relating to various revisions of the code, by default the later should be returned.
The last point raises the question should we may be have another function call:
def list_tables(locale="whatever the system default is", grade=2, dots=6):"""Returns a list of the tables matching the criteria with the best match first"""
...In that when I say best match I mean it will put the most recent revision of the code first and as we have defaults (a python feature although must be possible to do something similar in C) when certain options aren't set we still have some criteria to go on (eg. if no locale is given then use the system locale).
Alternatively why not have this behavior as the single call, so if you aren't interested in giving the user options then take the first table in the list (check list length is not 0). That also handles the case of no matching table.
Michael Whapples On 09/11/09 16:07, Christian Egli wrote:
Hi Thanks for this lively discussion :-) On Mon, 2009-11-09 at 13:22 +0000, Michael Whapples wrote:* What is the difference between ISO codes and locale? In languages like python and java I think you tend to deal with locale.They are fairly similar from what I can tell. When I speak about ISO codes i mean language tags according to rfc 4646 (http://en.wikipedia.org/wiki/IETF_language_tag). An example would be "en-US" or "de-CH", etc. These tags are used in HTML, XML and apparently even PNG.* Why couldn't we have things like number of dots as another piece of information in the struct?I guess we could. We probably should. I was trying to find out in this discussion :-). The question what information is needed. Do we need computer braille and UEBC as well?* Is there any other case than hyphenation dictionaries when you may pass more than one table to liblouis? If hyphenation dictionaries are the only case then may be we could have a similar API for hyphenation dictionaries and its up to the application to put the two together.For now I'd rather limit this discussion to a selection of a table based on the language tag. We can always add more API (e.g. for hyphenation) later.* I really don't understand why not just go straight to scan the table/tables directories for all files, read the description information of each file on each call of the function for finding this information. I think the difference here is that my call would not search for a specific table matching information but would prepare a structure containing the mappings.I think I see where you're coming from. If you use the python bindings and invoke liblouis as a library then you could just do the scanning once and just call the lou_translate* calls from thereon in. But if you invoke liblouis in the form of xml2brl the scanning would happen every time (for no good reason really, except to be able to dynamically add tables).May be liblouis then could also have a call to find best match like you suggestThat brings up another question: What do we return if more than one table matches the given criteria. For example we just added two more Swedish tables recently. What do you get if you specify "sv"? Do you get a list containing "sv-1989.ctb", "sv-1996.ctb" and "Se-Se-g1.utb"? In what order? I think this needs some more thought. Thanks Christian
For a description of the software and to download it go to http://www.jjb-software.com