File: translations.html

package info (click to toggle)
libpgjava 42.2.5-2%2Bdeb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 8,136 kB
  • sloc: java: 57,821; xml: 1,135; sh: 307; perl: 99; makefile: 7
file content (132 lines) | stat: -rw-r--r-- 5,167 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
---
layout: default
title: PostgreSQL JDBC Translations
resource: ../media
nav: ../
---

{% include submenu_development.html %}

				<div id="pgContentWrap">
					<h1>Translations</h1>
					<hr />
					<div>
						<ul>
							<li><a href="#overview">Overview</a></li>
							<li><a href="#devlopers">Developers</a></li>
							<li><a href="#translators">Translators</a></li>
							<li><a href="#maintainers">Maintainers</a></li>
						</ul>
					</div>
					<hr />

					<a name="overview"></a>
					<h2 class="underlined_10">Overview</h2>
					<div>
						<p>
							Translations of driver specific error messages are available in a
							number of languages.  The following information is about how to
							update an existing translation or to provide a translation to a new
							language.
						</p>
						<p>
							The translations are done using the
							<a href="http://www.gnu.org/software/gettext/gettext.html" target="_blank">GNU gettext</a>
							tools.  These are not required to build or use the driver, only
							translators and maintainers need them.
						</p>
					</div>
					<hr />

					<a name="devlopers"></a>
					<h2 class="underlined_10">Developers</h2>
					<div>
						<p>
							When writing code for the driver you need to specially mark strings
							for translation so they are picked up by the tools.  In general any
							user visible message should be made available for translation.
							Strings are marked using the <a href="privateapi/org/postgresql/util/GT.html">GT.tr</a>
							method.  The name means "gettext translate", but
							a shorter name was wanted because this shows up in a lot of places.
						</p>
						<p>
							To provide context sensitive information the standard Java
							<a href="http://java.sun.com/j2se/1.4.2/docs/api/java/text/MessageFormat.html" target="_blank">MessageFormat</a>
							syntax is used in the error messages.  Consider, for example,
							the error message for calling ResultSet.getInt() with an invalid
							column number, we want to helpfully report the column asked for and
							the number of columns in the ResultSet.
						</p>
						<pre style="font-family: serif;">
if (column &lt; 1 || column &gt; fields.length) {
	String err = GT.tr(
		"The column index requested: {0} is out of range.",
		new Integer(column)
		);
	throw new PSQLException(err, PSQLState.INVALID_PARAMETER_VALID);
}
						</pre>
					</div>
					<hr />

					<a name="translators"></a>
					<h2 class="underlined_10">Translators</h2>
					<div>
						<p>
							Check the current <a href="status.html">translation status</a>
							page to see if an existing translation exists for your language,
							so you can update that instead of starting from
							scratch.  To start a new translation you can download the template
							file and work on that instead.
						</p>
						<p>
							Editing the .po file is a pretty straightforward process and a number
							of tools exist to aid you in the process:
						</p>
						<ul>
							<li>GNU Emacs and XEmacs have PO editing modes.</li>
							<li>
								<a href="http://freecode.com/projects/kbabel" target="_blank">KBabel</a>
								is a KDE-based editing tool.
							</li>
							<li>
								<a href="http://poedit.sourceforge.net/" target="_blank">poEdit</a>
								is another tool which can run on Windows.
							</li>
						</ul>
						<p>
							Once you feel the translation is accurate and complete (or you get
							tired), verify that the file by running <span class="codefrag">msgfmt</span>.
						</p>
						<pre style="font-family: serif;">
msgfmt -c -v -o /dev/null pofile
						</pre>
						<p>
							If everything checks out send the po file on over to the
							<a href="mailto:pgsql-jdbc@postgresql.org">pgsql-jdbc@postgresql.org</a>
							mailing list.  This list does have a size limit of 30k, so you will
							need to compress the po file before sending it.
						</p>
					</div>
					<hr />

					<a name="maintainers"></a>
					<h2 class="underlined_10">Maintainers</h2>
					<div>
						<p>
							To avoid requiring the gettext tools to compile the driver the
							decision has been made to directly check in the compiled message
							catalogs to the git repository.  When you get a new or updated
							translation, first ensure that it is valid by running the
							<span style="font-family: Courier New,Courier,monospace;">msgfmt</span> command mentioned in the translators section.
							If this looks correct drop it into the
							<span style="font-family: Courier New,Courier,monospace;">src/org/postgresql/translation</span>
							directory and run the <span class="codefrag">update-translations.sh</span> script
							in the top level directory.  This will produce the compiled class
							file that contains the translated messages.  Then simply check in
							both the .po and .class files. Be sure to only commit changes to the
							translations you've modified because the <span style="font-family: Courier New,Courier,monospace;">update-translations.sh</span>
							script modifies all the translations.
						</p>
					</div>
				</div> <!-- pgContentWrap -->