Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
edcf9c23
Commit
edcf9c23
authored
May 19, 2003
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add error message style guidelines to the SGML documentation.
parent
9ecba0c2
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
626 additions
and
20 deletions
+626
-20
doc/src/sgml/nls.sgml
doc/src/sgml/nls.sgml
+34
-17
doc/src/sgml/sources.sgml
doc/src/sgml/sources.sgml
+592
-3
No files found.
doc/src/sgml/nls.sgml
View file @
edcf9c23
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/nls.sgml,v 1.5 2002/10/30 05:14:32 momjian Exp $ -->
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/nls.sgml,v 1.6 2003/05/19 21:38:23 tgl Exp $
-->
<chapter id="nls">
<docinfo>
...
...
@@ -241,20 +243,20 @@ gmake update-po
<listitem>
<para>
If the original is a
printf format string, the translation also
needs to be. The translation also needs to have the same
If the original is a
<function>printf</> format string, the translation
also
needs to be. The translation also needs to have the same
format specifiers in the same order. Sometimes the natural
rules of the language make this impossible or at least awkward.
In th
is case you can use this format
:
In th
at case you can modify the format specifiers like this
:
<programlisting>
msgstr "Die Datei %2$s hat %1$u Zeichen."
</programlisting>
Then the first placeholder will actually use the second
argument from the list. The
<literal><replaceable>digits</replaceable>$</literal> needs to
follow the %
and come
before any other format manipulators.
follow the %
immediately,
before any other format manipulators.
(This feature really exists in the <function>printf</function>
family of functions. You may not have heard of it because
family of functions. You may not have heard of it be
fore be
cause
there is little use for it outside of message
internationalization.)
</para>
...
...
@@ -279,6 +281,7 @@ msgstr "Die Datei %2$s hat %1$u Zeichen."
open file %s</literal>) should probably not start with a
capital letter (if your language distinguishes letter case) or
end with a period (if your language uses punctuation marks).
It may help to read <xref linkend="error-style-guide">.
</para>
</listitem>
...
...
@@ -301,8 +304,11 @@ msgstr "Die Datei %2$s hat %1$u Zeichen."
<sect1 id="nls-programmer">
<title>For the Programmer</title>
<sect2 id="nls-mechanics">
<title>Mechanics</title>
<para>
This section describes how to
suppor
t native language support in a
This section describes how to
implemen
t native language support in a
program or library that is part of the
<productname>PostgreSQL</> distribution.
Currently, it only applies to C programs.
...
...
@@ -348,15 +354,15 @@ fprintf(stderr, gettext("panic level %d\n"), lvl);
</para>
<para>
This may tend to add a lot of clutter. One common shortcut is to
This may tend to add a lot of clutter. One common shortcut is to
use
<programlisting>
#define _(x) gettext(
(x)
)
#define _(x) gettext(
x
)
</programlisting>
Another solution is feasible if the program does much of its
communication through one or a few functions, such as
<function>e
log
()</function> in the backend. Then you make this
<function>e
report
()</function> in the backend. Then you make this
function call <function>gettext</function> internally on all
input
value
s.
input
string
s.
</para>
</step>
...
...
@@ -430,19 +436,29 @@ fprintf(stderr, gettext("panic level %d\n"), lvl);
The build system will automatically take care of building and
installing the message catalogs.
</para>
</sect2>
<sect2 id="nls-guidelines">
<title>Message-writing guidelines</title>
<para>
To ease the translation of messages, here are some guidelines:
Here are some guidelines for writing messages that are easily
translatable.
<itemizedlist>
<listitem>
<para>
Do not construct sentences at run-time
out of laziness
, like
Do not construct sentences at run-time, like
<programlisting>
printf("Files w
h
ere %s.\n", flag ? "copied" : "removed");
printf("Files were %s.\n", flag ? "copied" : "removed");
</programlisting>
The word order within the sentence may be different in other
languages.
languages. Also, even if you remember to call gettext() on each
fragment, the fragments may not translate well separately. It's
better to duplicate a little code so that each message to be
translated is a coherent whole. Only numbers, file names, and
such-like run-time variables should be inserted at runtime into
a message text.
</para>
</listitem>
...
...
@@ -462,8 +478,8 @@ else
</programlisting>
then be disappointed. Some languages have more than two forms,
with some peculiar rules. We may have a solution for this in
the future, but for now th
is is best avoided altogether. You
could write:
the future, but for now th
e matter is best avoided altogether.
You
could write:
<programlisting>
printf("number of copied files: %d", n);
</programlisting>
...
...
@@ -485,6 +501,7 @@ printf("number of copied files: %d", n);
</listitem>
</itemizedlist>
</para>
</sect2>
</sect1>
</chapter>
doc/src/sgml/sources.sgml
View file @
edcf9c23
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment