fix: translate messages in admin prompts
This commit is contained in:
1 parent
b9c3b324a3
commit
8d11676740
3 files changed
+40
-22
No files matched your search
@@ -7,7 +7,7 @@ msgstr ""
|
||||
"Project-Id-Version: plasma-face-unlock 1.0.0\n"
|
||||
"Report-Msgid-Bugs-To: https://github.com/LoonixTools/plasma-face-unlock/"
|
||||
"issues\n"
|
||||
"POT-Creation-Date: 2026-09-24 01:31+0200\n"
|
||||
"POT-Creation-Date: 2026-09-24 10:37+0200\n"
|
||||
"PO-Revision-Date: 2026-09-23 22:32+0200\n"
|
||||
"Last-Translator: Felitendo\n"
|
||||
"Language-Team: German\n"
|
||||
@@ -434,11 +434,11 @@ msgstr "alle ausgeschaltet"
|
||||
msgid "none found"
|
||||
msgstr "keine gefunden"
|
||||
|
||||
#: src/lib/menu.sh:233 /tmp/tmp.3ElRvSMg8S/settings.sh:12
|
||||
#: src/lib/menu.sh:233 /tmp/tmp.bBbo63fNu2/settings.sh:12
|
||||
msgid "Camera"
|
||||
msgstr "Kamera"
|
||||
|
||||
#: src/lib/menu.sh:235 /tmp/tmp.3ElRvSMg8S/settings.sh:1
|
||||
#: src/lib/menu.sh:235 /tmp/tmp.bBbo63fNu2/settings.sh:1
|
||||
msgid "Lock screen"
|
||||
msgstr "Sperrbildschirm"
|
||||
|
||||
@@ -446,11 +446,11 @@ msgstr "Sperrbildschirm"
|
||||
msgid "sudo"
|
||||
msgstr "sudo"
|
||||
|
||||
#: src/lib/menu.sh:237 /tmp/tmp.3ElRvSMg8S/settings.sh:7
|
||||
#: src/lib/menu.sh:237 /tmp/tmp.bBbo63fNu2/settings.sh:7
|
||||
msgid "Admin prompts"
|
||||
msgstr "Admin-Abfragen"
|
||||
|
||||
#: src/lib/menu.sh:238 /tmp/tmp.3ElRvSMg8S/settings.sh:9
|
||||
#: src/lib/menu.sh:238 /tmp/tmp.bBbo63fNu2/settings.sh:9
|
||||
msgid "Photo check"
|
||||
msgstr "Foto-Prüfung"
|
||||
|
||||
@@ -878,21 +878,21 @@ msgstr "Die Animationen der Bubble einmal abspielen."
|
||||
msgid "Bubble style for the demo: full or minimal."
|
||||
msgstr "Bubble-Stil für die Demo: full oder minimal."
|
||||
|
||||
#: src/pam/pam_plasma_face_unlock.c:293
|
||||
#: src/pam/pam_plasma_face_unlock.c:311
|
||||
msgid "Look at the camera to unlock."
|
||||
msgstr "Schau zum Entsperren in die Kamera."
|
||||
|
||||
#: src/pam/pam_plasma_face_unlock.c:296
|
||||
#: src/pam/pam_plasma_face_unlock.c:314
|
||||
msgid "Blink, or turn your head a little."
|
||||
msgstr "Blinzle oder dreh den Kopf ein wenig."
|
||||
|
||||
#: src/pam/pam_plasma_face_unlock.c:312
|
||||
#: src/pam/pam_plasma_face_unlock.c:330
|
||||
msgid "Face unlock is paused after too many tries. Use your password."
|
||||
msgstr ""
|
||||
"Die Gesichtsentsperrung ist nach zu vielen Versuchen pausiert. Nutze dein "
|
||||
"Passwort."
|
||||
|
||||
#: src/pam/pam_plasma_face_unlock.c:316
|
||||
#: src/pam/pam_plasma_face_unlock.c:334
|
||||
msgid "Face not recognised."
|
||||
msgstr "Gesicht nicht erkannt."
|
||||
|
||||
|
||||
+10
-10
@@ -5,10 +5,10 @@
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: plasma-face-unlock 1.0.0\n"
|
||||
"Project-Id-Version: plasma-face-unlock 1.0.1\n"
|
||||
"Report-Msgid-Bugs-To: https://github.com/LoonixTools/plasma-face-unlock/"
|
||||
"issues\n"
|
||||
"POT-Creation-Date: 2026-09-24 01:31+0200\n"
|
||||
"POT-Creation-Date: 2026-09-24 10:37+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@@ -417,11 +417,11 @@ msgstr ""
|
||||
msgid "none found"
|
||||
msgstr ""
|
||||
|
||||
#: src/lib/menu.sh:233 /tmp/tmp.3ElRvSMg8S/settings.sh:12
|
||||
#: src/lib/menu.sh:233 /tmp/tmp.bBbo63fNu2/settings.sh:12
|
||||
msgid "Camera"
|
||||
msgstr ""
|
||||
|
||||
#: src/lib/menu.sh:235 /tmp/tmp.3ElRvSMg8S/settings.sh:1
|
||||
#: src/lib/menu.sh:235 /tmp/tmp.bBbo63fNu2/settings.sh:1
|
||||
msgid "Lock screen"
|
||||
msgstr ""
|
||||
|
||||
@@ -429,11 +429,11 @@ msgstr ""
|
||||
msgid "sudo"
|
||||
msgstr ""
|
||||
|
||||
#: src/lib/menu.sh:237 /tmp/tmp.3ElRvSMg8S/settings.sh:7
|
||||
#: src/lib/menu.sh:237 /tmp/tmp.bBbo63fNu2/settings.sh:7
|
||||
msgid "Admin prompts"
|
||||
msgstr ""
|
||||
|
||||
#: src/lib/menu.sh:238 /tmp/tmp.3ElRvSMg8S/settings.sh:9
|
||||
#: src/lib/menu.sh:238 /tmp/tmp.bBbo63fNu2/settings.sh:9
|
||||
msgid "Photo check"
|
||||
msgstr ""
|
||||
|
||||
@@ -826,19 +826,19 @@ msgstr ""
|
||||
msgid "Bubble style for the demo: full or minimal."
|
||||
msgstr ""
|
||||
|
||||
#: src/pam/pam_plasma_face_unlock.c:293
|
||||
#: src/pam/pam_plasma_face_unlock.c:311
|
||||
msgid "Look at the camera to unlock."
|
||||
msgstr ""
|
||||
|
||||
#: src/pam/pam_plasma_face_unlock.c:296
|
||||
#: src/pam/pam_plasma_face_unlock.c:314
|
||||
msgid "Blink, or turn your head a little."
|
||||
msgstr ""
|
||||
|
||||
#: src/pam/pam_plasma_face_unlock.c:312
|
||||
#: src/pam/pam_plasma_face_unlock.c:330
|
||||
msgid "Face unlock is paused after too many tries. Use your password."
|
||||
msgstr ""
|
||||
|
||||
#: src/pam/pam_plasma_face_unlock.c:316
|
||||
#: src/pam/pam_plasma_face_unlock.c:334
|
||||
msgid "Face not recognised."
|
||||
msgstr ""
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <libintl.h>
|
||||
#include <locale.h>
|
||||
#include <poll.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
@@ -49,7 +50,8 @@
|
||||
#endif
|
||||
|
||||
#define DOMAIN PFU_NAME
|
||||
#define _(s) dgettext(DOMAIN, s)
|
||||
// Marks a message for translation. say() translates it.
|
||||
#define _(s) (s)
|
||||
|
||||
struct options {
|
||||
const char *socket;
|
||||
@@ -200,10 +202,26 @@ static bool json_true(const char *line, const char *key)
|
||||
return strstr(line, pattern) != NULL;
|
||||
}
|
||||
|
||||
// Admin prompts run this in polkit's helper. It keeps LANG but never calls
|
||||
// setlocale, so gettext would stay in English. Take the language from the
|
||||
// environment for this thread while the message goes out.
|
||||
static void say(pam_handle_t *pamh, int flags, const char *message)
|
||||
{
|
||||
if (!(flags & PAM_SILENT)) {
|
||||
pam_info(pamh, "%s", message);
|
||||
if (flags & PAM_SILENT) {
|
||||
return;
|
||||
}
|
||||
locale_t loc = (locale_t)0, old = (locale_t)0;
|
||||
const char *global = setlocale(LC_MESSAGES, NULL);
|
||||
if (!global || strcmp(global, "C") == 0 || strcmp(global, "POSIX") == 0) {
|
||||
loc = newlocale(LC_MESSAGES_MASK, "", (locale_t)0);
|
||||
if (loc) {
|
||||
old = uselocale(loc);
|
||||
}
|
||||
}
|
||||
pam_info(pamh, "%s", dgettext(DOMAIN, message));
|
||||
if (loc) {
|
||||
uselocale(old);
|
||||
freelocale(loc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user