Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3c78e05

Browse files
committed
Refactor Windows error message for easier translation
In the error messages referring to the user right "Lock pages in memory", this is a term from the Windows OS, so it should be translated in accordance with the OS localization. Refactor the error messages so this is easier and clearer. Also fix the capitalization to match the existing capitalization in the OS.
1 parent 5128483 commit 3c78e05

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

doc/src/sgml/config.sgml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1593,14 +1593,14 @@ include_dir 'conf.d'
15931593

15941594
<para>
15951595
Huge pages are known as large pages on Windows. To use them, you need to
1596-
assign the user right Lock Pages in Memory to the Windows user account
1596+
assign the user right <quote>Lock pages in memory</quote> to the Windows user account
15971597
that runs <productname>PostgreSQL</productname>.
15981598
You can use Windows Group Policy tool (gpedit.msc) to assign the user right
1599-
Lock Pages in Memory.
1599+
<quote>Lock pages in memory</quote>.
16001600
To start the database server on the command prompt as a standalone process,
16011601
not as a Windows service, the command prompt must be run as an administrator or
16021602
User Access Control (UAC) must be disabled. When the UAC is enabled, the normal
1603-
command prompt revokes the user right Lock Pages in Memory when started.
1603+
command prompt revokes the user right <quote>Lock pages in memory</quote> when started.
16041604
</para>
16051605

16061606
<para>

src/backend/port/win32_shmem.c

+10-6
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,18 @@ EnableLockPagesPrivilege(int elevel)
141141
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
142142
{
143143
ereport(elevel,
144-
(errmsg("could not enable Lock Pages in Memory user right: error code %lu", GetLastError()),
144+
(errmsg("could not enable user right \"%s\": error code %lu",
145+
/* translator: This is a term from Windows and should be translated to match the Windows localization. */
146+
_("Lock pages in memory"),
147+
GetLastError()),
145148
errdetail("Failed system call was %s.", "OpenProcessToken")));
146149
return FALSE;
147150
}
148151

149152
if (!LookupPrivilegeValue(NULL, SE_LOCK_MEMORY_NAME, &luid))
150153
{
151154
ereport(elevel,
152-
(errmsg("could not enable Lock Pages in Memory user right: error code %lu", GetLastError()),
155+
(errmsg("could not enable user right \"%s\": error code %lu", _("Lock pages in memory"), GetLastError()),
153156
errdetail("Failed system call was %s.", "LookupPrivilegeValue")));
154157
CloseHandle(hToken);
155158
return FALSE;
@@ -161,7 +164,7 @@ EnableLockPagesPrivilege(int elevel)
161164
if (!AdjustTokenPrivileges(hToken, FALSE, &tp, 0, NULL, NULL))
162165
{
163166
ereport(elevel,
164-
(errmsg("could not enable Lock Pages in Memory user right: error code %lu", GetLastError()),
167+
(errmsg("could not enable user right \"%s\": error code %lu", _("Lock pages in memory"), GetLastError()),
165168
errdetail("Failed system call was %s.", "AdjustTokenPrivileges")));
166169
CloseHandle(hToken);
167170
return FALSE;
@@ -172,11 +175,12 @@ EnableLockPagesPrivilege(int elevel)
172175
if (GetLastError() == ERROR_NOT_ALL_ASSIGNED)
173176
ereport(elevel,
174177
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
175-
errmsg("could not enable Lock Pages in Memory user right"),
176-
errhint("Assign Lock Pages in Memory user right to the Windows user account which runs PostgreSQL.")));
178+
errmsg("could not enable user right \"%s\"", _("Lock pages in memory")),
179+
errhint("Assign user right \"%s\" to the Windows user account which runs PostgreSQL.",
180+
_("Lock pages in memory"))));
177181
else
178182
ereport(elevel,
179-
(errmsg("could not enable Lock Pages in Memory user right: error code %lu", GetLastError()),
183+
(errmsg("could not enable user right \"%s\": error code %lu", _("Lock pages in memory"), GetLastError()),
180184
errdetail("Failed system call was %s.", "AdjustTokenPrivileges")));
181185
CloseHandle(hToken);
182186
return FALSE;

0 commit comments

Comments
 (0)