[OpenLayers-Dev] status of translation possibilities

Lourens Veen veen at science.uva.nl
Sat Oct 20 15:28:52 EDT 2007

On Saturday 20 October 2007 19:02:15 Gertjan van Oosten wrote:
> As quoted from Lourens Veen:
> > I haven't followed this thread that carefully so maybe it has come
> > up already, but what about number formats? OL's current scale
> > display uses K and M for thousands and millions, which is not how
> > it's commonly done on paper maps. I'd really rather have it write
> > out the full number, but of course it would then have to use a
> > number format that is appropriate to the locale. In Dutch, I would
> > like it to say 1:50.000, while in English that would be 1:50,000.
> >
> > If you're designing i18n anyway...
> Well, strictly speaking you're talking about L10n (Localisation).

That's not quite how I thought the terms were used, and Wikipedia seems 
to agree with me. Adding the capability for numbers to be formatted in 
different ways is i18n, adding specific number formats for certain 
locales would be L10n. Not that it affects the technical argument :-).

> That's currently beyond MapBuilder's reach, as you would need
> locale-specific formatters for that (date, numbers, money).  It is
> doable; some JavaScript classes to do this may be available out
> there.  I haven't taken the effort to integrate them into MapBuilder
> though (not enough demand). Once you have these L10n classes, fitting
> them into the i18n framework is easy, as I will show below.
> Let's say we start out with:
>   var msg = "Scale 1:" + map.scale;
> which (if map.scale==25000) would give us "Scale 1:25000", in any
> language.
> Say the message key "mapScale" maps to the message format string
> "Scale 1:{0}" in English or "Schaal 1:{0}" in Dutch.  After the I18n
> step it would be: var msg = OpenLayers.String.format("mapScale",
> msp.scale); which would give "Scale 1:25000" in English and "Schaal
> 1:25000" in Dutch.
> If we then add L10n, e.g.:
>   var formattedNumber =
> OpenLayers.Something.DecimalFormat(map.scale); would return the
> number formatted according to the proper decimal format for the
> current locale, e.g. #,### for UK or #.### for NL.
> Combining the two:
>   var msg = OpenLayers.String.format("mapScale", formattedNumber);
> would return the I18n'ed message, and since the formattedNumber is
> L10n'ed, the resulting message would be say "Scale 1:25,000" in
> English and "Schaal 1:25.000" in Dutch.
> As you see, I18n and L10n are quite complementary.  So the two could
> be implemented separately (and could even have separate RFC's, which
> has my preference).

Sounds good to me. Unfortunately I have no time to work on it myself at 
the moment, but I thought I'd mention it in case your tuits were round 


          ir. Lourens Veen          University of Amsterdam - IBED
                                    Nieuwe Achtergracht 166
    Scientific Software Engineer    1018 WV Amsterdam, The Netherlands
             EcoGRID-GAN            t: +31 20-5257453  f: +31 20-5257431

More information about the Dev mailing list