Menu

#78 partial improvement to i18n for navigation component

open
nobody
None
5
2006-05-12
2006-05-12
adry
No

Patch to handle multiple language items in the
navigation component.

The problem is that when a navigation category is
selected, all the language variants of each item are
shown, and this is not correct and confusing for the
user.
The chosen approach is:

-add the possibility to the object that retrieve the
items to be shown
(com.arsdigita.london.navigation.cms.CMSDataCollection
Definition) to add the constraints on the language to
be used. For this, a new constructor, recieving as
parameter the flag enabling the filterByLanguage has
been added.
The CMSDataCollection object, when build the filter
for retrieving the matching items, if the filter by
language flag is enabled, add the language condition
to the query.

-to do this, the CMSDataCollectionDefinition need to
compute the language to be used as current language.
For this, a new class has been defined:

com.arsdigita.london.navigation.util.LanguageUtil.

It has a static method: String negotiateLanguage()
which returns the current language to use.
It retrieves from the request the valid locales, from
the CMS
(com.arsdigita.cms.util.LanguageUtil.getSupportedLangu
ages2LA()) the supported languages and then compute
the best one to use. If none is found, the "en"
language is returned.
(The approach has been is similar to the one
implemented by the ContentBundle.negotiate method).

-to enable this feature, the objects that use the
CMSDataCollectionDefinition should set the flag
filterByLanguage.
This is done by:

com.arsdigita.london.navigation.portlet.ItemListPortle
t, when it creates CMSDataCollectionDefinition.
and by:
the jsp packages.navigation.templates.default.jsp,
when it creates CMSDataCollectionDefinition.

Other modifications have been made in the
com.arsdigita.london.navigation.ui.ContentList and
GreetingItem object
which negotiate the item to be shown by calling the
method:

negotiate(Web.getRequest().getLocales())
of the ContentBundles to be shown.

Still to e done:
internationalization to the navigation categories.

Discussion


Log in to post a comment.