Re: [Pharo-users] Pluralising messages or choosing word alternatives

2019-02-21 Thread Richard O'Keefe
These days we are supposed to think about internationalisation and localisation. The rather elderly and inadequate '<1P> foobar<2?:s>' expandMacrosWith: n with: n = 1 works fine for English, but when you switch to '<1P> foobar<2?:s>' translated expandMacrosWith: n with: n = 1 you run into the

Re: [Pharo-users] Pluralising messages or choosing word alternatives

2019-02-20 Thread Tim Mackinnon
Some great suggestions here guys - I had forgotten there were conditionals in expandMacros… that is the better solution. Although I do kind of think that something on OrderedCollection like: chooseBasedOn: count ^self at: ((count max: 1) min: self size) Would be a nice general

Re: [Pharo-users] Pluralising messages or choosing word alternatives

2019-02-20 Thread Sven Van Caekenberghe
You should have a look at what Seaside has. Like Integer>>#pluralize:with: But also the class GRInflector that understand more about English than I do ;-) > On 20 Feb 2019, at 22:07, Tim Mackinnon wrote: > > I was browsing some of the Pharo issues (always worth doing) - and noticed an >

Re: [Pharo-users] Pluralising messages or choosing word alternatives

2019-02-20 Thread Esteban Maringolo
Why not use the condition macro so you have a single string literal, that in the future could be used for translation? E.g. | occurences | occurences := 3. 'There <1?is:are> <2p> <1?occurrence:ocurrences> of <3p>' expandMacrosWith: occurences = 1 with: 3 with: 'Foo' Esteban A. Maringolo El

Re: [Pharo-users] Pluralising messages or choosing word alternatives

2019-02-20 Thread Gabriel Cotelli
Maybe you can use the conditional syntax of expandMacros. On Wed, Feb 20, 2019, 18:08 Tim Mackinnon wrote: > I was browsing some of the Pharo issues (always worth doing) - and noticed > an interesting one about Test results reporting and pluralisation >

[Pharo-users] Pluralising messages or choosing word alternatives

2019-02-20 Thread Tim Mackinnon
I was browsing some of the Pharo issues (always worth doing) - and noticed an interesting one about Test results reporting and pluralisation (https://github.com/pharo-project/pharo/issues/2578) In it, I hadn't noticed String>>asPluralBasedOn: before (and judging from many messages in the image,