You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Sergiy Kovalchuk (JIRA)" <de...@velocity.apache.org> on 2009/02/11 16:58:59 UTC

[jira] Issue Comment Edited: (VELTOOLS-113) new DisplayTool features

    [ https://issues.apache.org/jira/browse/VELTOOLS-113?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12672660#action_12672660 ] 

serg472 edited comment on VELTOOLS-113 at 2/11/09 7:57 AM:
--------------------------------------------------------------------

>Would this work in other languages? (is there such a java function?) 

for other languages or for irregular plural English words you can just use plural(2,"singular_form","plural_form"). 

There is no standard java library to pluralize words. It can be done with https://inflector.dev.java.net/ lib but it is for slightly different usages and would be kind of overkill for simple tasks like this.

>Could you use a #macro(plural ...) instead? 
I don't insist, if you think it is redundant feel free to remove it... Personally in our projects I know a lot of places where this could be useful. It is kind of similar to alt(checkMe, alternate), just instead of checking for null it is checking for !=1.

      was (Author: serg472):
    >Would this work in other languages? (is there such a java function?) 

for other languages or for irregular plural English words you can just use plural(2,"singular_form","plural_form"). 

There is no standard java library to pluralize words. It can be done with https://inflector.dev.java.net/ lib but it is for slightly different usages and would be kind of overkill for simple tasks like this.

>Could you use a #macro(plural ...) instead? 
I don't insist, if you think it is redundant feel free to remove it... Personally in our projects I know a lot of places where this could be useful. It is kind of similar to alt(checkMe, alternate), just instead of checking for null it is hecking for !=1.
  
> new DisplayTool features
> ------------------------
>
>                 Key: VELTOOLS-113
>                 URL: https://issues.apache.org/jira/browse/VELTOOLS-113
>             Project: Velocity Tools
>          Issue Type: New Feature
>          Components: GenericTools
>            Reporter: Nathan Bubna
>            Priority: Minor
>
> More ideas from the dev list:
> ----------------------------------------------------------------------------------------------
> On Sat, Feb 7, 2009 at 3:41 PM,  <se...@gmail.com> wrote:
> Hello,
> I wanted to share with you a few ideas I have about new simple
> improvements for DisplayTools. I should be able to make patches for
> them if you are interested.
> #snip
> 2. Add new "property" parameter to
> list(Object list, String delim, String finaldelim, String property)
> method that will format an array or collection of objects on selected
> property (similar to SortTools).
> 3. Add new method:
> stripTags(Object obj, String... allowedTags)
> that will strip all (html) tags from the text except those listed in
> allowedTags (allowed tags are passed like this: "br","img","p").
> 4. Add new method:
> br(Object obj)
> that will replace \n with "<br />\n"
> 5. Add new "preserveWords" parameter to:
> truncate(Object truncateMe, int maxLength, String suffix, boolean preserveWords)
> that will truncate a string to a last complete word within maxLength
> instead of exact character.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org