[opencms-dev] OpenCMS website localization

Martin Wunderlich mwunderlich at salesforce.com
Thu Sep 18 12:47:22 CEST 2008


Hi Michael,

Thanks a lot for sharing! Very interesting, indeed. The link substitution handler sounds like something we could use, as well.

Cheers,

Martin


On 18/09/2008 11:33, "Michael Moossen" <m.moossen at alkacon.com> wrote:

Hi,

I just want to share my experience with content localization.

As far as i know all projects developed by Alkacon (normally i work
developing the core) that had to deal with localization were using the
several folders with siblings approach. Which is, in my opinion, quite
easy to setup but not to maintain, despite some project were also
including different approaches to automatic sibling creation.

So when i started to develop my first website from scratch with OpenCms
(http://www.moossen.net/) a couple of weeks ago, i tried a different
approach.
And i thought it would be enough with a single folder structure for all
locales, a 10 LOC locale handler (see
org.opencms.i18n.I_CmsLocaleHandler) and a cookie.

But this turned out to be a very bad and naive idea, mainly because one
URL is having different content:
- try to flush browser cache when the user changes the locale.
- try to tell google that he has to set a cookie for indexing different
languages.
- The same applies also for the static export, and everything else...

so, for now i am just appending a meaningless lang parameter to every
url, which is working but awful :(

But i learnt by heart that you MUST have different URLs for different
locales.

My next try will be (as soon as i get the time for it) to implement a
resource initialization handler (see org.opencms.main.I_CmsResourceInit)
with a link substitution handler (see
org.opencms.staticexport.I_CmsLinkSubstitutionHandler).

The idea is to have in OpenCms a single folder structure that will look
to the outside world like several folders for the locales.

On one side, the resource initialization handler will intercept the
requests and remove the leading locale folder from the URL (if you
request /en/index.html, it will read the OpenCms resource at /index.html).

And the link substitution handler will generate the links with a locale
folder prefix. (if in /index.html you have a link to /about/contact.html
(and let say the selected locale is en (with a cookie, for instance), it
will generate in the html output a link to /en/about/contact.html.

I hope this will workout as i expect, and i was just checking the API
and it seems to be easier to implement than i thought, so i better start
to code now ;)

Hope that helps

Kind regards,
Michael



Carl Alex Friis Nielsen wrote:
> No - the content resides in the resource.
> The locale property can be set by simply having all material that shall
> be available for a given
> locale under a folder with its locale property set to the desired locale.
> It really is quite simple to set up and use.
>
>     -----Original Message-----
>     *From:* opencms-dev-bounces at opencms.org
>     [mailto:opencms-dev-bounces at opencms.org]*On Behalf Of *Martin Wunderlich
>     *Sent:* Monday, September 15, 2008 11:57 AM
>     *To:* The OpenCms mailing list
>     *Subject:* Re: [opencms-dev] OpenCMS website localization
>
>     OK, but that means the content needs to be externalised to
>     properties files, right? In our case, we non-technical people
>     creating the original English content and they wouldn't necessarily
>     know how to work with properties files.
>
>     Cheers,
>
>     Martin
>
>
>     On 15/09/2008 10:35, "Carl Alex Friis Nielsen" <cfn at kb.dk> wrote:
>
>         You have multiple locales in the same resource.
>         Which locale is displayed depends on the locale property of the
>         resource.
>         Different siblings can have different locale properties.
>         The properties can be inherited from the folder hierachy in the VFS.
>
>         AFAIK this is a very widely used way to handle multilingual
>         content in OpenCms.
>
>
>             -----Original Message-----
>             *From:*  opencms-dev-bounces at opencms.org
>             [mailto:opencms-dev-bounces at opencms.org]*On  Behalf Of
>             *Martin Wunderlich
>             *Sent:* Monday, September 15, 2008  11:11 AM
>             *To:* The OpenCms mailing list
>             *Subject:* Re:  [opencms-dev] OpenCMS website localization
>
>             Hi  Steve,
>
>             Are you saying that you're using the siblings mechanism for
>              content in different languages? How would that work? AFAIK,
>             siblings are  basically pointers to the exact same content.
>
>             About the web services  interface, does OpenCms somehow
>             support SOAP calls at the moment?
>
>             Kind  regards,
>
>             Martin
>
>
>             On 15/09/2008 10:01, "Steve Bryan"
>             <steve at bright-interactive.com>  wrote:
>
>
>
>                 Hi
>
>                 One usability problem we found is that  when an editor
>                 creates a page in one
>                 language folder (eg under en), the  siblings do not get
>                 created automatically
>                 in the other language folders  (which for us is
>                 generally required except for
>                 the odd case that the  pages are only in one of the
>                 locales).
>
>                 One solution to this would be  to customize OpenCms to add a
>                 'copy-to-all-locales' function, either on  the create
>                 dialog or (more easily)
>                 as a separate context menu function.  The latter can be
>                 done by adapting the
>                 regular copy function to copy out  siblings to the other
>                 locale folders.
>
>                 An associated problem (which I  think Martin is
>                 referring to), is that title
>                 & navtext properties etc  would normally need to be
>                 translated as well as
>                 elements of pages and  structured types. One work-around
>                 for this, is to add
>                 title and nav-text  page elements, and use them instead
>                 of the properties in
>                 the template  navigation. The ideal is to ensure that
>                 all properties are
>                 locale  independent (and hence a straight sibling copy
>                 does the job). Any
>                 locale  dependent stuff should go in page elements. Then
>                 only the page  bodies
>                 need translation.
>
>                 After that, we have a batch translation  system that
>                 sounds like a much less
>                 advanced version of Martin's :-) - ie  exporting pages,
>                 getting the
>                 translation company to fill in the control  code, then
>                 re-importing. The web
>                 services idea sounds  good.
>
>                 Steve
>
>
>                 ----------------------------------------------------------------------
>
>                 Date:  Fri, 12 Sep 2008 11:23:52 +0100
>                 From: "Martin Wunderlich" <mwunderlich at salesforce.com>
>                 Subject:  Re: [opencms-dev] OpenCMS website localization
>                 To: "The OpenCms mailing  list" <opencms-dev at opencms.org>
>                 Message-ID:  <C4F001C8.2D0D%mwunderlich at salesforce.com>
>                 Content-Type:  text/plain; charset="iso-8859-1"
>
>                 Hi David,
>
>                 We currently have  17 different locales on our website
>                 (5 of them English
>                 language) and it  works somehow like this:
>
>                  *   The localised sites are  located under sub folders
>                 of the main domain,
>                 whereby the subfolder name  consists of the ISO country
>                 ID, e.g.
>                 www.salesforce.com/es for  Spanish.
>                  *   Some locale specific content is externalised  to
>                 properties files, but
>                 not the main body text of the pages.
>                  *    Translation is generally a one way street from
>                 en-US to all the  other
>                 locales.
>                  *   To get a web page translated, we  run an export
>                 that picks up the
>                 respective pages, based on a custom  property that we
>                 have included in the
>                 templates. The export file then  gets dumped to an FTP
>                 server, from where it
>                 is picked up every so often  by the translation
>                 management system (feels a
>                 bit ancient, IMHO; this  should happen in real time
>                 through a web services
>                 interface).  We do  some automated tweaks to the
>                 manifest file of the export
>                 file (replace  locales IDs and such) and then import
>                 back into OpenCms.
>
>                 Some things  that I really miss are better support for
>                 image localisation,
>                 the web  services interface mentioned above, and a
>                 better OpenCms interface
>                 for  sending files for translation. Also, it would be
>                 great to have a  WYSIWYG
>                 interface for externalising information to properties
>                 files, so  that
>                 non-technical content editors can create properties on
>                 the  fly.
>
>                 Cheers,
>
>                 Martin
>
>
>                 On 01/09/2008 11:41, "David  Valls roure"
>                 <david.valls at sogeti.com>  wrote:
>
>                 Hi All,
>
>                 i'm having some issues regarding web site  localization
>                 and I want to
>                 review if i'm doing well...
>
>                 This are my  steps:
>                 1.- new folder www at /sites/default
>                 1.1.-  properties-advanced-locale: en
>                 2.- some content-> pages with free  text
>                 3.- new folder news at www
>                 4.- add some news inside
>
>                 ok,  now i have my website in english
>
>                 How to localize?
>
>                 1.- copy  all, even siblings from www to www_es
>                 2.- Administration-> Merge pages  -> from www 2 www_es
>                 3.- Change locale-> www_es (include  subfolders) from en
>                 2 es
>                 4.- Open website and traduce all...
>                 That's  what i've done.
>
>                 repeat this steps for other languages...
>
>                 The  first thing i want to know if i'm doing well...
>                 because now i have
>                 a  problem: when i add content like pages with free text
>                 i can merge
>                 and  goon, but with news i cannot localize them... i
>                 can't copy them  to
>                 corresponding language folder...
>
>                 How do i create localized  (multilanguage) sites?
>                 How do i mantain localized (multilanguage)  sites?
>
>                 Thanks in  advice,
>
>                 David.
>
>
>
>
>
>                 _______________________________________________
>                 This  mail is sent to you from the opencms-dev mailing list
>                 To change your list  options, or to unsubscribe from the
>                 list, please visit
>                 http://lists.opencms.org/mailman/listinfo/opencms-dev
>
>
>
> ------------------------------------------------------------------------
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev

_______________________________________________
This mail is sent to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/mailman/listinfo/opencms-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20080918/ef29fc76/attachment.htm>


More information about the opencms-dev mailing list