Poster 2 and RWML for multilingual websites

I presume that all those who provide websites in multiple languages rely on @willwood’s excellent suite of RWML stacks like I do. I also use Poster to provide content pages in an elegant way - and Poster 1 is actually fully compatible with the RWML wrapper stack. RWML as a PHP script on the server only sends the proper content to the browser based on the language selection.

Just a few days ago @Jannis came with the even more powerful ‘Poster 2’ version to the market, where her created a novel PHP rendering engine allowing the user to freely design the appearance of the poster items. As one can imagine, when two PHP cooks mess with the HTML dish at ‘the same time’ - this can cause problems, and -unfortunately- it does !

The RWML wrapper stack is not compatible with Poster 2, and when used in either the template definitions, or in the poster items, a PHP error occurs that stops the rendering of the page incomplete. Be careful - if you try it in RW and look at the results in the Preview or on the local browser, everything works just fine … but it does not work after uploading to the server ! It seems that the RW preview is much more forgiving than the PHP engines on the servers. Jannis helped me to confirm that there is no easy way around this PHP conflict.

Nonetheless, I found a solution that allows RWML to work again with Poster 2 - however, not as a PHP script inside Poster 2. Instead, all the multiple language texts are sent to the browser and only those with the proper language selector are displayed. This can be accomplished by using @willwood’s ‘UsefulStack’ as a wrapper, which allows to assign a language label !

When using the ‘UsefulStack’ in e.g. Poster 2 link stacks, make sure that the link stack encloses the multiple 'UsefulStack’s - it doesn’t work the other way around. See below example:
Bildschirmfoto 2020-05-26 um 23.43.24

When you want to have e.g. multiple text blocks in different languages in the poster item, again use the ‘UsefulStack’ as wrapper for each language and set the attribute accordingly:

In addition, you need to use the ‘lang’ descriptor as language selector and also enable the filtering for it in the RWML base stack:
Bildschirmfoto 2020-05-26 um 23.44.57

As a reward for the effort, you can create again your multilingual content in new ways in Poster 2

A demo page in English:

and again in ‘German’ - both content & buttons

3 Likes

Thanks @GKs Gerd for the detailed explanation.

As discussed, a native functionality being able to create multi-lingual posts is on the todo list.

Cheers
Jannis

2 Likes