[opencms-dev] OpenCMS 6.0-alpha2 Multi-language support

Stephan Hartmann beffe at beffe.de
Thu Nov 25 21:51:25 CET 2004


----- Original Message -----
From: "Alexander Kandzior" <alex at opencms.org>
To: <olli_aro at yahoo.co.uk>; "'The OpenCms mailing list'"
<opencms-dev at opencms.org>
Sent: Thursday, November 25, 2004 2:55 PM
Subject: RE: [opencms-dev] OpenCMS 6.0-alpha2 Multi-language support


> I currently don't really have any better idea either,
> yet I assume it me be possible to come up with a more elegant solution.
>
> As properties are internally now Objects, e.g. it may be possible to have
> locale support on these Objects.
>
> The API could be something like this:
>
> ------------
> CmsProperty prop = readPropertyObject("/index.html", "Title", false);
>
> // current solution:
> String title = prop.getValue();
>
> // future solution:
> String title2 = prop.getValue(Locale.ENGLISH)
> ------------
>
> Quesstion is how to save this best in the DB, without creating too much
> complexity.
>

I would suggest a new table:
I18N_SUPPORT
---------------
OBJECT_ID  (FK)
LOCALE
VALUE
---------------
primary key (OBJECT_ID, LOCALE)

this is the most simple version where OBJECT_ID is the id of the property or
any other resource that is or may come which needs internationalization.
there could also be more types of VALUE, i.e. BLOB_VALUE and VARCHAR_VALUE
to meet the necessary size of a value.

Classes that support i18n could implement a new interface I_I18nSupport that
defines methods like getValue(Locale), getValues() which returns a Map and
something like a best match method if you request the value for en_US but
only have the value for en.

Classes that have more than one field, e.g. CMS_GROUPS (name and
description) could hold references to some kind of I18nField and store its
id in the table.
While the CmsGroup could keep the method getName() it would introduce a
method getName(Locale).  The member m_name would be of type I18nField. The
I_I18nSupport would define a method getValue(String key, Locale locale) and
all implementing classes would define their possible keys as constants, e.g.
public static final String NAME = "name".
CmsGroup.getValue(CmsGroup.NAME, Locale l) would just call
CmsGroup.getName(Locale l) which would return m_name.getValue(Locale l).

Classes like CmsProperty and I18nField would be some kind of I18n primitive,
while CmsGroup is a I18n complex type.

Regards,
Stephan


> Best Regards,
> Alex.
>
> Alexander Kandzior
> Alkacon Software - The OpenCms Experts
> http://www.alkacon.com
>
>
>
> > -----Original Message-----
> > From: opencms-dev-bounces at opencms.org
> > [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Olli Aro
> > Sent: Thursday, November 25, 2004 2:20 PM
> > To: 'The OpenCms mailing list'
> > Subject: RE: [opencms-dev] OpenCMS 6.0-alpha2 Multi-language support
> >
> > I have thought lately a lot about possible options for
> > implementing locales in properties / metadata and think the
> > only viable option is to use schema such as title_en,
> > title_de... What do others think?
> >
> > Regards,
> >
> > Olli
> >
> >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.797 / Virus Database: 541 - Release Date: 15/11/2004
> >
> >
> >
> >
> > _______________________________________________
> > This mail is send to you from the opencms-dev mailing list To
> > change your list options, or to unsubscribe from the list,
> > please visit http://mail.opencms.org/mailman/listinfo/opencms-dev
> >
> >
>
>
>
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev
>




More information about the opencms-dev mailing list