Archive | March, 2007

Tidy language folders with LinguaPlone

bird

Photo: Projjwal Pohland .

In Linguaplone, the one thing that you can’t translate is the portal itself. Hence if you have any documents or folders at site root, then they will be translated into documents or folders also at site root. It is easy to see how (especially with more than two languages) things can get very messy indeed.

However there is a way around this if you have your site address directed to a folder at the root of the portal, public_home, say (in my opinion this should be Plone default behaviour to stop user content from being scattered around portal tools in the zmi). You can then translate the folder and the translated folder will show up on the same level as public_home. (You can even translate some content inside the folder before you translate the folder and LinguaPlone will put the content inside the folder for you)

However, perhaps you want all content – including translations – to be inside the public_home folder for ease of maintenance. Well, after you translate the folder, you can go into the zmi, cut the folder and paste it within public_home. This doesn’t seem to have any effect on the links between original and translated folders, or on any content translated after you move the folder, and you now have all the content for each language inside their respective folders inside public_home.

Comments { 0 }

Displaying body text of a news item in sdotnews

http://www.srichinmoycentre.org/gallery/d/205411-2/P1030839.JPG

Who says a technical site can’t have pictures? (Photo:Kedar Misani )

Sdotnews by default displays the description of a news item. However, sometimes you will want to link to another page direct from the front sdotnews page, so it might be better to display the body text instead of the description, and in the body text of the news item you can then insert your links.

In order to implement this change we have to change the sdotnews_view template; specifically, replacing the bit that says

<p tal:content="result/Description">

At first I tried to call the text of the page body using

<p tal:content="result/getText">

or

<p tal: content="python: result.CookedBody()">

But this doesn’t work, because once sdot has batched the news articles in groups so they can be displayed on different pages, the page results can access the metadata listed in the catalog, (so result/Description or result/Title is ok, but result/getText isn’t).

Now, to get around this, you can include the page body in the catalog metadata (which would defeat the whole purpose of having a catalog in the first place), or else you can use the getObject method to access the obkjct and all of its attributes, rather than just the ones specified in the catalog.

tal:define="resultObject result/getObject;
            resultText python:resultObject.CookedBody(stx_level=2);

 <p tal:replace="structure resultText">

Note that sdot news already has defined resultObject, which it needed to access the news item image. Also note the structure command, this converts the HTML or ReStructured text. If you just put in

<p tal:content="resultText">

you will just get all the HTML tags.

Comments { 0 }