Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7674923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:50:42+00:00 2026-05-31T16:50:42+00:00

In playframework 1.x there used to be some bundled java extensions for the templating

  • 0

In playframework 1.x there used to be some bundled java extensions for the templating engine:
http://www.playframework.org/documentation/1.2.3/javaextensions

I’m looking for the same functionality in playframework 2.0. For example how would I do this?

colour${['red', 'green', 'blue'].pluralize()} 

I am doing this malually now:

We have @colours.size colour@if(colours.size > 0){s}

the must be a cleaner more reusable way to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T16:50:43+00:00Added an answer on May 31, 2026 at 4:50 pm

    You can leverage the pimp my lib Scala pattern to implement something equivalent to Play 1.x Java extensions.

    For example, the pluralize method on collection can be implemented as follows:

    // File app/views/pimps.scala
    package views
    
    package object pimps {
      class PimpedTraversable[A](col: Traversable[A]) {
        def pluralize = if (col.size == 1) "" else "s"
      }
    
      implicit def pimpTraversable[A](col: Traversable[A]) = new PimpedTraversable(col)
    }
    

    You can then use it as follows:

    @import views.pimps._
    
    We have @colours.size colour@colours.pluralize
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I see in Play! 2.0 there is Http.Context.current() http://www.playframework.org/documentation/api/2.0/java/play/mvc/Http.Context.html#current () But in Play! 1.2.4
I was looking at this example in the section Assign static args http://www.playframework.org/documentation/1.2.4/routes but
According to the document, http://www.playframework.org/documentation/1.2.3/configuration#java if I define java.source in conf/application.conf then I should
I wondering is there an equivalent of this feature from play framework http://www.playframework.org/documentation/2.0/JavaAsync Basicly
From the play2's doc: http://www.playframework.org/documentation/2.0/ScalaForms , there is a sample code: val loginForm =
I am reading the documentation about the controller http://www.playframework.org/documentation/1.1/controllers and I know how to
Here we have a link http://www.playframework.org/documentation/1.0.1/ide about how to configure playframework to be working
Are there any benchmarks other than http://www.subbu.org/blog/2011/03/nodejs-vs-play-for-front-end-apps that compares how much resources nodejs uses
Writing a Java application using the Play framework and need some HTTP-Live streaming. I
After cloning playframework from github and importing java sources into eclipse there are a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.