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
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Type: text/plain
Charset: utf8
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 358
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.
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Disposition: inline
Charset: utf8
Message-Id: <rt-3.6.HEAD-8673-1211558883-988.36136-0-0 [...] rt.cpan.org>
Content-Type: text/plain
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 423
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+$//; + } + }
MIME-Version: 1.0
In-Reply-To: <rt-3.6.HEAD-8673-1211558883-988.36136-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Disposition: inline
Charset: utf8
References: <rt-3.6.HEAD-8673-1211558883-988.36136-0-0 [...] rt.cpan.org>
Message-Id: <rt-3.6.HEAD-8656-1211559067-231.36136-0-0 [...] rt.cpan.org>
Content-Type: text/plain
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 61
oi, the web + indents = ugly, imagein it more sane looking :)
MIME-Version: 1.0
In-Reply-To: <rt-3.6.HEAD-8673-1211558883-988.36136-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Disposition: inline
Charset: utf8
References: <rt-3.6.HEAD-8673-1211558883-988.36136-0-0 [...] rt.cpan.org>
Message-Id: <rt-3.6.HEAD-8673-1211559067-144.36136-0-0 [...] rt.cpan.org>
Content-Type: text/plain
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 61
oi, the web + indents = ugly, imagein it more sane looking :)
MIME-Version: 1.0
In-Reply-To: <rt-3.6.HEAD-8673-1211559067-144.36136-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.426 (Entity 5.426)
Content-Disposition: inline
Charset: utf8
References: <rt-3.6.HEAD-8673-1211558883-988.36136-0-0 [...] rt.cpan.org> <rt-3.6.HEAD-8673-1211559067-144.36136-0-0 [...] rt.cpan.org>
Message-Id: <rt-3.6.HEAD-23596-1217114576-269.36136-0-0 [...] rt.cpan.org>
Content-Type: text/plain
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 213
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
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Charset: utf8
Content-Type: text/plain
Message-ID: <rt-3.6.HEAD-13950-1245811271-1876.36136-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 832
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.
MIME-Version: 1.0 (Apple Message framework v935.3)
X-Spam-Status: No, hits=-4.0 required=8.0 tests=RCVD_IN_DNSWL_MED,SPF_HELO_PASS
In-Reply-To: <rt-3.6.HEAD-13950-1245811271-1876.36136-6-0 [...] rt.cpan.org>
X-Mailer: Apple Mail (2.935.3)
References: <RT-Ticket-36136 [...] rt.cpan.org> <rt-3.6.HEAD-13950-1245811271-1876.36136-6-0 [...] rt.cpan.org>
Message-ID: <F93F91E2-DC41-40E3-ADC6-EDAF244A2566 [...] simplemood.com>
Content-Type: text/plain; charset="utf-8"; delsp="yes"; format="flowed"
X-Antiabuse: This header was added to track abuse, please include it with any abuse report
X-Antiabuse: Primary Hostname - mx1.cpanel.net
X-Antiabuse: Original Domain - rt.cpan.org
X-Antiabuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-Antiabuse: Sender Address Domain - simplemood.com
X-RT-Original-Encoding: utf-8
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by diesel.bestpractical.com (Postfix) with SMTP id 3C40619B82DE for <bug-Locale-Maketext [...] rt.cpan.org>; Wed, 24 Jun 2009 08:01:26 -0400 (EDT)
Received: (qmail 3328 invoked by uid 103); 24 Jun 2009 12:01:25 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 24 Jun 2009 12:01:25 -0000
Received: from mx1.cpanel.net (HELO mx1.cpanel.net) (208.74.121.68) by 16.mx.develooper.com (qpsmtpd/0.80) with ESMTP; Wed, 24 Jun 2009 05:01:18 -0700
Received: from cmu-339940.wv.cc.cmu.edu ([128.237.242.250]) by mx1.cpanel.net with esmtpa (Exim 4.69) (envelope-from <webmaster [...] simplemood.com>) id 1MJRA6-000613-P2 for bug-Locale-Maketext [...] rt.cpan.org; Wed, 24 Jun 2009 07:01:10 -0500
Delivered-To: cpan-bug+Locale-Maketext [...] diesel.bestpractical.com
Subject: Re: [rt.cpan.org #36136] numf() take second argument to say how many decimal places
Return-Path: <webmaster [...] simplemood.com>
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: bug-Locale-Maketext [...] rt.cpan.org
Date: Wed, 24 Jun 2009 07:01:13 -0500
X-Spam-Level: *
To: bug-Locale-Maketext [...] rt.cpan.org
Content-Transfer-Encoding: 7bit
From: Dan Muey <webmaster [...] simplemood.com>
RT-Message-ID: <rt-3.6.HEAD-13950-1245844897-1289.36136-0-0 [...] rt.cpan.org>
Content-Length: 1063
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.