You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Grizz Lee <gr...@hotmail.com> on 2007/05/21 11:49:15 UTC

Properties in multiple languages

Hi all,
 
I have an application that stores projects with a code and a name in a jackrabbit repository.
In a new version of this application it must be possible to have names in english and in french.
 
The project is now defined in the cnd file as:
[app:project] > nt:folder
- app:code (string)
- app:name (string)
 
I don't want to specify the languages in the property names:
[app:project] > nt:folder
- app:code (string)
- app:name-en (string)
- app:name-fr (string)
 
So I'm thinking to make a name-language childnode:
[app:project] > nt:folder
- app:code (string)
+ * (app:name) multiple
[app:name] > nt:hierarchyNode
- app:name (string)
- app:language (string)
And then use XPath to select the correct childnode for a given language.
 
Is there a better way to handle multiple languages or is this the way to go?
Comments are welcome.
 
Grizz.
 
_________________________________________________________________
Explore the seven wonders of the world
http://search.msn.com/results.aspx?q=7+wonders+world&mkt=en-US&form=QBRE

RE: Quick question about permissions

Posted by Frédéric Esnault <fe...@legisway.com>.
Wow, is this true?

Is it true that JackRabbit does not automatically permissions?
And if it's, can we have an idea why?

Or maybe it's an option when the permission is set ?

Frédéric Esnault
 

-----Message d'origine-----
De : news [mailto:news@sea.gmane.org] De la part de Christoph Kiehl
Envoyé : vendredi 15 juin 2007 15:38
À : users@jackrabbit.apache.org
Objet : Re: Quick question about permissions

Paco Avila wrote:
> I've implemented my own access manager to protect some documents and folders
> (the application is an Document Management System -> OpenKM). Look at this folder hierarchy:
> 
>  root -> folder1 -> folder2 -> testDocument
> 
> If I protect 'folder2' (user can't read) when I search the 'testDocument' is included
> in the search results, why? 

AFAIK the result iterator in Jackrabbit calls isGranted() on your access 
manager just for "testDocument". This means if you want to inherit the 
permissions for "testDocument" from "folder2" you need to implement that 
in your isGranted() method. Jackrabbit does not automatically inherit 
permissions.

Cheers,
Christoph


Re: Quick question about permissions

Posted by Christoph Kiehl <ck...@sulu3000.de>.
Paco Avila wrote:
> I've implemented my own access manager to protect some documents and folders
> (the application is an Document Management System -> OpenKM). Look at this folder hierarchy:
> 
>  root -> folder1 -> folder2 -> testDocument
> 
> If I protect 'folder2' (user can't read) when I search the 'testDocument' is included
> in the search results, why? 

AFAIK the result iterator in Jackrabbit calls isGranted() on your access 
manager just for "testDocument". This means if you want to inherit the 
permissions for "testDocument" from "folder2" you need to implement that 
in your isGranted() method. Jackrabbit does not automatically inherit 
permissions.

Cheers,
Christoph


Quick question about permissions

Posted by Paco Avila <pa...@git.es>.
I've implemented my own access manager to protect some documents and folders
(the application is an Document Management System -> OpenKM). Look at this folder hierarchy:

 root -> folder1 -> folder2 -> testDocument

If I protect 'folder2' (user can't read) when I search the 'testDocument' is included
in the search results, why? 

Note: You can see the access manager source code at:

http://openkm.cvs.sourceforge.net/openkm/openkm/src/es/git/openkm/core/OKMAccessManager.java?revision=1.1&view=markup
-- 
Paco Avila <pa...@git.es>


Re: Properties in multiple languages

Posted by Alexandru Popescu ☀ <th...@gmail.com>.
On 5/24/07, Jukka Zitting <ju...@gmail.com> wrote:
> Hi,
>
> On 5/21/07, Grizz Lee <gr...@hotmail.com> wrote:
> > I have an application that stores projects with a code and a name in a jackrabbit
> > repository. In a new version of this application it must be possible to have names
> > in english and in french.
> > [...]
> > So I'm thinking to make a name-language childnode:
> > [app:project] > nt:folder
> > - app:code (string)
> > + * (app:name) multiple
> > [app:name] > nt:hierarchyNode
> > - app:name (string)
> > - app:language (string)
> > And then use XPath to select the correct childnode for a given language.
> >
> > Is there a better way to handle multiple languages or is this the way to go?
> > Comments are welcome.
>
> There's no clear best practice yet on how to represent multilingual
> content. I would also go for separate child nodes for the different
> languages, but in a slightly more general mannner:
>
>     [i18n:localizable] mixin
>     + * (i18n:localization)
>
>     [i18n:localization]
>     - * (STRING)
>
> A i18n:localizable node could have any number of i18n:localization
> child nodes named after the specific language. The localization nodes
> could have any string properties with translated values. Something
> like this:
>
>     .../mynode
>     .../mynode/i18n:en
>         - title = "Hello, World!"
>     .../mynode/i18n:fi
>         - title = "Hei maailma!"
>

We are using exactly this model to store i18n values, so thanks for
confirming our initial modelling :-).

> The downside of using child nodes is that even though Jackrabbit
> currently does support the child axis in XPath predicates the standard
> JCR API does not, so you can't formulate standard queries that look
> for properties both in the mynode parent and in a i18n:* child.
>

I am still wondering about some of these details in the spec. Most of
the time they sound like limitations on some of possible
implementations, but nothing that couldn't be overcome.

./alex
--
.w( the_mindstorm )p.

> BR,
>
> Jukka Zitting
>

Re: Properties in multiple languages

Posted by Tako Schotanus <qu...@gmail.com>.
On 5/24/07, Jukka Zitting <ju...@gmail.com> wrote:
> Hi,
>
> On 5/21/07, Grizz Lee <gr...@hotmail.com> wrote:
> > I have an application that stores projects with a code and a name in a jackrabbit
> > repository. In a new version of this application it must be possible to have names
> > in english and in french.
> > [...]
> > So I'm thinking to make a name-language childnode:
> > [app:project] > nt:folder
> > - app:code (string)
> > + * (app:name) multiple
> > [app:name] > nt:hierarchyNode
> > - app:name (string)
> > - app:language (string)
> > And then use XPath to select the correct childnode for a given language.
> >
> > Is there a better way to handle multiple languages or is this the way to go?
> > Comments are welcome.
>
> There's no clear best practice yet on how to represent multilingual
> content. I would also go for separate child nodes for the different
> languages, but in a slightly more general mannner:
>
>     [i18n:localizable] mixin
>     + * (i18n:localization)
>
>     [i18n:localization]
>     - * (STRING)
>
> A i18n:localizable node could have any number of i18n:localization
> child nodes named after the specific language. The localization nodes
> could have any string properties with translated values. Something
> like this:
>
>     .../mynode
>     .../mynode/i18n:en
>         - title = "Hello, World!"
>     .../mynode/i18n:fi
>         - title = "Hei maailma!"

But doesn't this mean that the i18n:xx nodes are always, let's say,
"untyped"? Because the node definition of "mynode" could contain the
"title" property for example, but you can't do that for the i18n:xx
sub-node because you might need it for a bunch of other node types as
well.

I've used a very similar structure where it basically comes down to
naming conventions: "mynode" would just be a generic folder type while
the name of the node itself determines it's language, but somehow for
me it doesn't "feel right". It depends too much on a rule of thumb. Of
course you can make a tool that enforces the rule but still.

In other cases I tend to only allow translated resources and have an
extended nt:resource that has a language attribute and something
similar to nt:file that allows multiple nt:resources.

But in the end I'm still looking for a way to solve this
transparently, a bit in the way that you don't know if your repository
has versioning or not, a way where I automatically get the resources
in my defined language if it exists or a fallback if it doesn't. :-)

Re: Properties in multiple languages

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On 5/21/07, Grizz Lee <gr...@hotmail.com> wrote:
> I have an application that stores projects with a code and a name in a jackrabbit
> repository. In a new version of this application it must be possible to have names
> in english and in french.
> [...]
> So I'm thinking to make a name-language childnode:
> [app:project] > nt:folder
> - app:code (string)
> + * (app:name) multiple
> [app:name] > nt:hierarchyNode
> - app:name (string)
> - app:language (string)
> And then use XPath to select the correct childnode for a given language.
>
> Is there a better way to handle multiple languages or is this the way to go?
> Comments are welcome.

There's no clear best practice yet on how to represent multilingual
content. I would also go for separate child nodes for the different
languages, but in a slightly more general mannner:

    [i18n:localizable] mixin
    + * (i18n:localization)

    [i18n:localization]
    - * (STRING)

A i18n:localizable node could have any number of i18n:localization
child nodes named after the specific language. The localization nodes
could have any string properties with translated values. Something
like this:

    .../mynode
    .../mynode/i18n:en
        - title = "Hello, World!"
    .../mynode/i18n:fi
        - title = "Hei maailma!"

The downside of using child nodes is that even though Jackrabbit
currently does support the child axis in XPath predicates the standard
JCR API does not, so you can't formulate standard queries that look
for properties both in the mynode parent and in a i18n:* child.

BR,

Jukka Zitting