Forum OpenACS Development: localization for category trees fixed

Localization is/was somewhat half-hearted implemented in the api for category trees. Some calls had an argument for localization (e.g. get_name), others did not (get_mapped_trees, get_mapped_trees_from_object_list).

Furthermore, category_tree::get_name had the argument locale, but did silently ignore this.

I fixed the mentioned bugs in a way that is backward and style compatible and committed the changes to CVS HEAD. i have not fixed category_tree::get_multirow, which has still no locale argument, i am not sure where this is usd and whether locale is wanted (on the adp side, you have normally no option to use a different locale).

Concerning Malte's wish for listing language-specific category trees (see xowiki 0.39 thread):

The xowiki includelets "categories", and "categories-recent" have now a "-locale" option which allows to listen only entries in a specified locale. The parameter allows

  • a locale
  • the value "default", to listen only the entries with the default locale (depending on package parameter), or
  • "default+system" to listen the default locale and additionally the entries in the system locale, when the entry does not exist in the default locale.
Needless to say, the last case is the slowest.

Malte, you own me at least a beer.

Collapse
Posted by Malte Sussdorff on
on the risk of sounding utterly stupid, where should I add the switch? I looked at your recent commit and saw that you prepared the -locale switch, but I did not find a suiteable location to put it in categories.tcl. Or did you forget to commit the two?

As for the beer: Yeah, sure, let's meet in Budapest or Vienna in the new year!

Collapse
Posted by Gustaf Neumann on
the implementation is for the newer style of includes, where one can write in a wiki page e.g.


    bla bla
    {{categories -locale default+system}}
    ...

The applicable options can be found under "-parameter" in xowiki-portlet-procs. In yesterdays code, I have not simplified the usage of the new-style xowiki portlets for the cases, where some adp-file includes the portlet (such as oacs-view.adp).

For this purpose, i have added yet another two-liner named include to CVS, such one can now quite simply all kind of new-style xowiki portlets with the same syntax as inside of an xowiki page between the double curly braces.

In essence, one can write now in the code of the oacs-view

<DIV ..>
<include src="/packages/xowiki/www/portlets/include"
    &__including_page=page
    portlet="categories -locale default+system -open_page \@name\@ -decoration plain">
<hr>
<include src="/packages/xowiki/www/portlets/include"
    &__including_page=page
    portlet="categories -open_page \@name\@ -decoration plain">
</DIV>

where you get now the categories twice, once with new 2-language entries, and then with the default (now filtering on locale)

Collapse
Posted by Malte Sussdorff on
Ah. Thanks a lot for the explanation. Will try this out. Sadly the code you posted with the include gives me the error message:

[23/Dec/2006:15:18:55][12028.163848][-conn:3-] Notice: --including_page= page, portlet=categories -locale default -open_page @name@ -decoration plain
[23/Dec/2006:15:18:55][12028.163848][-conn:3-] Error: Error in include template "/web/cognovis/packages/xowiki/www/portlets/include": invalid command name "page"
invalid command name "page"

Collapse
Posted by Gustaf Neumann on
are you telling me, that the provided oacs-view.adp does not work? i have doubts. Can it be, that you forgot the ampersand in your include page?
Collapse
Posted by Malte Sussdorff on
No, I was even more stupid. I added "no_tree_name = 1" instead of saying "-no_tree_name 1". This did the trick.
Collapse
Posted by Malte Sussdorff on
Just to let you know that I tried it out with the include in the xowiki page itself (your first method) and it worked out beautifully. Thank you so much for this great work.