After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 792630 - Untranslated message when enrolling fingerprints
Untranslated message when enrolling fingerprints
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: User Accounts
3.26.x
Other All
: Normal normal
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-01-18 03:12 UTC by Piotr Drąg
Modified: 2018-02-06 13:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Screenshot of the problem (28.58 KB, image/png)
2018-01-18 03:12 UTC, Piotr Drąg
  Details
user-accounts: Update fingerprint strings from fprintd (6.88 KB, patch)
2018-02-06 10:27 UTC, Bastien Nocera
none Details | Review
user-accounts: Don't translate fprintd copy/paste (681 bytes, patch)
2018-02-06 10:27 UTC, Bastien Nocera
committed Details | Review
user-accounts: Update fingerprint strings from fprintd (8.84 KB, patch)
2018-02-06 10:34 UTC, Bastien Nocera
none Details | Review
user-accounts: Update strings from libfprint to fix translations (8.70 KB, patch)
2018-02-06 10:45 UTC, Ondrej Holy
none Details | Review
Add fingerprint-strings.h in POTFILES.skip again (685 bytes, patch)
2018-02-06 10:45 UTC, Ondrej Holy
none Details | Review
user-accounts: Update fingerprint strings from fprintd (9.02 KB, patch)
2018-02-06 13:21 UTC, Bastien Nocera
committed Details | Review

Description Piotr Drąg 2018-01-18 03:12:59 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
Comment 1 Ondrej Holy 2018-01-24 16:11:21 UTC
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...
Comment 2 Piotr Drąg 2018-01-24 16:18:01 UTC
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.
Comment 3 Ondrej Holy 2018-01-25 08:28:46 UTC
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
Comment 4 Piotr Drąg 2018-01-25 14:18:31 UTC
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)?
Comment 5 Ondrej Holy 2018-01-26 09:08:31 UTC
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?
Comment 6 Piotr Drąg 2018-02-02 18:01:22 UTC
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?
Comment 7 Bastien Nocera 2018-02-06 09:14:13 UTC
(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.
Comment 8 Ondrej Holy 2018-02-06 10:06:11 UTC
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...
Comment 9 Bastien Nocera 2018-02-06 10:27:09 UTC
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.
Comment 10 Bastien Nocera 2018-02-06 10:27:14 UTC
Created attachment 367942 [details] [review]
user-accounts: Don't translate fprintd copy/paste

We pull the translations directly from fprintd.
Comment 11 Bastien Nocera 2018-02-06 10:34:40 UTC
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.
Comment 12 Ondrej Holy 2018-02-06 10:45:05 UTC
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.
Comment 13 Ondrej Holy 2018-02-06 10:45:11 UTC
Created attachment 367947 [details] [review]
Add fingerprint-strings.h in POTFILES.skip again

The translations for those strings comes from libfprint.
Comment 14 Ondrej Holy 2018-02-06 11:37:27 UTC
Review of attachment 367942 [details] [review]:

Ok
Comment 15 Ondrej Holy 2018-02-06 11:37:52 UTC
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
Comment 16 Ondrej Holy 2018-02-06 11:41:46 UTC
(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);
Comment 17 Bastien Nocera 2018-02-06 13:21:10 UTC
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.
Comment 18 Bastien Nocera 2018-02-06 13:22:19 UTC
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
Comment 19 Ondrej Holy 2018-02-06 13:36:50 UTC
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?
Comment 20 Bastien Nocera 2018-02-06 13:40:58 UTC
> 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
$