https://bugzilla.wikimedia.org/show_bug.cgi?id=34193

--- Comment #9 from Mark A. Hershberger <m...@everybody.org> 2012-02-06 
04:46:11 UTC ---
(In reply to comment #6)
> for this {{#expr: {{CURRENTYEAR}} + 10}}
> we use {{#expr: {{#time:xnY}} + 10}} in bengali Wikipedia

This is helpful, thanks!

> And for this {{#expr: ২ + ৩}} it will not work . even any unicode numeric
> number will not work like that.

Since we only deal with base10 systems (AFAICT), this is just a small matter of
programming.  We have the en->bn mapping for numbers stored in a file:

https://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/languages/messages/MessagesBn.php?revision=110165&view=markup

So changing "২ + ৩" into something that parserfunctions can understand ("2 + 3"
in this case) is fairly simple.  Here is an example of some code I just came up
with:

  $revert = array_flip($digitTransformTable);  # $revert now contains the
                                               # flipped numeral translation
                                               # from MessagesBn.php
  $bn = "২ + ৩";
  $bnTR = strtr($bn, $revert);
  echo "$bnTR\n";
  echo eval("return $bnTR;"), "\n";

This code prints the following:

  2 + 3
  5

In fact, poking around a bit, most of this functionality is built into MW and
just not used in ParserFunctions.

I'll attach a patch to fix this bug for ParserFunctions {{#expr}}, but, after
applying it on my local wiki where $wgLanguageCode = "bn", I can create a page
with the following:

  {{#expr: ২ + ৩}} <br>
  {{#expr: {{CURRENTYEAR}} + 10 + + ৩}}<br>
  {{CURRENTYEAR}}

And it will display:

  ৫
  ২০২৫
  ২০১২

I *think* this would solve a great deal of the problem.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to