Issue 7020 in pharo: Named String Interpolation for String>>#format:

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

Issue 7020 in pharo: Named String Interpolation for String>>#format:

pharo
Status: New
Owner: ----
Labels: Milestone-2.0 Type-Feature

New issue 7020 by [hidden email]: Named String Interpolation for  
String>>#format:
http://code.google.com/p/pharo/issues/detail?id=7020

Probably quite a trivial problem but seeing as the solution might be  
similarly so, I thought it was worth mentioning.

When doing language translations, it is considered good practice to use  
something like Pharo's String>>#format: rather than by concatenating  
strings as not all languages use the same sentence ordering. I think in  
this context, it is more desirable to have named string arguments rather  
than positional ones as it communicates more information to the translator.

i.e.
'Hello {name}' rather than 'Hello {1}' (bad example but you get the idea!)

Having looked at String>>#evaluateExpression: aString parameters:  
aCollection I think it would be quite trivial to support Dictionaries too  
that this sort of thing would become possible


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 7020 in pharo: Named String Interpolation for String>>#format:

pharo
Updates:
        Status: Accepted

Comment #1 on issue 7020 by [hidden email]: Named String  
Interpolation for String>>#format:
http://code.google.com/p/pharo/issues/detail?id=7020

Good idea, I'll make a slice !


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 7020 in pharo: Named String Interpolation for String>>#format:

pharo
Updates:
        Status: FixToInclude

Comment #2 on issue 7020 by [hidden email]: Named String  
Interpolation for String>>#format:
http://code.google.com/p/pharo/issues/detail?id=7020

Name:  
SLICE-Issue-7020-Named-String-Interpolation-for-String-format-SvenVanCaekenberghe.1
Author: SvenVanCaekenberghe
Time: 21 November 2012, 9:44:02.272 am
UUID: 16394104-0508-430f-bdc2-6206c891494c
Ancestors:
Dependencies: CollectionsTests-SvenVanCaekenberghe.579,  
Collections-Strings-SvenVanCaekenberghe.234

Extend String>>format: to accept named (key) indexes on top of the  
subscript (integer) ones so that both the following now work:

   'Today is {1}.' format: {Date today}.
   'Today is {date}.' format: (Dictionary with: #date->Date today).

Clean up the implementation to modern standards (removed 2 private String  
methods, #evaluateExpression:parameters: and #getEnclosedExpressionFrom:  
and rely on Exceptions).

Added extra unit tests to StringTest.


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 7020 in pharo: Named String Interpolation for String>>#format:

pharo
Updates:
        Status: Integrated

Comment #3 on issue 7020 by [hidden email]: Named String  
Interpolation for String>>#format:
http://code.google.com/p/pharo/issues/detail?id=7020

in 2.0 415


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 7020 in pharo: Named String Interpolation for String>>#format:

pharo

Comment #4 on issue 7020 by [hidden email]: Named String  
Interpolation for String>>#format:
http://code.google.com/p/pharo/issues/detail?id=7020

 From suggestion to my image in under a day. I love this community :)


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 7020 in pharo: Named String Interpolation for String>>#format:

pharo

Comment #5 on issue 7020 by [hidden email]: Named String  
Interpolation for String>>#format:
http://code.google.com/p/pharo/issues/detail?id=7020

Thx!

You made it easy: your question included the solution.

And I could remove two methods from String.


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker