Questions tagged [plural]

Pertaining to handling text that must change depending on the number of items involved, according to the rules of different languages.

Pertaining to handling text that must change depending on the number of items involved, according to the rules of different languages.

English only has two forms: "singular" and "plural":

  • You have 1 file
  • You have 2 files

Some languages have more complicated rules, however, and several different categories.

Suggested Reading

110 questions
350
votes
10 answers

Enum Naming Convention - Plural

I'm asking this question despite having read similar but not exactly what I want at C# naming convention for enum and matching property I found I have a tendency to name enums in plural and then 'use' them as singular, example: public enum…
o.k.w
  • 25,490
  • 6
  • 66
  • 63
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
1 answer

How to use Android quantity strings (plurals)

I am trying to use the getQuantityString method in Resources to retrieve quantity strings (plurals) based on Android Developer guidelines Quantity string (plurals) The error I am getting is Error:(604) Multiple substitutions specified in…
Andy
  • 1,023
  • 1
  • 9
  • 17
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
39
votes
3 answers

Plural definition is ignored for zero quantity

I use plurals to compile a quantity string for an Android application. I follow exactly what one can find in the tutorials: res.getQuantityString( R.plurals.number_of_comments, commentsCount, commentsCount); Here is the definition of the…
JJD
  • 50,076
  • 60
  • 203
  • 339
38
votes
2 answers

Java internationalization (i18n) with proper plurals

I was going to use Java's standard i18n system with the ChoiceFormat class for plurals, but then realized that it doesn't handle the complex plural rules of some languages (e.g. Polish). If it only handles languages that resemble English, then it…
Dr.Haribo
  • 1,778
  • 1
  • 31
  • 43
26
votes
10 answers

function switching between singular and plural?

I'm looking for a function that given a string it switches the string to singular/plural. I need it to work for european languages other than English. Are there any functions that can do the trick? (Given a string to convert and the…
dynamic
  • 46,985
  • 55
  • 154
  • 231
19
votes
2 answers

Using Plurals ends in ResourcesNotFoundException

I am trying to use plurals in my latest Android project (SDK9). It always ends in an ResourcesNotFoundException. But the Resource is there - definitely: Here's that part of my strings.xml: %d…
Harald Wilhelm
  • 6,656
  • 11
  • 67
  • 85
19
votes
3 answers

Android Plural Strings with multiple Parameters

In Android strings, you can define plurals to handle translations depending on the actual number supplied to the string as described here. Strings also allow for specifying multiple positional parameters similar to what sprintf does in many…
Andreas Gohr
  • 4,617
  • 5
  • 28
  • 45
15
votes
3 answers

Converting plural to singular in a text file with Python

I have txt files that look like this: word, 23 Words, 2 test, 1 tests, 4 And I want them to look like this: word, 23 word, 2 test, 1 test, 4 I want to be able to take a txt file in Python and convert plural words to singular. Here's my…
theintern
  • 511
  • 2
  • 6
  • 14
13
votes
2 answers

geting error/warning for plurals : "The quantity 'one' matches more than one specific number..."

Background I work on an app that has many translations inside it. I have the next English plural strings: added photo added %d photos and the…
android developer
  • 114,585
  • 152
  • 739
  • 1,270
12
votes
7 answers

best practice(s) for singular word or plural words?

This is about best practices in general, not specific for a single language, database or whatever We all have to deal with generated output where you can be reporting "one products" or "two product". Doesn't read very well... Some just solve this by…
Wim ten Brink
  • 25,901
  • 20
  • 83
  • 149
11
votes
3 answers

Quantity "two" not working in Android Strings-Resources Plural

Android allows translators to define Plurals. The following example works for me with locale 'en': One song found. %d songs…
theomega
  • 31,591
  • 21
  • 89
  • 127
10
votes
1 answer

iOS. Pluralization. Stringdict with format that contains 2 int arguments

My question is similar to How to add regular string placeholders to a translated plurals .stringdict in swift ios but I am trying to understand if it is possible to pass 2 int parameters to strings dict. Say if I want to translate something like: 1…
iur
  • 2,056
  • 2
  • 13
  • 30
8
votes
1 answer

Plural naming convention for composite objects

The question is about the correct way to name variable or identifiers that groups collections of two or more "things". Let me explain a little further with example and question... If you something that holds an id you may name it with the…
Victor
  • 3,841
  • 2
  • 37
  • 63
1
2 3 4 5 6 7 8