nuxeo-localizer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nuxeo-localizer] Use of Catalog


From: Garikoitz Araolaza
Subject: Re: [Nuxeo-localizer] Use of Catalog
Date: Fri, 07 Jun 2002 13:53:22 +0200

At 13:05 07/06/02, you wrote:
LocalContent is Catalogged after creation, but Vocabulary contains only words from title (only one language). Is there a possibility to search LocalContent objects by other Local properties? What should I do to enforce Catalog to search LocalContent by its multilingual content ?


Yes...

I usually do it this way:


1- Create Python Scripts in the root of your site, one per language:

text_en

And put inside:

    return '%s %s' % (context.title_en, context.body_en)

text_fr

    return '%s %s' % (context.title_fr, context.body_fr)

and so on...


Then, add  text_en, text_fr and so on as text indexes in your Catalog.

This way you will have different indexes depending on the language.

Now, you just have to do:

<dtml-call "REQUEST.set('text_en', your_variable_with_text_to_search)">
<dtml-in Catalog....>

</dtml-in>

In order to have only one method for all languages, you can first apply our Localizer Tip #1
http://www.zope.org/Members/CodeSyntax/DTML_Localizer

and once you've got SELECTED_LANGUAGE, then you can do:

<dtml-call "REQUEST.set('text_'+SELECTED_LANGUAGE, your_variable_with_text_to_search)">
<dtml-in Catalog....>

</dtml-in>

This way your user will always search in his selected language.

Gari

PS: yes... I know it's a little bit ugly, but... why don't you give a cleaner example? ;-)


_______________________________________
Garikoitz Araolaza
Code&Syntax
address@hidden

BIC-Berrilan
Azitaingo Industrialdea
E-20600-EIBAR
Tel: +34 943 82 06 06





reply via email to

[Prev in Thread] Current Thread [Next in Thread]