Backend configuration support
Neil Williams
linux at codehelp.co.uk
Mon Aug 22 16:34:51 EDT 2005
(The new backend method is still CashUtil only - G2 continues using the
existing methods.)
The XML configuration file containing translatable strings and the schema for
the <qofconfig> namespace along with changes to the Makefile.am's to build
this XML from a perl script - all this will follow in a day or two.
Schema: backend-schema.xsd.xml
http://cvs.sourceforge.net/viewcvs.py/qof/qof/backend/
Perl: backend-config.pl
http://cvs.sourceforge.net/viewcvs.py/qof/qof/backend/file/
The XML needs to be read by those processes that want to configure backends at
runtime and will form the API for backend configuration once complete.
Backend developers decide which parameters (if any) support configuration by
editing a copy of a standard perl script and documenting what each option is
intended to achieve. Those descriptions are then merged into the gettext po
files for translation as normal.
I'm not sure if the perl is going to have to be distributed - at present,
gettext cannot alter the XML itself, only the perl (which needs the gettext
module). This makes it hard to use gettext as intended, at the user end. One
alternative is to use the translations to build a single XML file that
includes all translations.
It may be easier to let libxml2 deal with identifying the language to use and
distribute a larger XML file for each backend.
example perl snippet
use strict;
use POSIX; # for setlocale()
use gettext;
$language = gettext("en-gb");
$options{'file_retention_days'} = qq/gint64/;
$texts{'file_retention_days'} = gettext("Number of days to retain old copies
of the file.");
$options{'file_compression'} = qq/boolean/;
$texts{'file_compression'} = gettext("Use compressed files or not?");
There is documentation with the real perl script, in pod form, naturally.
<?xml version="1.0" encoding="UTF-8"?>
<qofconfig xmlns="http://qof.sourceforge.net/" >
<backend name="GnuCash Backend Version 2">
<provider xml:lang="en-gb">
<option type="gint64" name="file_retention_days">
Number of days to retain old copies of the file.
</option>
<option type="boolean" name="file_compression">
Use compressed files or not?
</option>
</provider>
</backend>
</qofconfig>
If multiple translations are included in one file, the provider tag repeats
with the language label. Note that the language specified is the XML version,
not the expected en_GB but using a hyphen AND case insensitive.
(Don't you love standards!)
--
Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20050822/137cf2a5/attachment.bin
More information about the gnucash-devel
mailing list