I need to internationalize Pier components. I am doing
a site with Pier for
Spanish people. The final user has access to Pier components. For example,
it can leave comments or even post. But pier components have the html
outputs in English. For example when you are going to create a post you have
"author, publish, tags, ..." and I want "autor, publicacion,
etiquetas...".
Sounds like a really interesting project. Keep us posted on the progress.
Ok, after said that, I want to add int18 to my website
but I don't want to
touch Pier code. So, the solution I thought is this:
That would be a goal for the next big release then. I created an
issue: <http://code.google.com/p/pier/issues/detail?id=95>.
We were sort of thinking of providing an internationalization package
as part of Seaside 2.9, because this is something quite a lot of
people want. Especially in the context of web applications. However we
didn't do anything yet.
override String #printOn: or Object #printString
(which one could be
better?) to something like this:
(suppose I override printOn:)
Uhh, that sounds scary, but I guess you are discussing this already on
the Pharo list ;-)
Could this be a good idea? Any other solution ?
That's certainly an approach.
For Magritte strings (in fact Magritte has already been used in fully
localized applications) it would be easy just to change the
descriptions. If there is the description:
PRStructure>>descriptionTitle (in package Pier-Model)
^ MAStringDescription new
accessor: #title;
label: 'Title';
yourself
You can add the method:
PRStructure>>descriptionTitleSpanish: aDescription (in package
Pier-Localized-Spanish)
^ aDescription label: 'título'
Instead of using a hardcoded string you could also use your own "smart
string implementation" that knows how to translate to different
languages. At least this is what I've done in various commercial
projects.
Now that doesn't solve the problems of the Strings in Pier itself.
Maybe it is the easiest if you just make a package that overrides the
respective methods that you always load after updating to Pier?
Cheers,
Lukas
--
Lukas Renggli
http://www.lukas-renggli.ch