Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Locale-Maketext CPAN distribution.

Report information
The Basics
Id: 36136
Status: rejected
Priority: 0/
Queue: Locale-Maketext

People
Owner: ferreira [...] shoo.cpan.org
Requestors: dmuey [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: numf() take second argument to say how many decimal places
Download (untitled) / with headers
text/plain 358b
$lh->maketext('pi is [numf,_1]', 355/113); # pi is 3.14159292035398 since pi = 355/116 is only accurate to 6 decimal places you'd actually want this: $lh->maketext('pi is [numf,_1,6]', 355/113); # pi is 3.141592 Have to watch sprintf('%.' . $decimal_places . 'f', $number) as it rounds, we'd just want to lop it off with a substr()or regex or something.
Download (untitled) / with headers
text/plain 423b
This psuedo patch should do it: sub numf { - my($handle, $num) = @_[0,1]; + my($handle, $num, $decimal_places) = @_[0,1]; ... while( $num =~ s/^([-+]?\d+)(\d{3})/$1,$2/s ) {1} + if (defined $decimal_places) { + $decimal_places = abs(int($decimal_places)); + if($decimal_places) { + $num =~ s/(^\d{1,}\.\d{$decimal_places})(.*$)/$1/; + } + else { + $num =~ s/\.\d+$//; + } + }
oi, the web + indents = ugly, imagein it more sane looking :)
oi, the web + indents = ugly, imagein it more sane looking :)
Download (untitled) / with headers
text/plain 213b
On Fri May 23 12:11:07 2008, DMUEY wrote: Show quoted text
> oi, the web + indents = ugly, imagein it more sane looking :)
Locale::Maketext::Utils v0.0.12 implements this, it'd be awesome if this was in Locale::Maketext its self
Download (untitled) / with headers
text/plain 832b
Locale::Maketext docs says: "If you want anything fancier, consider overriding this with something that uses Number::Format, or does something else entirely." and this is fancier. I think standard "numf", "quant" and "sprintf" are to be considered more like examples of bracket notation methods than good-for-all-cases formatting methods. Locale::Maketext should specialize on being a framework for localization as stated in its punch line. Richer and widely applicable methods can be built in a fancy library of bracket notation methods. For example, the distribution "Locale-Maketext-Utils" seems to be a promising add- on for such a thing. For this reason, I prefer to reject this ticket and see it contemplated somewhere else where code for this may evolve without the drudgery of the Locale::Maketext framework itself.
Subject: Re: [rt.cpan.org #36136] numf() take second argument to say how many decimal places
Date: Wed, 24 Jun 2009 07:01:13 -0500
To: bug-Locale-Maketext [...] rt.cpan.org
From: Dan Muey <webmaster [...] simplemood.com>
yeah, makes sense. This is not critical by any means On Jun 23, 2009, at 9:41 PM, Adriano Ferreira via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=36136 > > > Locale::Maketext docs says: > > "If you want anything fancier, consider overriding this with > something that uses > Number::Format, or does something else entirely." > > and this is fancier. I think standard "numf", "quant" and "sprintf" > are to be considered more like > examples of bracket notation methods than good-for-all-cases > formatting methods. > > Locale::Maketext should specialize on being a framework for > localization as stated in its punch > line. Richer and widely applicable methods can be built in a fancy > library of bracket notation > methods. For example, the distribution "Locale-Maketext-Utils" seems > to be a promising add- > on for such a thing. > > For this reason, I prefer to reject this ticket and see it > contemplated somewhere else where code > for this may evolve without the drudgery of the Locale::Maketext > framework itself.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.