[pmwiki-users] need expert review - multilanguage recipe change

SteP step.list+pmwiki at gmail.com
Sat Jul 18 08:53:23 CDT 2009

Hans wrote:

> Thursday, July 16, 2009, 10:04:44 AM, SteP wrote:
>> If you have time, I'd appreciate suggestions on how to evolve the
>> multilanguage recipe with respect to  title caching.
>> Currently this recipe can only cache multilanguage titles if they
>> appear in markup like (:if userlang xy:)(:title The xy title:)...
>> (Search multilanguage.php for the last occurrence of string "mltitle"
>> to see how it does it) I would like to add a more flexible approach,
>> but I'm not sure which one, so I'm open to suggestions. 
>> One idea could be to match a set-PTV pattern, such as (:xyTitle:The
>> xy title:). One advantage of PTV vs. 
>> (:if:) is that it's easier to mix with other conditional markup.
>> Thoughts / ideas? 
> I suggest to use a multi-language title markup:
> (:title-en An English Title:)
> (:title-de Ein deutscher Titel:)
Thank you, Hans, that looks good to me. Would this new markup need to make the current one 
obsolete? I would prefer to support both markup forms, with the older (:if userlang xx:)(:title yyyy:) being 
deprecated but still valid. In which case the last part of multilanguage.php would stay untouched.
> The whole last part of multilanguage.php will not be needed then:
> ...
> But we need to declare all the language strings we want to use
> in array $DefaultLanguages. This array may need to be renamed
> to reflect this change of use of it.

I think that the multilanguage recipe already requires declaring all the language identifiers in array 
$DefaultLanguages. So there would be no need to change this part also.

> Also in function MultiLanguageTitle any occurence of
> 'mltitle-' should be written as 'title-'.

It seems OK.
> One other problem:
> By not using function SaveLanguages we loose the automatic page
> attribute creation of languages= (and languages in page, and select
> language markup).
> We could declare languages in a page with a new (:languages ...:)
> markup, but maybe that is too clumsy.
> Or we use function SaveLanguages, but without the last part for
> picking out strings (:if userlang XX:)(:title yyyyy:)

I think we should just leave all the current code in place, and just add code for the new markup. The 
two methods can cohexist, and the new method will slowly displace the old one, because it offers the 
advantage of not requiring conditional markup.

More information about the pmwiki-users mailing list