Looking through the FreeMED code, text is translated using this system by being wrapped with the __() function, similar to the _() function used by gettext.
A GettextXML file looks like this:
<?xml version="1.0"?> <gettextXML lang="fr">
<information>
<Application>FreeMED</Application>
<ApplicationVersion>0.6.0</ApplicationVersion>
<Component>API</Component>
<ComponentVersion>0.6.0</ComponentVersion>
<Locale>fr_CA</Locale>
<RevisionDate>2003-04-16</RevisionDate>
<RevisionCount>1</RevisionCount>
<ContentTransferEncoding>8bit</ContentTransferEncoding>
<IsoSet>iso-8859-1</IsoSet>
<Generator>vim 5.6</Generator>
<Translator>
<Name>Jeff</Name>
<Address>jeff@ourexchange.net</Address>
</Translator>
<Comments>
Extra comments about this translation go here.
</Comments>
</information>
<translation>
<original>Patient</original>
<translated>Malade</translated>
</translation>
<translation>
<original>Main Menu</original>
<translated>Menu Principal</translated>
</translation>
</gettextXML>
There is a proof-of-concept editor available for GettextXML, but it is currently easiest to translate using a text editor like VI.
Almost every page displayed or printed by FreeMED uses the __() function call. Translating these strings, therefore, is the bulk of the translation work. However, there are two ExceptionsToTheGettextRule, which have to do with the pages that we have to display before the GettextXML system is callable.
There is a Perl script in the FreeMED distribution and CVS repository called script/GettextXML_Catalog.pl, which creates the template catalogs for FreeMED. It should be run from the FreeMED distribution (usually in /usr/share/freemed), like this:
./scripts/GettextXML_Catalog.pl fr_CA "Francais (Canada)"
which will generate files in /usr/share/freemed/locale/fr_CA/. These files can be hand-edited, or modified with a GettextXML editor. This can be run again to merge in new language strings without losing any that were already translated.
It is important to note that you cannot simply use the ASCII entity names which are normally associated with special characters, since the XML parser used by GettextXML does not support them. For example, to create Ç, you would have to use Ç and not Ç. A complete list is available at http://www.w3schools.com/html/html_entitiesref.asp.
It is also very useful to translate any accompanying documentation, such as the online manual, users' manual, or programming documentation (though this is not necessary for FreeMED to function).
![[developer.freemedsoftware.org]](img/fsf_logo.png)