• The Handbook
  • What it is
  • Installation
  • The Commandline Tool
  • The CGI Interface
  • Some Goodies
  • Hacking and Tweaking
  • Sourceforge Services
  • Project Homepage
  • Project Summary
  • Subversion
  • Mailing Lists
  • Forums
  • Reporting Bugs

fcprinter - Hacking And Tweaking

Tweaking Default Values

There are several constants in the source file which can be adjusted with some minor knowledge of PERL. They are all centralized in options.pl.

@fops
A list of known paths where fop can be found. fop is part of most distributions but often only in an outdated version 0.20 whereas you should at least use version 0.95 due to bugs.
$card_height and others
The default sizes of the cards and the number of rows can be adjusted. The names are self-explanatory (at least I hope :-).

Translating the User Interface

fcprinter uses a really simple approach to select the desired language. The browser sends the desired language according to your local settings and fcprinter looks for a known language code in the request. Currently there are en for English and de for German.

If you want to add a new language you need to copy the existing file i18n-en.pl to a new file with the approriate language code. For example i18n-it.pl for Italian. Then load your new file into a rather modern editor which can handle files in UTF-8 format. Otherwise special characters will be crippled. Adjust all the text sequences on the right which are in double quotes without damaging the variable names on the left.

Change the name of the sub routine to reflect the name of your language and replace en by it:


  sub i18n_is_it()
  {

Then load lib.pl and scroll to a line which reads guess_language(). At the bottom add a new if clause which makes the program recognize your new language. It should then look similar to this snippet:


  if ($langdef =~ "de")
  {
    i18n_is_de();
    return;
  }

  if ($langdef =~ "it")
  {
    i18n_is_it();
    return;
  }
 }

Don't forget to send me your new file.

Recognized CSV Formats

There is no common structure for text files in CSV format. But fcprinter should be able to read most of them (even if the lines use various formats):

Comma separated
The data itself is enclosed in double quotation marks (") and a semicolon separates the various entries. For that reason quotation marks are not allowed within the data.
Tab separated
The data itself is not enclosed but an invisible tabulator character separates the various entries. Therefor no tabs are allowed within the data.

Get FlashCardPrinter at SourceForge.net. Fast, secure and Free Open Source software downloads Last edit: 2009-06-19