GNOME Bugzilla – Bug 793040
Use upstream gettext instead of intltool
Last modified: 2018-02-01 01:01:26 UTC
As part of https://wiki.gnome.org/Initiatives/GnomeGoals/GettextMigration, get rid of intltool, use gettext.
Created attachment 367666 [details] [review] Use gettext (bgo#793040)
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.
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/
(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.
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
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.
(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.
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).
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.
Um, wrong bug.
(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.
Review of attachment 367666 [details] [review]: Committed the patch with the latest version of git.mk amended to the commit.
(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.)
(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 :)