[squeak-dev] The Trunk: Collections-ct.925.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Apr 7 21:02:24 UTC 2022


Christoph Thiede uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/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']
  !



More information about the Squeak-dev mailing list