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
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
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
>
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
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
>
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,