Search code examples
internationalizationploneplone-4.xarchetypes

Language sensitive title method (Plone, Archetypes, LinguaPlone)


I have a Plone site with internationalized content, using Archetypes and LinguaPlone.

Some of my objects (including folders) are language neutral, others are not. For generation of menus and navigation breadcrumbs, I'd like a method which

  • returns the untranslated Title(), if the Language() is non-empty (because under this condition the title attribute is supposed to match the language), and
  • returns a translation of the Title() otherwise (because the object is used for multiple languages, and I have a small set of affected strings).

I couldn't find any *title* method in the Products.LinguaPlone package; pretty_title_or_id is apparently language-agnostic.

Is there really no such method yet?

(Products.LinguaPlone 4.1.8, Products.CMFPlone 4.3.3, Products.ATContentTypes 2.1.14)

Edit: The affected objects are a limited number of folders (near the site root) whose titles very rarely change; most others have a non-empty Language (which will cause their Title not to be translated) or are non-folders (and won't have a known translation, I admit, but in those cases the original title would be used). I could imagine to patch pretty_title_or_id accordingly, and I wonder about reasons not to do so.


Solution

  • I'll answer myself: It seems there is no such method because the standard set of metadata fields is not sufficient to support it.

    For a small fixed set of languages, it might be a good solution to use title_<lang> metadata fields.