Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit c675aa3

Browse files
committed
readded multilang docs, fix for 280bdf2
1 parent eb6fcb3 commit c675aa3

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

bundles/simple_cms.rst

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,39 @@ See the section below for multilanguage support.
101101
Multi-language support
102102
----------------------
103103

104-
@todo: Explain how multilang works now, in particular the use of ``->addLocaleFormat`` on
105-
the ``Page`` document.
104+
Setting ``addLocalePattern`` to true in the ``Symfony\Cmf\Bundle\SimpleCmsBundle\Doctrine\Phpcr\Page``
105+
document will result in prefixing the associated route with ``/{_locale}``. Using the native
106+
translation capabilities of PHPCR ODM it is now possible to create different versions of the document
107+
for each language that should be available on the website:
108+
109+
$page = new Page();
110+
111+
$page->setPosition($parent, 'hello-world');
112+
$page->setTitle('Hello World!');
113+
$page->setBody('Really interesting stuff...');
114+
$page->setLabel('Hello World');
115+
$dm->persist($page);
116+
$dm->bindTranslation($page, 'en');
117+
118+
$page->setTitle('Hallo Welt!');
119+
$page->setBody('Super interessante Sachen...');
120+
$page->setLabel('Hallo Welt!');
121+
$dm->bindTranslation($page, 'de');
122+
123+
$dm->flush();
124+
125+
.. note::
126+
127+
Since SimpleCmsBundle only provides a single tree structure, all nodes
128+
will have the same node name for all languages. So a url
129+
``http://foo.com/en/hello-world`` for english content will look like
130+
``http://foo.com/de/hello-world`` for german content. At times it might be most
131+
feasible to use integers as the node names and simple append the title of
132+
the node in the given locale as an anchor. So for example
133+
``http://foo.com/de/1#my title`` and ``http://foo.com/de/1#mein title``.
134+
If you need language specific URLs, you want to use the CMF routing bundle
135+
and content bundle directly to have a separate route document per
136+
language.
106137

107138
Rendering
108139
---------

0 commit comments

Comments
 (0)