01272: Locale letters not recognized by page text variables.

Summary: Locale letters not recognized by page text variables.
Created: 2011-11-22 06:01
Status: Closed, added to Cookbook
Category: Feature
From: simkin
Assigned:
Priority: 33
Version: 2.2.35
OS: UNIX/Apache/5.2

Description: When there is a non-ascii character in a PTV, then the word is not recognized as a PTV. For example:

(:Adreça: Carrer Casa Blanca, Alcoi (PV):)
(:Nom: Mariola:)

This is the non-recognized PTV: {$:Adreça}

This is a usual PTV: {$:Nom}

(:Adreça: Carrer Casa Blanca, Alcoi (PV):)

This is the non-recognized PTV: {$:Adreça}

This is a usual PTV: Mariola

I tried to add the u modifier to the $PageTextVarPatterns but it is not working either. I confirm locale is set correctly through setlocale(LC_ALL, 'ca_ES').

This is working fine in the php cli, though:

$str = 'Adreça';
setlocale(LC_ALL, 'ca_ES');
echo preg_match('#^\w+$#u', $str);

I am not sure this is a bug: it is designed this way. A PageTextVariable has a "name" and a "value"; the "name" can only contain plain Latin letters, numbers, the _underscore character and a dash. A "value" can contain any international characters. --Petko November 22, 2011, at 06:45 AM

In my opinion this is quite counter intuitive. According to docs, PTVs are easy to define, a simple definition list or a simple colon delimiter in normal text will do the trick. So it seems that pmwiki encourage novel authors to use them. But one of the most obvious use cases I see is to use them as a card. For instance something as simple as:

Institution: Universitat Jaume I
Address: Av. de Vicent Sos Baynat, s/n 12071 Castelló de la Plana, Espanya
Telephone: +34 964 72 80 00

Is not going to work out for my Catalan localized wiki. I will have to do something like:

Institució: Universitat Jaume I
(:Institucio: Universitat Jaume I:)
Adreça: Av. de Vicent Sos Baynat, s/n 12071 Castelló de la Plana, Espanya
(:Adreca: Av. de Vicent Sos Baynat, s/n 12071 Castelló de la Plana, Espanya:)
Telèfon: +34 964 72 80 00
(:Telefon: +34 964 72 80 00:)

That could lead to confusion in the PTV naming, and possibly to abandon its use. I believe it is a very uncomfortable behavior for localized wikis.

Is it possible to make PTVs sensible to non-ascii letters? Could it be done as a local customization? There is any technical impediment to incorporate this? What would it mean to incorporate it to the core? Does it involve lots of changes? Thanks!

--simkin November 22, 2011, at 08:20 AM

It may be possible, although it will require several changes in different places and files (pmwiki.php, stdmarkup.php, pagelist.php at first sight). I'll think about it. --Petko November 23, 2011, at 04:13 PM

I have started a recipe at Cookbook:InternationalPTVs. It mostly works except with PageList Templates which is a pity, but to fix it we should override the core scripts/pagelist.php file. --Petko October 12, 2012, at 08:00 AM