From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 125697 invoked by alias); 5 Dec 2016 14:55:51 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 125645 invoked by uid 89); 5 Dec 2016 14:55:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.8 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=English, thoroughly, treating, occupied X-HELO: mx1.redhat.com Subject: Re: [PATCH][BZ #15527] strftime_l.c: Support lowercase output To: Rafal Luzynski , libc-alpha@sourceware.org References: <576117B9.5080105@redhat.com> <583D72AD.2010409@redhat.com> <583D7792.2010500@redhat.com> <1809687502.1414502.1480634954216@poczta.nazwa.pl> From: Jakub Martisko Message-ID: <58457FE6.9060803@redhat.com> Date: Mon, 05 Dec 2016 14:55:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <1809687502.1414502.1480634954216@poczta.nazwa.pl> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-SW-Source: 2016-12/txt/msg00093.txt.bz2 Hello Rafal, as for the order of ^# flags - right now the change case flag works as an upper case flag for options which are in title case by default (Sun -> SUN) and as lowercase for those, which are in uppercase by default (AM -> am). In my opinion, treating "%^#A" and "%#^A" as an idiom for lower case makes the most sense. If you consider "%#^A", the output would switch case (whatever that means) and then be switched to uppercase. The "#" flag would thus be ignored. As for the title case part of your message, I am probably not the right person to answer it:-(. Regards, Jakub On 2.12.2016 00:29, Rafal Luzynski wrote: > Hi, > > (Top-posting to conform to the style you already started. ;) > > Your patch has drawn my attention. I must admit that I have not > analyzed it very thoroughly but OTOH I'm not the right person to > say the patch should be committed. > > Only one question: what would be the order of applying > the flags? Should "%^#A" mean "convert to uppercase and then > swap" or "swap the case and then convert to uppercase" or > should it be an idiom to "convert to lowercase" no matter > what is the actual order? Should "%^#A" do the same as "%#^A"? > > At first sight it may seem that usefulness of this feature > is limited: who would need a "convert to lowercase" switch > if all letters are already lowercase and those which are > uppercase (first letters of months names and weekdays names) > should always be uppercase? > > But that's true only for English, German and maybe few other > languages. Not true for lots of others, including my and also > I guess your language. In many languages there is no rule > saying that month names and weekday names should always begin > with uppercase but other rules may apply: it should begin with > uppercase if it's a beginning of a sentence or a beginning of > a title. I really don't like months names (standalone) or weekday > names (a full date starting with a weekday name) starting with > lowercase just because in English they are always uppercase > and developers don't have to worry about it so they eventually > leave all other languages in all lowercase. I really wish there > was a strftime() flag converting words to titlecase. We have > "convert to uppercase" and "swap the case" but no "convert to > lowercase" nor "convert the first letter to uppercase". OTOH, > the implementation of this feature should not be left to the app > developers because not all languages need it, and converting > to the uppercase/titlecase is not a trivial task (in case of > UTF-8, how many bytes are occupied by the first letter? how > many bytes will its uppercase version occupy? does the letter > feature only lowercase and uppercase or is it a ligature > and has it a separate titlecase, like lj → Lj → LJ?) so better > should be implemented by a core library. > > Unfortunately, I don't have a good candidate for a "convert > to lowercase" or a "convert to titlecase" switch. But your > patch solves the problem if we also provide all months names > and all weekday names in all locale data for all languages > in titlecase, even if a language does not require it by default. > Then we would have: > > "%^A" - convert to uppercase => "SUNDAY"; > "%#A" - swap the case => "sUNDAY" (yes, not useful); > "%^#A" - convert to lowercase => "sunday" (in the middle of > a sentence, as required in many languages but not > in English); > "%A" - leave unchanged, titlecase => "Sunday" (default, always > in English and some other languages, required in the > beginning of a sentence in many other languages). > > We would have a way to convert all words to any (reasonable) > case and the decision would be always left for the translators > without any change in any application code. What do you guys think? > > Regards, > > Rafal > > > 29.11.2016 13:41 Jakub Martisko wrote: >> >> >> Sorry, this was supposed to be a reply to: >> https://sourceware.org/ml/libc-alpha/2016-06/msg00575.html >> >> On 29.11.2016 13:21, Jakub Martisko wrote: >>> Hi, are there any updates regarding this functionality? >>> >>> On 15.6.2016 10:54, Jakub Martisko wrote: >>>> strftime_l.c doe not provide easy way to produce lowercase >>>> output. While the function to create lowercase is >>>> implemented, there is no flag which would cause it to be >>>> called. Provided patch checks, whether combination of >>>> to_uppcase and change_case flags is used and sets to_lowcase >>>> if both of them are set which leads to lower case output. >>>>