From attila.lendvai at gmail.com Thu Nov 6 23:37:40 2008 From: attila.lendvai at gmail.com (Attila Lendvai) Date: Fri, 7 Nov 2008 00:37:40 +0100 Subject: [cl-l10n-devel] cldr refactoring/experiment In-Reply-To: References: Message-ID: > i've created a branch at > > darcs get http://common-lisp.net/project/cl-l10n/darcs/cl-l10n.cldr/ dear list, i'm happy to inform you that meanwhile we've switched our codebase to this branch and it seems to serve us well. until now the main obstacle was the lack of support for format patterns defined by cldr, but we've created compilers for most of them finally. these compilers parse things like "yyyy. MMMM d." or "#,##0.###" and emit lambdas that do the specified formatting. this is similar to how cl-ppcre works: splitting up computation to a compile-time and runtime, where compile-time really means to do parts of the computation and return some lambda's that capturing this partial result can produce the final result. so there's no cl:compile involved... you can try things like: CL-L10N> (funcall (with-locale "hu" (compile-date-pattern/gregorian-calendar "EEEE d 'foo' MMMM 'bar' yyyy")) *standard-output* (local-time:parse-timestring "2000-01-22")) szombat 22 foo janu?r bar 2000 NIL i'm planning to merge this back into the official branch in a few weeks, but please take a look and speak up if there's something on your mind! especially you Sean, as you are the owner of the project... i don't want to sound like the maintainer. and while there's hardly any traffic here, there may also be some users out there... :) please note that this change is not 100% backwards compatible and introduces extra dependencies (like cxml and local-time). but on the other hand i think using the cldr xml's as the base for locale info and local-time for time/date manipulation results in more up-to-date and extensive locale support. -- attila From rosssd at gmail.com Fri Nov 7 11:41:12 2008 From: rosssd at gmail.com (Sean Ross) Date: Fri, 7 Nov 2008 11:41:12 +0000 Subject: [cl-l10n-devel] cldr refactoring/experiment In-Reply-To: References: Message-ID: On 6 Nov 2008, at 23:37, Attila Lendvai wrote: >> i've created a branch at >> >> darcs get http://common-lisp.net/project/cl-l10n/darcs/cl-l10n.cldr/ > > dear list, > > i'm happy to inform you that meanwhile we've switched our codebase to > this branch and it seems to serve us well. > > until now the main obstacle was the lack of support for format > patterns defined by cldr, but we've created compilers for most of them > finally. > > these compilers parse things like "yyyy. MMMM d." or "#,##0.###" and > emit lambdas that do the specified formatting. this is similar to how > cl-ppcre works: splitting up computation to a compile-time and > runtime, where compile-time really means to do parts of the > computation and return some lambda's that capturing this partial > result can produce the final result. so there's no cl:compile > involved... > > you can try things like: > > CL-L10N> (funcall (with-locale "hu" > (compile-date-pattern/gregorian-calendar "EEEE d > 'foo' MMMM 'bar' yyyy")) > *standard-output* > (local-time:parse-timestring "2000-01-22")) > szombat 22 foo janu?r bar 2000 > NIL > > i'm planning to merge this back into the official branch in a few > weeks, but please take a look and speak up if there's something on > your mind! especially you Sean, as you are the owner of the project... > i don't want to sound like the maintainer. > You may as well be, for all the work I've done on this in the past couple of years. I'm quite happy, provided there is some sort of documentation, for the master branch to change to the cldr branch. I'm very happy with the dependency on local-time, having these two systems playing nicely together is a great thing. At a quick glance the only thing that i found noticeably missing was the ability to pass in custom formatting strings to %format-date and format-date/gregorian- calendar. Come to think of it, it would be nice to be able to pass these in to all the formatting functions. sean. From attila.lendvai at gmail.com Sat Nov 15 20:46:20 2008 From: attila.lendvai at gmail.com (Attila Lendvai) Date: Sat, 15 Nov 2008 21:46:20 +0100 Subject: [cl-l10n-devel] cldr refactoring/experiment In-Reply-To: References: Message-ID: > At a quick glance the only thing that i found noticeably missing was the > ability to pass in > custom formatting strings to %format-date and > format-date/gregorian-calendar. > Come to think of it, it would be nice to be able to pass these in to all the > formatting functions. fyi, i've pushed a patch that adds a :pattern keyword arg for most of the formatters (except the currency formatter, which is a bit half-done for now). with this patch you can do things like the following for a 5x speed and 10 times consing penalty: (cl-l10n::format-date/gregorian-calendar nil (local-time:now) :pattern "yyyy 'foo' MMMM 'bar' dd") "2008 foo November bar 15" -- attila