From: Thomas W. <tho...@gm...> - 2010-07-16 07:40:54
|
I am glad the localization is in the focus now. Dan, I think the the proposal is good but it does not cover all issues related to the localisation. I think the best way to organise the code is to create a module dedicated for all localisation functions called l18n. The functions I can see there for now could be: localized-date( $date as xs:datetime, $locale as xs:string) localized-currency( $number as xs:double, $locale as xs:string) localized-percent( $number as xs:double, $locale as xs:string) localized-number( $number as xs:double, $locale as xs:string) and many other localized function to come... I do believe it is much better to have a specialised function for every data type instead of a generic function with a parameter. It is much more clear when one reads the code with dedicted functions. Loren, I agree with you number-to-formatted-string should go to util module because of it generic nature. I hope this will help. Thomas ------ Thomas White Mobile:+44 7711 922 966 Skype: thomaswhite gTalk: thomas.0007 Linked-In:http://www.linkedin.com/in/thomaswhite0007 facebook: http://www.facebook.com/thomas.0007 On 15 July 2010 20:13, Dan McCreary <dan...@gm...> wrote: > My apologies, > > I was aware of the XQuery 1.1 specification for *format-number()* but I > did not communicate this format clearly to Loren. > > Here is the proposed format in the 1.1 XQuery Working Draft standard: > > http://www.w3.org/TR/xquery-11/#id-decimal-format-decl > > I believe we should be working to try to make it consistent with this > specification (i.e. also XPath 2.0) > > - Dan > > > On Thu, Jul 15, 2010 at 12:39 PM, Loren Cahlander < > lor...@gm...> wrote: > >> I am in the process of adding the formatting of a number to a formatted >> string. There are three general purpose functions that format the number to >> a general number, currency or percentage according to the optionally >> specified locale. The fourth function takes in a format string according to >> the format specification for the java.text.DecimalFormat Java class. >> >> Please supply me with your comments. Dan will be developing XQuery unit >> tests to validate the functions. You will find the function docs below. >> >> Thank you, >> >> Loren >> >> >> >> number-to-currency-string<http://localhost:8080/exist/functions/util/number-to-currency-string> >> ------------------------------ >> util:number-to-currency-string($number as xs:double, $locale as >> xs:string?) xs:string? >> Returns a currency number formatted for the specified locale if >> specified (default otherwise) as an xs:string value. >> $number The number $locale two-letter ISO-639 code representing the >> locale >> ------------------------------ >> Returns the formatted string >> number-to-formatted-string<http://localhost:8080/exist/functions/util/number-to-formatted-string> >> ------------------------------ >> util:number-to-formatted-string($number as xs:double, $format as >> xs:string) xs:string? >> Returns the number formatted as an xs:string value. >> $number The number $format The format pattern string. Please see the >> JavaDoc for java.text.DecimalFormat to get the specifics of this format >> string. >> ------------------------------ >> Returns the formatted string >> number-to-percent-string<http://localhost:8080/exist/functions/util/number-to-percent-string> >> ------------------------------ >> util:number-to-percent-string($number as xs:double, $locale as xs:string?) >> xs:string? >> Returns a percentage number formatted for the specified locale if >> specified (default otherwise) as an xs:string value. >> $number The number $locale two-letter ISO-639 code representing the >> locale >> ------------------------------ >> Returns the formatted string >> number-to-string<http://localhost:8080/exist/functions/util/number-to-string> >> ------------------------------ >> util:number-to-string($number as xs:double, $locale as xs:string?) >> xs:string? >> Returns a general-purpose number formatted for the specified locale if >> specified (default otherwise) as an xs:string value. >> $number The number $locale two-letter ISO-639 code representing the >> locale >> ------------------------------ >> Returns the formatted string >> >> >> >> > > > -- > Dan McCreary > Semantic Solutions Architect > office: (952) 931-9198 > cell: (612) 986-1552 > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > _______________________________________________ > Exist-development mailing list > Exi...@li... > https://lists.sourceforge.net/lists/listinfo/exist-development > > |