[adding the Austin Group, as this is a POSIX question] On 02/13/2015 06:46 AM, Nick & John wrote: > Hello we are Nick Barkas and Ioannis Barkas from Greece. There is an > annoying error in the date command for quite some time when using > Greek locale.
Thanks for the report. > If date is instructed to print month and day of month, the translation > is wrong and looks funny... > You have to be able to write Greek in order to understand it and > since the bug exists we assume no one from coreutils developers knows > Greek. > As a result we will explain every month in detail as it will be Greek > to you. I don't know if you intended that to be funny, but it makes a rather nice play on a typical English idiom :) > Remove "LC_TIME=el_GR.UTF-8" from the commands to get the date > in English. > > This is what you get with "B Y" (month year), which is correct: > $ LC_TIME=el_GR.UTF-8 date +"%B %Y" -d "2015-01-01" > Ιανουάριος 2015 > > This is what you get with "d B Y" (month year), which is wrong: > $ LC_TIME=el_GR.UTF-8 date +"%d %B %Y" -d "2015-01-01" > 01 Ιανουάριος 2015 > > Here is what the date command should print with "d B Y" (month year), > in el_GR.UTF-8 locale: > $ LC_TIME=el_GR.UTF-8 date +"%d %B %Y" -d "2015-01-01" > 01 Ιανουαρίου 2015 > > In Greek language things are different and complex compared to > English. We have accents (τόνους) for most words and words are not > fixed but can dynamically change depending on context. > When the month is accompanied by a day of month the accent (Greek > tonos/τόνος) changes and ...ος becomes ...ου. To fix this, use the > correct translations for months, if and only if %B > and %d are used together. If the month is called with no day (%d) > using "%B" or if the month is called with "%d %b" or "%b" leave the > translations as they are. What should REALLY happen is that libc's strftime(3) (which is what date(1) uses under the hood - the % modifiers are the same) should support something like %OB to trigger a locale's alternative representation, as the %O modifier is already used for other locales that have different displays. But right now, POSIX says %OB is undefined behavior (look for the section on Modified Conversion Specifiers): http://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html and on glibc, it does nothing: $ LC_TIME=el_GR.UTF-8 date +"%d %OB %Y" -d "2015-12-01" 01 %OB 2015 I guess what it boils down to is that when defining a locale, the existing 'era', 'era_d_format', 'era_t_format', and 'era_d_t_format' affect existing %E uses, and 'alt_digits' affects existing %O uses http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_05 and the ideal solution would be adding a new locale file entry for 'alt_months' that would then let %OB provide the locale's alternate month names. Then you could write your string as "%d %OB %Y" to get the grammatically correct output. > Since there are many computer-science oriented Greek universities and > so many Greeks around the world, we are amazed that no one fixed it so > far. > We must also inform you that this silly bug of yours has been seen in > webpages. Coreutils will automatically pick up any fixes in glibc, you'll need to get it fixed there first. It would be nice to get POSIX to standardize %OB, but that would be easier if you could first get glibc to implement the solution to show that it makes sense. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
