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 793040 - Use upstream gettext instead of intltool
Use upstream gettext instead of intltool
Status: RESOLVED FIXED
Product: iagno
Classification: Applications
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: iagno-maint
iagno-maint
Depends on:
Blocks:
 
 
Reported: 2018-01-30 22:08 UTC by Robert Roth
Modified: 2018-02-01 01:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use gettext (bgo#793040) (10.75 KB, patch)
2018-01-30 23:02 UTC, Robert Roth
committed Details | Review
user-accounts: Fix definition of MAXNAMELEN (2.86 KB, patch)
2018-01-31 21:11 UTC, Michael Catanzaro
none Details | Review

Description Robert Roth 2018-01-30 22:08:20 UTC
As part of https://wiki.gnome.org/Initiatives/GnomeGoals/GettextMigration, get rid of intltool, use gettext.
Comment 1 Robert Roth 2018-01-30 23:02:56 UTC
Created attachment 367666 [details] [review]
Use gettext (bgo#793040)
Comment 2 Robert Roth 2018-01-30 23:06:18 UTC
Attached a partial patch (all the usual steps are done), but it fails at pot-update due to a strange error message in the po directory (might be related to the themes files, which have been translated as ini files with intltool, the patch tries to translate them as desktop files - the only tag which exists in desktop files and is translatable is Name, so it should be fine)
Makefile:255: *** target pattern contains no '%'.  Stop.

Attaching the work-in-progress, maybe someone can easily find the reason for pot-update failing and doesn't have to redo the full gettext migration, but fix a small issue.
Comment 3 Michael Catanzaro 2018-01-31 00:23:40 UTC
Review of attachment 367666 [details] [review]:

::: po/POTFILES.in
@@ +3,1 @@
 [encoding: UTF-8]

Allow me to translate the error message: you have to remove [encoding: UTF-8] from POTFILES.in.

Historical record: https://blogs.gnome.org/mcatanzaro/2016/07/27/on-the-killing-of-intltool/
Comment 4 Robert Roth 2018-01-31 07:04:42 UTC
(In reply to Michael Catanzaro from comment #3)
> Review of attachment 367666 [details] [review] [review]:
> 
> ::: po/POTFILES.in
> @@ +3,1 @@
>  [encoding: UTF-8]
> 
> Allow me to translate the error message: you have to remove [encoding:
> UTF-8] from POTFILES.in.
> 
> Historical record:
> https://blogs.gnome.org/mcatanzaro/2016/07/27/on-the-killing-of-intltool/

Thanks for the tip, it solved the problem, read your post, also updated git.mk. Iagno gettext porting is complete, pushed to master, marking as fixed.

This problem has been fixed in the unstable development version. The fix will be available in the next major software release. You may need to upgrade your Linux distribution to obtain that newer version.
Comment 5 Piotr Drąg 2018-01-31 15:14:15 UTC
Damned Lies can’t extract .theme files (see https://l10n.gnome.org/module/iagno/#master), and locally I get these:

$ ./make-pot 
xgettext: warning: file 'data/themes/adwaita.theme.in' extension 'theme' is unknown; will try C
xgettext: warning: file 'data/themes/classic.theme.in' extension 'theme' is unknown; will try C
xgettext: warning: file 'data/themes/high_contrast.theme.in' extension 'theme' is unknown; will try C
xgettext: warning: file 'data/themes/sun_and_star.theme.in' extension 'theme' is unknown; will try C
Comment 6 Robert Roth 2018-01-31 17:50:47 UTC
This is something we will have to figure out how to handle generically, maybe @mcatanzaro has some ideas:
* xgettext doesn't know the .theme format, and it does guess based on extension, but it doesn't work, as the error messages state
* even though the build does specify to use the desktop format, damned-lies doesn't configure and build, just tries to make a pot file, which fails due to the above errors.

Currently the possible solutions we managed to find with Piotr are:
* rename the .themes files to .desktop, making xgettext on damned-lies think it knows the format
* convert the themes to an XML-based format, and use an its file for specifying the format to xgettext (although I'm not sure if the its file gets installed by the build, and d-l still wants to make pot without build, which it does). so maybe this doesn't even help, unless the its file gets installed by default

Renaming to desktop was an ugly hack which I did, but I would still choose another solution if there is one. This is something we might need for other games' themeable names too.
Comment 7 Piotr Drąg 2018-01-31 18:01:24 UTC
(In reply to Robert Roth from comment #6)
> * convert the themes to an XML-based format, and use an its file for
> specifying the format to xgettext (although I'm not sure if the its file
> gets installed by the build, and d-l still wants to make pot without build,
> which it does). so maybe this doesn't even help, unless the its file gets
> installed by default
> 

Damned Lies can read extra .its/.loc files from git.
Comment 8 Robert Roth 2018-01-31 18:20:26 UTC
Yet another round of renaming from .theme.in to .theme.desktop.in, so that the installed files will still be .theme, but for translations gettext will know to use the desktop format. (Inspired by how eog plugins handle translations). This seems like the best fix for now.

Marking as fixed again, but we will surely have to come up with a better way of handling translatable theme descriptors (and probably theming also), but will take this request to another bug reported agains libgnome-games-support probably (to have themes support just as we have scores support there).
Comment 9 Michael Catanzaro 2018-01-31 21:11:36 UTC
Created attachment 367735 [details] [review]
user-accounts: Fix definition of MAXNAMELEN

Currently we get MAXNAMELEN from glibc's LOGIN_NAME_MAX, if available,
and sysconf otherwise. But the maximum username length supported by
glibc and the kernel is actually way larger than the maximum length that
actually works in practice. On Linux, anything larger than 32 characters
is not going to fit into utmp, and will therefore be rejected by
useradd. Then gnome-control-center will spit out a confusing error
message dialog.

Let's spare our users from that.

useradd (in shadow-utils) gets its max name size from the following
magic:

 /* Maximum length of usernames */
 #ifdef HAVE_UTMPX_H
 # include <utmpx.h>
 # define USER_NAME_MAX_LENGTH (sizeof (((struct utmpx *)NULL)->ut_user))
 #else
 # include <utmp.h>
 # ifdef HAVE_STRUCT_UTMP_UT_USER
 #  define USER_NAME_MAX_LENGTH (sizeof (((struct utmp *)NULL)->ut_user))
 # else
 #  ifdef HAVE_STRUCT_UTMP_UT_NAME
 #   define USER_NAME_MAX_LENGTH (sizeof (((struct utmp *)NULL)->ut_name))
 #  else
 #   define USER_NAME_MAX_LENGTH 32
 #  endif
 # endif
 #endif

It's more work than necessary. utmpx is standardized by POSIX (it's
actually an XSI extension), whereas utmp is not, so let's just use
utmpx. This ought to work on at least FreeBSD as well. And if any free
operating systems that care about GNOME don't have utmpx yet, no doubt
they'll send patches.
Comment 10 Michael Catanzaro 2018-01-31 21:11:56 UTC
Um, wrong bug.
Comment 11 Michael Catanzaro 2018-01-31 21:12:53 UTC
(In reply to Robert Roth from comment #6)
> This is something we will have to figure out how to handle generically,
> maybe @mcatanzaro has some ideas:
> * xgettext doesn't know the .theme format, and it does guess based on
> extension, but it doesn't work, as the error messages state
> * even though the build does specify to use the desktop format, damned-lies
> doesn't configure and build, just tries to make a pot file, which fails due
> to the above errors.
> 
> Currently the possible solutions we managed to find with Piotr are:
> * rename the .themes files to .desktop, making xgettext on damned-lies think
> it knows the format
> * convert the themes to an XML-based format, and use an its file for
> specifying the format to xgettext (although I'm not sure if the its file
> gets installed by the build, and d-l still wants to make pot without build,
> which it does). so maybe this doesn't even help, unless the its file gets
> installed by default
> 
> Renaming to desktop was an ugly hack which I did, but I would still choose
> another solution if there is one. This is something we might need for other
> games' themeable names too.

This seems like a serious limitation of gettext. I would ask Daiki Ueno (ueno or IRC) for a recommendation.
Comment 12 Robert Roth 2018-02-01 00:09:33 UTC
Review of attachment 367666 [details] [review]:

Committed the patch with the latest version of git.mk amended to the commit.
Comment 13 Piotr Drąg 2018-02-01 00:15:42 UTC
(In reply to Robert Roth from comment #12)
> Review of attachment 367666 [details] [review] [review]:
> 
> Committed the patch with the latest version of git.mk amended to the commit.

I believe that comment was meant for bug #793043 (four-in-a-row, this is iagno.)
Comment 14 Robert Roth 2018-02-01 01:01:26 UTC
(In reply to Piotr Drąg from comment #13)
> I believe that comment was meant for bug #793043 (four-in-a-row, this is
> iagno.)

This poor ticket already has two comments relevant to other tickets :)