A.J. Venter ha scritto:
Hi all,
I am trying to make OutKafe gettext translateable, using whatever code
I can find for samples this is what my code now looks like:
-------
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,
ExtCtrls,Util,
StdCtrls, Buttons , gtkproc, TrayIcon, popupnotifier,
Menus,liboutkafe,popupunit,
fileUtil,baseunix,unix, IpHtml, Ipfilebroker,gettext;
resourcestring
rsLoginDetails = 'Enter your login details to continue';
rsLoginName = 'Login Name';
rsPassword = 'Password';
rsLogin = 'Login';
<snip>
procedure OklinMainForm.Create;
<snip>
//LangPath is a const, it is set to /usr/share/outkafe/lang
TranslateUnitResourceStrings('oklinmainunit',
LANGPATH+PathDelim+'oklin.%s.po');
Label1.Caption := Utf8ToAnsi(rsLoginDetails);
Label2.Caption := Utf8ToAnsi(rsLoginName);
Label3.Caption := Utf8ToAnsi(rsPassword);
LoginBtn.Caption := Utf8ToAnsi(rsLogin)
-------
So I compile it, which generates an oklinmainunit.rst file, I run
rstconv -i oklinmainunit.rst -o oklin.po
cp oklin.po oklin.af.po
I edit oklin.af.po and copy it to /usr/share/outkafe/lang
I ALSO run msgfmt oklin.af.po -o oklin.af.mo
And put that in there as WELL,
Then I run:
LANG="af" ./oklin
But the program remains obstinately in English (no output in the
console gives me any
indication of why).
Can anybody give me an idea what I am doing wrong ?
Why does the TranslateUnitResourceStrings function appear to have FOUR
parameters in some calls (but not in the gettext unit) - is that
alternative a better choice ? Where do I get it?
I don't know what's wrong with what you're doing, but I can tell you
what I've done. I wanted a way to translate in different languages, with
some main constraints:
1) The translation must be a simple text file, so that any user may
create a translation for his locale, or correct the translation.
2) I wanted the capability of switching from one language to another
run-time, without closing the application. For example: a user is
running the program, and uses Danish. A service man who doesn't speak
Danish, but only English is assisting him. and takes over. He switches
to English (otherwise he won't be able to understand button captions,
messages, etc.), and then gives back the application to the user, which
switches again to Danish. The application starts with the default
environment language, but then it must very easy to change.
3) The process must be as far as possible transparent to the developer.
He just sets Text or Caption properties, and translation occurs without
any further action.
Therefore I devised my mechanism, which requires a minimal intervention
on the caption property, and since then I'm happy.
When you have to deal with languages from Thai to Swedish, the number of
headaches increases quickly, but since I started using my own way, the
headaches have disappeared.
If you're interested I may give you more details.
Kind regards,
Giuliano
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives