[Babel] Where to translate?

Avi Bryant avi at beta4.com
Sat Sep 27 21:11:02 UTC 2003


On Sat, 27 Sep 2003 diegogomezdeck at consultar.com wrote:

> If we follow the idea of making the translation a responsibility for the
> view we have to expand the protocol for all the widgets (morph, mvc, html
> frameworks, etc) including some support to put on them "expandable"
> strings to avoid the translation of every combination of concatenated
> strings.  (The same idea behind the #format: method in Babel but in the
> widgets).

Rather than changing the protocol to have
translated/untranslated/formatted versions of each method, I would
instead increase the number of objects that respond to #translated, or say
#translatedString.

String>>translatedString
  ^ self translated

UntranslatedString>>translatedString
 "a wrapper around a string"
  ^ string

FormattedString>>translatedString
  "a wrapper around a format string and args"
  ^ format translatedString substituteArguments: args

Then we just have to change the current UI methods to send
#translatedString, and we can suppress translation or use formatting by
changing the object that we pass into them.





More information about the Squeak-dev mailing list