[OpenLayers-Dev] status of translation possibilities

Jachym Cepicky jachym.cepicky at gmail.com
Thu Oct 18 15:08:25 EDT 2007

Christopher Schmidt píše v Čt 18. 10. 2007 v 14:31 -0400:
> On Thu, Oct 18, 2007 at 12:23:27PM -0500, Erik Uzureau wrote:
> > or maybe to keep the namespaces straight and clean, more like this:
> > 
> > OpenLayers.Strings.languages['english'] = {
> >    'foo': "Foo for president",
> >    'bar': "Bar for gardner"
> > };

This is IMHO bad, because it makes things untransparent. I would suggest
using whole english strings as key:

OpenLayers.Strings.languages['czech'] = {
    'Foo for president': "Foo prezidentem!",
    'Bar for gardner': "Bar zahradníkem!"

more comments below
> This seems fine to me.
> > OpenLayers.String.setLanguage = function(lang) {
> >    OpenLayers.Strings.language = lang;
> > }
> setLanguage, if we're going to provide a method for it, is going to need
> to be more complex than that. We'd have to loop through the controls,
> and call redraw() on them, to update their text, and I'm not sure that
> all controls would support a redraw correctly.
> > OpenLayers.String.get = function(strKey) {
> >    return OpenLayers.Strings.languages[OpenLayers.String._language][strKey];
> > }
> It needs to be more complex than this to support interpolation, and I
> think it will need to: as the RFC says:
> "The OpenLayers.String object will have an additional function,
> translate. Translate will accept a translation key -- a single string
> which can be used to look up the string -- and any number of additional
> arguments. If additional arguments are passed, they will be interpolated
> in the string in order."
> MapBuilder already has some code that does this, so we can work with
> them to integrate those bits of it into OpenLayers.  
> It seems there is a general agreement that we need to do this. There are
> more technical details to work out:
>  * What is the expectation we provide for updating existing langauge
>    strings in the code? For example, controls will probably soon have
>    the ability to display titles in a control.panel object. However, the
>    title property is set on the div when it's created. Do we need to
>    make a redraw() that works for all controls that would use text? Does
>    this block integration of i18n support into core? (See also: CSS
>    support for display, which we didn't block on.) 
>  * Do we block putting the library into core until we have all the
>    strings pulled out? (I think that given how little text we have, I
>    think this is 'yes'.)


>  * Do we block all future commits that include text on getting it using
>    the translation system? I think the answer to this is also yes.

> How far do we go before we put code in trunk?

There should be just general support for this. Methods for setting the
language of the map/OpenLayers (Something like ProxyHost) and support
for translations files. Translation is a job, which will never be marked
as "done". It will always change, the translators never translate
everything, and so on.
> I think that some people who know more about i18n than me should start
> pondering all the things that an english speaker like me is going to
> screw up :) MapBuilder's experience here is, again, instructive. 

Few more comments: 
I agree, that there are only few strings in current version. However,
this is a job, which will never be marked as done :) Also, one has to
distinguish  between debugging messages nad standard user
messages/strings. Also translation will never be completed 

just my 2 cents

Jachym Cepicky
e-mail: jachym.cepicky at gmail.com
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Toto je =?UTF-8?Q?digit=C3=A1ln=C4=9B?=
	=?ISO-8859-1?Q?_podepsan=E1?= =?UTF-8?Q?_=C4=8D=C3=A1st?=
Url : http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20071018/bc3ebe47/attachment.bin

More information about the Dev mailing list