2008-08-18
The goal is to translate DFArc in your language. In some pieces of software, translating texts can be a tedious task of associating texts for cryptic symbols, editing scripts by hand... This is not the case here! We're using the state-of-the-art gettext translation system, as well as the Poedit graphical interface.
Links:
Here's the result with the Polish and French translations:
The general principle is to translate a set of texts or strings. The set of strings makes a catalog. The catalog is a .po file, which is then opened by DFArc to translate the interface. This way the strings are separate from the program itself.
Even more interesting: you can automatically extract strings from the DFArc source code, and also merge them in an existing translation, only updating what changed since the previous release.
For example, let's begin a new catalog for Italian. Here's the main window, MS Windows and GNU/Linux versions:
First, install Poedit on your system: http://www.poedit.net/download.php.


Note: I'm going to use the GNU/Linux English version in the screenshots, but it is identical on other platforms and languages.
Now you select File > New catalog from POT file...

POT means PO Template: it contains the DFArc strings without translations yet. Download and open DFArc.pot.

You then specify what language you're going to translate (leave out the other fields for now):

Then save your catalog, preferably using its language code. See the gettext documentation for a list of codes.

You then can edit the catalog.

%s and other %XXX are standard marks that are
replaced by filenames or numbers by DFArc. You need to copy them
unmodified in your translation (technical note: they
are printf formats from the C programming language).
Here's my up-to-date French catalog:

When you press Save, Poedit will create a .mo file, which is the .po converted to binary format (more efficient), in the same directory. That's what you'll give DFArc.
Under GNU/Linux: place your xx.mo file
in /usr/local/share/locale/xx/LC_MESSAGES/dfarc.mo,
replacing xx by your language code.
Under MS Windows: place your xx.mo file
in po\xx\LC_MESSAGES\dfarc.mo,
replacing xx by your language code, in the same directory
than DFArc. For example, my French (fr) catalog is in C:\Program
Files\Dink Smallwood\po\fr\LC_MESSAGES\dfarc.mo.
Note: the current language is automatically detected, using your
operating system. GNU/Linux users may type LANG=xx
dfarc to use a particular language once.
Oh right, this only works with the new DFArc v3 (DFArc2 doesn't use gettext). Download the current beta here for MS Windows (other versions).
Now you can send me your .po files. I'll include them in the next release :)
That's it for today! Now you know the basics for translating DFArc. There is more to try, including merging a newer POT file with your translations, browsing the source code to see a string in context (for better understanding), update fuzzy (slightly changed) translations, plural forms... More later!