Questions tagged [pluralize]

Pluralize stands for an automate script process, that checks a word (for example, english word "box") and adds its plural end "es", so it comes "boxes", when it is needed to be plural. Term is used in many programming languages.

146 questions
119
votes
4 answers

ASP.NET MVC Controller Naming Pluralization

RESTful conventions indicate using plural nouns over singular objects. What is the pluralization convention for naming ASP.NET MVC controllers, i.e. ProductController or ProductsController?
107
votes
25 answers

Plurality in user messages

Many times, when generating messages to show to the user, the message will contain a number of something that I want to inform the customer about. I'll give an example: The customer has selected a number of items from 1 and up, and has clicked…
Øyvind Bråthen
  • 59,338
  • 27
  • 124
  • 151
94
votes
8 answers

i18n Pluralization

I want to be able to translate pluralized strings in i18n in rails. A string can be : You have 2 kids or You have 1 kid I know that I can use pluralize helper method, but I want to embed this in i18n translations so that I don't have to mess up…
Spyros
  • 46,820
  • 25
  • 86
  • 129
75
votes
4 answers

How do I override rails naming conventions?

I have a model named "clothing" which I want to be the singlular (one piece of clothing). By default, rails says the plural is clothings. Right or wrong, I think it will be more readable if the plural is "clothes". How do I override the plural…
chrishomer
  • 4,900
  • 5
  • 38
  • 52
73
votes
15 answers

JavaScript pluralize an english string

In PHP, I use Kuwamoto's class to pluralize nouns in my strings. I didn't find something as good as this script in javascript except for some plugins. So, it would be great to have a javascript function based on Kuwamoto's…
pmrotule
  • 9,065
  • 4
  • 50
  • 58
66
votes
8 answers

Entity Framework Core RC2 table name pluralization

Is there a way to do what this code did in EF Core RC 2? protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Conventions.Remove(); }
Paul Speranza
  • 2,302
  • 8
  • 26
  • 43
62
votes
7 answers

Is there a pluralize function in Ruby NOT Rails?

I am writing some Ruby code, not Rails, and I need to handle something like this: found 1 match found 2 matches I have Rails installed so maybe I might be able to add a require clause at the top of the script, but does anyone know of a RUBY method…
aarona
  • 35,986
  • 41
  • 138
  • 186
52
votes
6 answers

pluralize without count number in rails 4

I am building a blog app. I'd like to be able to pluralize the word "article" if more than one "post" is "published." Like so: Available Articles or Available Article This is what I have.... Available <%= pluralize @posts.published, "Article"…
NothingToSeeHere
  • 2,253
  • 5
  • 25
  • 57
39
votes
5 answers

Is there a way to use pluralize() inside a model rather than a view?

It seems pluralize only works within a view -- is there some way that my models can use pluralize too?
jpw
  • 18,697
  • 25
  • 111
  • 187
32
votes
7 answers

Java API for plural forms of English words

Are there any Java API(s) which will provide plural form of English words (e.g. cacti for cactus)?
Joe
  • 14,513
  • 28
  • 82
  • 144
32
votes
3 answers

How turn off pluralize table creation for Entity Framework 5?

I am trying to use Entity Framework 5. The first problem was that EF creats tables automatically. I tried to fix it by including dbModelBuilder.Conventions.Remove(). The second problem was the error like this The…
Yara
  • 4,441
  • 6
  • 42
  • 62
28
votes
3 answers

override default pluralize for model-name in rails3

my locale is :de and I like to get this: Sheet.model_name.human.pluralize # => Belegs to add me a trailing "e" instead of "s" Sheet.model_name.human.pluralize # => Belege just for the Sheet-class. Can I add it somehow in my…
toy
  • 543
  • 1
  • 6
  • 16
28
votes
3 answers

Undefined method 'pluralize' for #

Not sure why this has decided to stop working. customers_controller.rb redirect_to customers_url, notice: pluralize(@imported_customers.size, "customer") + " imported!" And I'm getting the error: NoMethodError: undefined method…
Wes Foster
  • 8,770
  • 5
  • 42
  • 62
25
votes
2 answers

Pluralize English words Like LINQ to SQL Does

Possible Duplicate: Pluralize - Singularize The C# 4.0 (maybe older versions, but I've only tested with 4.0) Linq-to-SQL generator will pluralize your table names; even tough plurals like Territory. It knows that Territories is the plural. Is…
Geoff
  • 253
  • 2
  • 4
20
votes
3 answers

Test if a word is singular or plural in Ruby on Rails

Quick question. How can I test a word to see if it is singular or plural? I'd really like: test_singularity('word') # => true test_singularity('words') # => false I bet rails is capable! Thanks.
doctororange
  • 11,670
  • 12
  • 42
  • 58
1
2 3
9 10