GNOME Bugzilla – Bug 792630
Untranslated message when enrolling fingerprints
Last modified: 2018-02-06 13:40:58 UTC
Created attachment 366984 [details] Screenshot of the problem A message telling the user to enroll fingerprints is displayed always in English. That message comes from fprintd. fprintd-0.8.0-1.fc27.x86_64 control-center-3.26.2-2.fc27.x86_64
It seems that the messages doesn't come from fprintd and we should have translations for them: https://git.gnome.org/browse/gnome-control-center/tree/panels/user-accounts/fingerprint-strings.h The strings are marked with N_() and "#define TR(s) dgettext("fprintd", s)" is used to show them, but something is probably wrong with it...
The file wasn’t listed in POTFILES.in, for one: https://git.gnome.org/browse/gnome-control-center/commit/?id=12cab686cbfa4c7036fadfb0b5d7abde468bf72e I don’t know if this (+ adding translations) is enough to fix it.
I am surprised that some languages already have translations for those strings: $ git grep "Swipe your right index" -- po | cut -d : -f 1 | sort | tr '\n' ' ' po/as.po po/be@latin.po po/bn.po po/crh.po po/en_GB.po po/en_GB.po po/en@shaw.po po/es.po po/he.po po/mai.po po/ml.po po/mr.po po/nds.po po/or.po po/pa.po po/ta.po po/th.po po/uz@cyrillic.po po/uz.po $ git grep -A1 "Swipe your right index" -- po/be* po/be@latin.po:msgid "Swipe your right index finger on %s" po/be@latin.po-msgstr "Paciahni svaim pravym pakazalnikam pa %s" but it seems it is not enough even with your patch: LANG=be_BY@latin jhbuild run gnome-control-center user-accounts
These translations are from the good ol’ times of capplets and menus: #: ../capplets/about-me/fingerprint-strings.h:34 #, c-format msgid "Swipe your right index finger on %s" msgstr "Paciahni svaim pravym pakazalnikam pa %s" During the 3.0 reorganization, this file was put in POTFILES.skip: https://git.gnome.org/browse/gnome-control-center/commit/?id=bf5cb4401669f4881bb7191ecbbcc957ef456950 I’ve removed it from there now. Could you try again, but replacing po/be@latin.po with https://l10n.gnome.org/POT/gnome-control-center.master/gnome-control-center.master.be@latin.po (so that the .po file is up to date)?
Hmm, it would need the following change to make it work: diff --git a/panels/user-accounts/um-fingerprint-dialog.c b/panels/user-accounts/um-fingerprint-dialog.c index 66c470078..92da77e28 100644 --- a/panels/user-accounts/um-fingerprint-dialog.c +++ b/panels/user-accounts/um-fingerprint-dialog.c @@ -33 +33 @@ -#define TR(s) dgettext("fprintd", s) +#define TR(s) dgettext(GETTEXT_PACKAGE, s) @@ -744,2 +744,2 @@ fingerprint_button_clicked (GtkWindow *parent, - bindtextdomain ("fprintd", GNOMELOCALEDIR); - bind_textdomain_codeset ("fprintd", "UTF-8"); + bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); But I've realized that the fingerprint-strings.h is copy-and-pasted from fprintd project and that it is probably expected to use translations from fprintd, but it obviously doesn't work for some reason. Bastien, how this is expected to work? Any idea what is wrong?
So do I understand correctly that having fingerprint-strings.h translatable in gnome-control-center is wasting translators’ efforts? If so, why is it in-tree?
(In reply to Piotr Drąg from comment #6) > So do I understand correctly that having fingerprint-strings.h translatable > in gnome-control-center is wasting translators’ efforts? If so, why is it > in-tree? Yes. What's the problem with it being in-tree? fprintd doesn't have a library. (In reply to Ondrej Holy from comment #5) > Hmm, it would need the following change to make it work: > diff --git a/panels/user-accounts/um-fingerprint-dialog.c > b/panels/user-accounts/um-fingerprint-dialog.c > index 66c470078..92da77e28 100644 > --- a/panels/user-accounts/um-fingerprint-dialog.c > +++ b/panels/user-accounts/um-fingerprint-dialog.c > @@ -33 +33 @@ > -#define TR(s) dgettext("fprintd", s) > +#define TR(s) dgettext(GETTEXT_PACKAGE, s) > @@ -744,2 +744,2 @@ fingerprint_button_clicked (GtkWindow *parent, > - bindtextdomain ("fprintd", GNOMELOCALEDIR); > - bind_textdomain_codeset ("fprintd", "UTF-8"); > + bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); > + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); > > But I've realized that the fingerprint-strings.h is copy-and-pasted from > fprintd project and that it is probably expected to use translations from > fprintd, but it obviously doesn't work for some reason. Bastien, how this is > expected to work? Any idea what is wrong? Yes, you need to have the fprintd translations installed in the same prefix as g-c-c, so that gettext can find the translations. Or change the bindtextdomain("fprintd")'s second parameter to match your installation.
Thanks for the comment, Bastien. I've finally realized what is wrong. The strings were slightly changed in fprintd (before 6 years!), from "Swipe your ??? on %s" to "Swipe your ??? across %s". That's why they are untranslated currently. So fingerprint-strings.h should be put in POTFILES.skip again and needs to be updated from fprintd...
Created attachment 367941 [details] [review] user-accounts: Update fingerprint strings from fprintd Meaning that the strings used in the User Accounts panel should now match the ones used in fprintd, and thus be translated.
Created attachment 367942 [details] [review] user-accounts: Don't translate fprintd copy/paste We pull the translations directly from fprintd.
Created attachment 367944 [details] [review] user-accounts: Update fingerprint strings from fprintd Meaning that the strings used in the User Accounts panel should now match the ones used in fprintd, and thus be translated.
Created attachment 367946 [details] [review] user-accounts: Update strings from libfprint to fix translations The strings were updated in libfprint in the meantime and thus have been untranslated in gnome-control-center. Let's update fingerprint-strings.h to fix the translations.
Created attachment 367947 [details] [review] Add fingerprint-strings.h in POTFILES.skip again The translations for those strings comes from libfprint.
Review of attachment 367942 [details] [review]: Ok
Review of attachment 367944 [details] [review]: ::: panels/user-accounts/fingerprint-strings.h @@ -63,3 @@ * verify-unknown-error */ -G_GNUC_UNUSED static const char *verify_result_str_to_msg(const char *result, gboolean is_swipe) G_GNUC_UNUSED used to be there to prevent warnings that this function is not used in our code... Probably best to add something like: #pragma GCC diagnostic ignored "-Wunused-function" before: #include "fingerprint-strings.h" in order to not touch copy&pasted file. ::: panels/user-accounts/um-fingerprint-dialog.c @@ +32,2 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-nonliteral" I suppose that those pragmas can be removed, because they are part of fingerprint-strings.h now
(In reply to Ondrej Holy from comment #15) > Review of attachment 367944 [details] [review] [review]: > > ::: panels/user-accounts/fingerprint-strings.h > @@ -63,3 @@ > * verify-unknown-error > */ > -G_GNUC_UNUSED static const char *verify_result_str_to_msg(const char > *result, gboolean is_swipe) > > G_GNUC_UNUSED used to be there to prevent warnings that this function is not > used in our code... > > Probably best to add something like: > #pragma GCC diagnostic ignored "-Wunused-function" > before: > #include "fingerprint-strings.h" > in order to not touch copy&pasted file. or add just declaration with G_GNUC_UNUSED: G_GNUC_UNUSED static const char *verify_result_str_to_msg(const char *result, gboolean is_swipe);
Created attachment 367956 [details] [review] user-accounts: Update fingerprint strings from fprintd Meaning that the strings used in the User Accounts panel should now match the ones used in fprintd, and thus be translated.
Attachment 367942 [details] pushed as 0953681 - user-accounts: Don't translate fprintd copy/paste Attachment 367956 [details] pushed as 9e6bed4 - user-accounts: Update fingerprint strings from fprintd
Review of attachment 367956 [details] [review]: I am too late, but... ::: panels/user-accounts/fingerprint-strings.h @@ +89,3 @@ +#pragma GCC diagnostic ignored "-Wformat-nonliteral" + +G_GNUC_UNUSED static char *finger_str_to_msg(const char *finger_name, const char *driver_name, gboolean is_swipe) finger_str_to_msg is not unused, so G_GNUC_UNUSED should not be here. @@ +148,3 @@ * enroll-unknown-error */ +G_GNUC_UNUSED static const char *enroll_result_str_to_msg(const char *result, gboolean is_swipe) Wouldn't be better to not touch this copy&pasted file at all and use one suggestion from Comment 15, or Comment 16 instead?
> Wouldn't be better to not touch this copy&pasted file at all and use one > suggestion from Comment 15, or Comment 16 instead? Not sure what to say: $ diff -up panels/user-accounts/fingerprint-strings.h ../fprintd/pam/fingerprint-strings.h $