Category Archives: glib

Fedora 28 and GNOME 3.28: New Features for Eastern Europe

This time this is not fake, edited, patched, nor a custom build from COPR but the real screenshots of the unmodified downstream Fedora 28 planned to be released on May 1 this year. Here is how the default calendar widget in GNOME Shell looks in Greek, Polish, and Ukrainian:

For those who can’t speak those languages: the major change here is that the month names are displayed in a correct grammatical form, both in dates and standalone. This is a new feature, or rather a new bugfix, in GNOME 3.28 which has been released on March 14 and pushed to Fedora 28 (prerelease) stable updates today. The series of bugfixes in GNOME was preceded by the similar bugfix in glibc 2.27 released earlier this year.

What Is Eastern Europe

This term must be explained because it is ambiguous. Usually when we say eastern Europe we mean the eastern end of our continent (as opposed to western, northern, southern, and, last but not least, central). But in this context I mean the eastern half of Europe (as opposed to western, and nothing else). I often strongly emphasize that this feature is not just for Slavic languages but also for other language groups of our region: Baltic, Greek, partially also Finnish, and even some western languages like Catalan or Scottish Gaelic.

More Applications

Of course, dates are now displayed correctly in all applications, not just GNOME Shell. In most of them this happened automagically. Few of them, however, needed some minor updates to make sure that the month names are displayed in a genitive case only where needed, not just everywhere. Here is an example of a correct month names display in GNOME Calendar, this time in Croatian:

Please note the difference between the nominative name for March (ožujak) and its correct genitive case as used in date (ožujka; literally: of March).

Western European Languages

English does not have any unsupported features but, while at this, I have examined the date displays in some other western European languages and few features were not supported. For example, some Romance languages (Spanish, Portuguese, etc.) also use the genitive case of both the month name and the year number but they construct it just adding the de preposition before. This feature although so simple was not yet supported so far but now it has been added to GNOME 3.28. Here is a screenshot of the same calendar widget in Spanish:

Please note the correct header saying diciembre de 2017 as opposed by the incorrect diciembre 2017 which is displayed by the older versions.

More Languages

The genitive case of month names is currently supported in Fedora 28 prerelease in only 7 languages: Belarusian, Croatian, Greek, Lithuanian, Polish, Russian, and Ukrainian. But the support of more languages is on the way: Catalan and Czech have been added to GLib and they are already used if the latest GNOME is ran on older systems. The support of these languages has been also pushed to glibc upstream and eventually will reach Fedora 28 but has not yet as of today. However, it has already reached Fedora Rawhide. If we have this chance, let’s take a look at the screenshot of GNOME in Fedora Rawhide in Catalan:

Please note the correct Catalan preposition of genitive case: de març (of March) vs. d’abril (of April).


I’d like to thank all the people from Fedora and GNOME communities and from the outer world who supported me in this challenge: Piotr Drąg, Mike Fabian, Zack Weinberg, Carlos O’Donell, Masha Leonova, Ihar Hrachyshka, Dmitry Levin, Igor Gnatenko, Charalampos Stratakis, Robert Buj, Philip Withnall, and more.

PS. If some date formats in these screenshots are incorrect please approach the respective translation teams.

Some Bugs Are Really Funny

People learn from errors. Therefore bugs should be made public, not hidden.

GLib is a utility library originally developed for GNOME but also used by other projects. One of many functions it provides is g_date_set_parse(). It is really smart and simple. It accepts a string to parse but other than many date parsing functions it does not require a date format to be passed. Instead it tries to find numbers and month names in the parsed string and figure out what date they can represent. Of course, month names are recognized according to the current locale.

Let’s see how it works for Polish. Here is the list of month names:

Month # Full name Abbreviated name
1. Styczeń Sty
2. Luty Lut
3. Marzec Mar
4. Kwiecień Kwi
5. Maj Maj
6. Czerwiec Cze
7. Lipiec Lip
8. Sierpień Sie
9. Wrzesień Wrz
10. Październik Paź
11. Listopad Lis
12. Grudzień Gru

The loop implementing the algorithm iterates over all months and checks if the string being parsed contains a full or abbreviated month name as a substring. The first month which is found as a substring of the parsed string is recognized as a result. Let’s see what happens when a string containing the 9th month, September, which in Polish is wrzesień, is parsed by this algorithm:

Iteration # Full name Abbreviated name Does the string wrzesień contain it?
1. Styczeń Sty No
2. Luty Lut No
3. Marzec Mar No
4. Kwiecień Kwi No
5. Maj Maj No
6. Czerwiec Cze No
7. Lipiec Lip No
8. Sierpień Sie Yes: wrzesień!

So, as a result, the string wrzesień (September) is recognized as sierpień (August).

Is this severe at all?

To be honest, not really. The bug seems to have been around for 20 years now and nobody has complained so far. Parsing dates is not really useful. There are many good reasons why it may not work in localized texts, like incomplete or incorrect translations, varying orthographic rules, Unicode characters updates, etc. Probably no real applications actually use this.

Nevertheless, the problem has been reported to GNOME Bugzilla and will be worked on.