[OpenLayers-Dev] Additional Lang Files

Christopher Schmidt crschmidt at metacarta.com
Fri Jan 30 07:21:56 EST 2009


On Thu, Jan 29, 2009 at 03:00:15PM -0800, Chris Claydon wrote:
> Hi,
> 
> I work on the MapGuide Open Source project, which makes use of OpenLayers via the Fusion open source viewer. We'd like to add support for Spanish, Hungarian, and possibly Japanese localized strings to OpenLayers, and we have a couple of questions...

Chris,

I think what you're seeing is clear evidence that there is not a strong
consensus on the right way to do language files yet. :) Our typical
coding style dictator (Erik) was not involved in the i18n process, so we
didn't get the usual set of process instructions for these files :)

What I would recommend is:
 * Creating a two-char lang file for the 'base' of the language
 
 * If there is a different interpretation of the language for a
   sub-language -- for example, en-GB spells 'colour' differently --
   extend from the default/'base' of that language.

   OpenLayers will automatically handle taking the user's client
   language ("en-GB") and falling back to en if there is no -GB
   translation file.

 * I don't have an opinion on whether we should extend from English
   or not. If we do, then missing translations get an english string. I
   we don't, missing translations get a string like
   'olMessageStringKey'. I tend to think the former is better than the
   latter -- at least *some* foreign speakers will be able to handle it,
   as opposed to 'none'.

> So, when creating new language resources, which is the best model to follow? Is there any documentation on this, or any general guidelines?

Not yet, but I'm glad to hear you're interested in helping to build them
:) More seriously, I'd welcome a cleanup according to the suggestions
above, barring any clear objections on a technical basis from other
members of the community.

Also, I'm presuming you're aware that there is already a spanish
translation...

http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/Lang/es.js

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Dev mailing list