I often like to show 'n abuse reports' or 'y members' to my numeric fields using the Suffix feature. It would be outstanding if we could add different text for singular and plural as per format_plural(). This would be just a little extra code and two more form fields. Would this be acceptable/desireable?

Comments

merlinofchaos’s picture

This is a good idea, but I am going to wait until after 2.0 on this.

icecreamyou’s picture

I came across this while trying to figure out how to do this with the Flag module, i.e.:

1 person likes this

OR

10 people like this

...depending on how many times the entity in question has been flagged.

I'm currently too overwhelmed to throw together a patch, but thought I'd offer another use case in lieu of the deadly "+1 subscribe."

magnus’s picture

Assigned: moshe weitzman » Unassigned

Subscribe

steven jones’s picture

Status: Active » Needs review
StatusFileSize
new2.78 KB

Here's a patch.

dawehner’s picture

Status: Needs review » Needs work
+++ handlers/views_handler_field_numeric.inc	3 Jun 2010 08:30:51 -0000
@@ -17,6 +17,9 @@ class views_handler_field_numeric extend
+    $options['format_plural'] = array('default' => FALSE);
+    $options['format_plural_singular'] = array('default' => '1', 'translatable' => TRUE);
+    $options['format_plural_plural'] = array('default' => '@count', 'translatable' => TRUE);

I wouldn't do translatable here. format_plural does already use the t() function. But i'm not sure about this. Perhaps views would need a views_format_plural to fix this issue.

Powered by Dreditor.

steven jones’s picture

Well if they are already going to be translated by t then let's just make them not declared as translatable. I wasn't entirely sure what that meant in the context of these options, and where these values get used.

steven jones’s picture

Status: Needs work » Needs review
StatusFileSize
new2.73 KB

Removed the translatable attributes.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Looks fine and works fine for me. Perhaps it should be a definition enable/disable flag, but i'm not sure about it.

merlinofchaos’s picture

Status: Reviewed & tested by the community » Fixed

Committed to all branches.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

abaddon’s picture

Version: 6.x-2.x-dev » 6.x-2.12
Status: Closed (fixed) » Active

this never made its way into the stable views release, i can confirm its in views-6.x-2.x but that one isnt displayed on the module page anymore
could it be included in the next views 2.x release? its a simple patch and it works fine

merlinofchaos’s picture

Status: Active » Closed (fixed)

Yes there hasn't been a new release of Views for some time.

This does not give you license to randomly re-open issues.

abaddon’s picture

so commited to all branches on July 28, 2010, and the last views release for 2.x is on 2010-Dec-15, where do i get my license from mr. merlinofchaos? please dont shoot me now

merlinofchaos’s picture

Perhaps you should read the release notes on the last release.

abaddon’s picture

ok, i stand corrected, sorry for reopening this