Skip to content
dbu edited this page Feb 3, 2012 · 4 revisions

The multilanguage functionalities handle translations of documents. This is not part of core PHPCR but built on top of the API.

User Documentation

See the README file in the repository root folder

Notes on node relations (hierarchy and references)

For now, Child, Children, Parent, ReferenceMany, ReferenceOne and Referrers will all fall back to the default language. The reason for this is that there can be only one tracked instance of a document per session. (Otherwise what should happen if both copies where modified?...).

We could keep track of the locale used for a particular document in the proxies and translate its children or references when they are requested. But this would lead to confusing situations. Image i have a document A with children B and C. I load document B in english, then i load A in french and use its child B. Now the previously loaded document B is french because its the same document. I also use the child C, then load C through the DocumentManager in english and from then on the child is english as well.

So better then making promises we can't keep, we chose to declare we don't track language in relations. One thing that could be implemented would be a findTranslation(..., $detached=true) method to get a document in DETACHED mode, and have all relations be new instances of detached documents in the requested language. For reading purposes this could be helpful. Storing of detached documents is prohibited and thus we would not run into the problems mentioned above.

The code for the proxies is reverted in this commit: https://github.com/liip/phpcr-odm/commit/677fffa6cba939c1552029910b383c911550ddc8 When this is implemented, there are almost ready but commented out tests in tests/Doctrine/Tests/ODM/PHPCR/Functional/Translation/TranslationHierarchyTest.php