The Inbox: Collections-ct.925.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Collections-ct.925.mcz

commits-2
Christoph Thiede uploaded a new version of Collections to project The Inbox:
http://source.squeak.org/inbox/Collections-ct.925.mcz

==================== Summary ====================

Name: Collections-ct.925
Author: ct
Time: 2 March 2021, 5:03:16.49317 pm
UUID: 5f3ec2e0-cb35-a74d-9a02-1ef8f9f78aeb
Ancestors: Collections-jar.924

Refines String>>#asPluralBasedOn: to avoid ugly spellings such as 'classs'.

This approach does not scale very far, of course, but it's better than nothing. Maybe we also want to move this into System-Localization at some other day and build language-specific plurals. :-)

=============== Diff against Collections-jar.924 ===============

Item was changed:
  ----- Method: String>>asPluralBasedOn: (in category 'converting') -----
  asPluralBasedOn: aNumberOrCollection
  "Append an 's' to this string based on whether aNumberOrCollection is 1 or of size 1."
 
+ aNumberOrCollection = 1
+ ifTrue: [^ self].
+ (aNumberOrCollection isCollection and: [aNumberOrCollection size = 1])
+ ifTrue: [^ self].
+
+ ^ (self endsWith: 's')
+ ifTrue: [self , 'es']
+ ifFalse: [self , 's']
- ^ (aNumberOrCollection = 1 or:
- [aNumberOrCollection isCollection and: [aNumberOrCollection size = 1]])
- ifTrue: [self]
- ifFalse: [self, 's']
  !