linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* i18n questions
@ 2004-04-01 10:43 Mihai RUSU
  2004-04-01 14:58 ` Glynn Clements
  2004-04-01 15:05 ` Progga
  0 siblings, 2 replies; 3+ messages in thread
From: Mihai RUSU @ 2004-04-01 10:43 UTC (permalink / raw)
  To: linux-c-programming

Hi

I am developer on a TCP network server project where the server sends some
text messages to clients which are displayed unmodified. I am curently
trying to find out the best way to support different language types
(please note that I have no control over the clients, they are binary only
comercial applications made by organizations with absolutly no relation to
me or my project) . I have read the man pages of gettext family functions.
However they dont seem to me very flexible. Because I can have clients
from different countries connecting to the same server (they send their
"locale"  identification data in the initial packets) I want to be able to
send korean messages to korean users, french messages to french users,
english to english ones etc. As I see it gettext uses the language set
with setlocale. I dont see it as a solution to call setlocale() before
translating every message to send depending on the clients locale. Do I
miss something about gettext ?

Other thing I want is to have the codes compatible with win32 too but I 
guess I can solve that easily by including a gettext lib with the project 
(I saw "gaim" does something like that too).

Another solution whould be to "make my own". For this I have thought to 
take advantage of the already included "CDB" codes in the project (based 
on some tinycdb release) and have "dictionary" files in CDB format, have 
my own translation function, so then Im not restricted to the locally set 
locale as I have read it is with gettext (I can have an API where I send 
the language to translate to in the translation function call). This also 
will automatically enabled me to support WIN32 too (if I wrote my codes 
portably of course ;)). The big disadvantage here whould be that having my 
own format for dictionary files I cannot take advantage of existent 
projects like KBabel to write such dictionary files. Anyone here has a 
pointer to some detalied explanation of the .po and .gpo files (I see in 
"gaim" that .gpo is some "compiled" form) ? Couse I might do some ".po to 
CDB" compiler and go with this solution :)

Thanks!

-- 
Mihai RUSU                                    Email: dizzy@roedu.net
GPG : http://dizzy.roedu.net/dizzy-gpg.txt    WWW: http://dizzy.roedu.net
                       "Linux is obsolete" -- AST

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: i18n questions
  2004-04-01 10:43 i18n questions Mihai RUSU
@ 2004-04-01 14:58 ` Glynn Clements
  2004-04-01 15:05 ` Progga
  1 sibling, 0 replies; 3+ messages in thread
From: Glynn Clements @ 2004-04-01 14:58 UTC (permalink / raw)
  To: Mihai RUSU; +Cc: linux-c-programming


Mihai RUSU wrote:

> I am developer on a TCP network server project where the server sends some
> text messages to clients which are displayed unmodified. I am curently
> trying to find out the best way to support different language types
> (please note that I have no control over the clients, they are binary only
> comercial applications made by organizations with absolutly no relation to
> me or my project) . I have read the man pages of gettext family functions.
> However they dont seem to me very flexible. Because I can have clients
> from different countries connecting to the same server (they send their
> "locale"  identification data in the initial packets) I want to be able to
> send korean messages to korean users, french messages to french users,
> english to english ones etc. As I see it gettext uses the language set
> with setlocale. I dont see it as a solution to call setlocale() before
> translating every message to send depending on the clients locale. Do I
> miss something about gettext ?

No; you have to call setlocale() before each locale-dependent
operation. This isn't restricted to gettext() etc; it also applies to
ANSI/POSIX functions which use the locale (e.g. printf, isalpha,
strcoll etc). There aren't any functions which accept a locale as an
argument.

One word of warning: be careful about setting locale categories other
than LC_MESSAGES, as they can affect the behaviour of ANSI/POSIX
functions. E.g. setting LC_NUMERIC may result in printf("%f",...) 
using a comma as the decimal separator. If existing code is using
printf() etc to generate machine-readable text, changing the format is
probably a bad idea.

> Anyone here has a 
> pointer to some detalied explanation of the .po and .gpo files (I see in 
> "gaim" that .gpo is some "compiled" form) ? Couse I might do some ".po to 
> CDB" compiler and go with this solution :)

See the "gettext" Info file. Also, the compiled form of a .po file
(the form which gettext uses) usually has a ".mo" suffix.

-- 
Glynn Clements <glynn.clements@virgin.net>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: i18n questions
  2004-04-01 10:43 i18n questions Mihai RUSU
  2004-04-01 14:58 ` Glynn Clements
@ 2004-04-01 15:05 ` Progga
  1 sibling, 0 replies; 3+ messages in thread
From: Progga @ 2004-04-01 15:05 UTC (permalink / raw)
  To: Mihai RUSU; +Cc: linux-c-programming

On Thu, Apr 01, 2004 at 01:43:31PM +0300, Mihai RUSU wrote:

> projects like KBabel to write such dictionary files. Anyone here has a 
> pointer to some detalied explanation of the .po and .gpo files (I see in 
> "gaim" that .gpo is some "compiled" form) ? Couse I might do some ".po to 
> CDB" compiler and go with this solution :)

 $ info gettext


 Basicallly, the PO file contains the translated messages in text form whereas
the MO files have them in Binary form.  In anycase, gettext works in user
application only (AFAIK).  So, I don't think it'll be of any help to you in
this client-server context ;-(



 Khoda Hafez
 Progga


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-04-01 15:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-01 10:43 i18n questions Mihai RUSU
2004-04-01 14:58 ` Glynn Clements
2004-04-01 15:05 ` Progga

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).