Hallo Fred,

as an aside to translation and internationalization, I "played" a bit
around with the .po file method and its use in Linux. The starting
point was the attempt to create a translatable version of an old
program I recently adapted to mseide-msegui as something like a "test
bed" for my dialog modifications (which aren't finished yet because of
the host of recent).
And during that undertaking, I had to find that I was wrong yesterday,
when I wrote:

"In contrast, translations for Linux binaries commonly are kept in a
 centralized "locale/" directory (mostly
 "/usr/locale/<language id>/LC_MESSAGES"). Interestingly, those files
 do NOT use the extension id>".po" but ".mo", but are otherwise
 structurally nearly identical."

Well, I wasn't wrong with WHERE these files usually reside and how
they're named, but I WAS wrong with my assumption of their contents.
In fact, the ".mo" files are NOT equivalent to the ".po" files, but are
binary representations of the ".po" files' content, produced by a
utility, "msgfmt", belonging to the set of localization handlicng
programs together comprise the "gettext" system.
(I was misled by the presentation by my file manager's viewer, which
"knows" a lot of file formats and presentss the content in a "readable"
manner - such as these .mo file's content as well. Their binary nature
became clear only after I had tried to compare a .mo with one of the
sample .po files, which, of course, failed. Using the "raw" format
display function of the viewer, it was immediately clear that these
files sre "precompiled" versions of the .po sources.)

This might provide a huge simplfication of mseide-msegui's localization
implementation, because the files so created are directly loadable by
an fpc utility named "TMOfile", located in the "fcl" library unit
"gettext" - which, by chance, you're using for a minor helper
procedure anyway. A TMOfile object keeps the translations in internal
stroage, and it provides a "translate" function. You just provide it
a reference string and get the localized version as the result.

I attempted to modify your "podemo" program to make use of this
utility, and, after creation of the appropriate .mo files from the
provided .po ones, of course, was able to get it to work identically
to the original implementation.
Using the "precompiled" .mo files promises even "some" speed-up of
the process of language loading / switching, which might even help to
avoid some unpleasant effects I noticed with language loading e.g. of
your "ideU".


-- 
(Weitergabe von Adressdaten, Telefonnummern u.ä. ohne Zustimmung
nicht gestattet, ebenso Zusendung von Werbung oder ähnlichem)
-----------------------------------------------------------
Mit freundlichen Grüßen, S. Schicktanz
-----------------------------------------------------------



_______________________________________________
mseide-msegui-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to