[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] Editing /etc/cobalt/messages/en_US/ui.po and using GetText ...



> I really dont understand how to use Gettext.. Could you please give
me a
> clear example, that would be very much appreciated.

Extracted from gettext user's manual you can find at www.gnu.org :
******************************************************************

Chapter 6: Producing Binary MO Files

6 Producing Binary MO Files

6.1 Invoking the msgfmt Program

Usage: msgfmt [option] filename.po ...

'-a number'
'--alignment=number'
Align strings to number bytes (default: 1).

'-h'
'--help' Display this help and exit.
'--no-hash'
Binary file will not include the hash table.

'-o file'
'--output-file=file'
Specify output file name as file.

'--strict'
Direct the program to work strictly following the Uniforum/Sun
implementa-
tion. Currently this only affects the naming of the output file. If
this option is
not given the name of the output file is the same as the domain name.
If the
strict Uniforum mode is enable the suffix '.mo' is added to the file
name if it is
not already present.
We find this behaviour of Sun's implementation rather silly and so by
default
this mode is not selected.

'-v'
'--verbose'
Detect and diagnose input file anomalies which might represent
translation er-
rors. The msgid and msgstr strings are studied and compared. It is
considered
abnormal that one string starts or ends with a newline while the other
does
not.

Also, if the string represents a format sring used in a printf-like
function
both strings should have the same number of '%' format specifiers,
with match-
ing types. If the flag c-format or possible-c-format appears in the
special
comment h #, i for this entry a check is performed. For example, the
check will
diagnose using '%.*s' against '%s', or '%d' against '%s', or '%d'
against '%x'. It
can even handle positional parameters.

Normally the xgettext program automatically decides whether a string
is a
format string or not. This algorithm is not perfect, though. It might
regard a
string as a format string though it is not used in a printf-like
function and so
msgfmt might report errors where there are none. Or the other way
round: a
string is not regarded as a format string but it is used in a
printf-like function.
So solve this problem the programmer can dictate the decision to the
xgettext
program (see Section 3.4 [c-format], page 21). The translator should
not con-
sider removing the flag from the h #, i line. This "fix" would be
reversed again
as soon as msgmerge is called the next time.