[opencms-dev] Locale macro in XSD schema

Arturo Martín Lladó arturo.martin.llado at gmail.com
Fri Feb 15 17:18:11 CET 2013


Hi, Rüdiger.

I can say it's a very original solution :-)

Unfortunately, the categories should be administrated (and localized,
they are siblings with different Title property) by the final users,
and the edition of a Java properties file it's not a solution suitable
for them.

That's why we have a categories taxonomy like this:

=====
/_categories
    ca
        categories with locale "ca" configured as property by the parent
        [...]
    es
        categories with locale "es" configured as property by the parent
        [...]
=====

and that's why we'd like to offer to the final user a default category
pointed using de "configuration" attribute of the CategoryWidget.

Thank you anyway, Rüdiger. I really appreciate your help and any other
tip about this problem will be very welcome.

I guess that support for macros processing on the "configuration"
attribute of the layout widgets could be part of the wishlist of the
next release of OpenCms :-)

Again, thanks for your help and have a nice weekend.

Regards.

2013/2/15 Rüdiger Kurz <r.kurz at alkacon.com>:
> Hi,
>
> think you are right with your assumption. What you're trying to archive is
> localization of categories. I might be wrong, but I think that localizing
> categories,tags,facets,... does not make that much sense, since the 'tags'
> should be the same for one content. (Categories are assigned to VFS
> resources not to the real-localized content).
>
> However, I would try to use the same taxonomy for all languages and then
> localize its output at rendering time: The messages.properties could have
> entries per category path, using dots instead slashes and then on JSP side
> you will replace the slashes pf the category path with dotes and try then to
> receive the localized value.
>
> What do you think?
>
> Am 15.02.2013 16:49, schrieb Arturo Martín Lladó:
>
>> Hi, Rüdiger.
>>
>> I tried with this:
>>
>>             <resourcebundles>
>>                  <xmlbundle name="element.workplace.xml">
>>                      <bundle locale="ca">
>>                          <resource
>> key="package.element.language">ca</resource>
>>                      </bundle>
>>                      <bundle locale="es">
>>                          <resource
>> key="package.element.language">es</resource>
>>                      </bundle>
>>                  </xmlbundle>
>>              </resourcebundles>
>>
>> The value stored in %(key.package.element.language) is displayed OK in
>> the default values of OpenCmsString fields, but it seems to be ignored
>> in the attribute "configuration" of a CategoryWidget.
>>
>> Is this the expected behaviour? Maybe macros are not processed in
>> <layout> elements?
>>
>> Kind regards.
>>
>> 2013/2/15 Rüdiger Kurz <r.kurz at alkacon.com>:
>>>
>>> Hi,
>>>
>>> it's me again. You can access localized message bundles with:
>>> %(key.your.label)
>>>
>>> imagine a XSD:
>>>
>>> <resourcebundle name="your.package.workplace"/>
>>> [...]
>>> <layout element="Elem"
>>>          widget="CategoryWidget"
>>>          configuration="... %(key.language) ..." />
>>>
>>> and a workplace_en.properties
>>> containing:
>>> language=en
>>>
>>> and a workplace_de.properties
>>> containing:
>>> language=de
>>>
>>> This should do the trick.
>>>
>>> regards
>>> Rüdiger
>>>
>>>
>>> Am 15.02.2013 14:39, schrieb Rüdiger Kurz:
>>>
>>>> sorry not quiet sure if this works inside the XSD, but inside the
>>>> content editor you can use it.
>>>>
>>>> Am 15.02.2013 14:37, schrieb Rüdiger Kurz:
>>>>>
>>>>>
>>>>> yes, %(request.locale)
>>>>>
>>>>> Am 15.02.2013 14:27, schrieb Arturo Martín Lladó:
>>>>>>
>>>>>>
>>>>>> Hi, list.
>>>>>>
>>>>>> Is there available any locale macro for using it in XSD schemas?
>>>>>>
>>>>>> I'd like to do something like this:
>>>>>>
>>>>>>      <layouts>
>>>>>>                   [...]
>>>>>>                   <layout element="Categoria" widget="CategoryWidget"
>>>>>>
>>>>>>
>>>>>> configuration="category=/_categories/__LOCALE_MACRO___/tipoDocumento/|onlyleafs=true"/>
>>>>>>
>>>>>>
>>>>>>      </layouts>
>>>>>>
>>>>>> This is because our categories tree is organized this way:
>>>>>> /sites/default/_categories/__LOCALE__/...
>>>>>>
>>>>>> Kind regards.
>>>>>>
>>>>>
>>>>
>>>
>>> --
>>> Kind Regards,
>>> Rüdiger.
>>>
>>> -------------------
>>>
>>> Rüdiger Kurz
>>>
>>> Alkacon Software GmbH  - The OpenCms Experts
>>> http://www.alkacon.com - http://www.opencms.org
>>> _______________________________________________
>>> 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/cgi-bin/mailman/listinfo/opencms-dev
>>>
>>>
>>>
>>
>>
>>
>
> --
> Rüdiger Kurz
>
> -------------------
>
>
> Alkacon Software GmbH - The OpenCms Experts
> Rüdiger Kurz
> An der Wachsfabrik 13
> 50996 Koeln, DE
>
> Tel: +49 (0)2236 3826-16
> Fax: +49 (0)2236 3826-20
> Email: r.kurz at alkacon.com
>
> http://www.alkacon.com
> http://www.opencms.org
>
> Geschäftsführer: Alexander Kandzior, Amtsgericht Köln, HRB 54613
> _______________________________________________
> 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/cgi-bin/mailman/listinfo/opencms-dev
>
>
>



-- 
Arturo Martín Lladó



More information about the opencms-dev mailing list