views:

345

answers:

2

Any ideas how to configure Wordpress to get the date and page numbers in Eastern Arabic Numerals?

These are 0660 up till 0669 in UTF-8. I am talking about getting those numbers ٠١٢٣٤٥٦٧٨٩ replace those 0123456789. I am using Wordpress 2.7.

A: 

،السلام عليكم

This isn't possible using any of the default wordpress tools. The "Styling Page Links" documentation only provides limited customization of the page numbers.

So you have a couple options.

  1. Edit *wp_link_pages()* in wp-includes/post-template.php
    But this is pretty hackish, and will cause problems when it comes time to upgrade.
  2. Write a small plugin that bypasses *wp_link_pages()* entirely, possibly by editing an existing (WP Page Numbers) plugin.
    This has the benefit of being maintainable and portable (you could distribute the plugin).

In both cases you will have to do some mapping: { {0،٠}, {1,١}, {2, ٢} ....}, and do a string replacement after the page number calculation.

Also, I looked into the Arabic WP translation but it uses traditional numerals, which seems silly.

حظ سعيد يابشا

Casey
Thanks. I guess the best way will be using str_replace.There was something similar that uses Javascript. It changed the ol li numbers to Eastern Arabic or Farsi numerals - those are not normally supported. I wouldn't know how to do it because I don't know much Javascript.Here's the link http://dot1ne.com/journal/farsi-arabic-ol-tag
Abdurrahman Gemei
A: 

I'd suggest that you don't do the replacement...

Keeping the normal numbers 0x40 to 0x49 allows search engines to search in the numbers. An Arab who prefers the other number system would have set that in their operating system, and they would see 0123456789 as ٠١٢٣٤٥٦٧٨٩.

Osama ALASSIRY
Well that's not true. The numbers appear on the page the way they are in the code. '1' is different from '١' in terms of UTF-8.You are right about the fact that search engines won't be seeing '١' anymore. If there is a way to keep it as '1' in the page's source code but convert it into '١', the same way font-replacement is made using <canvas>, search engines would still index the page.
Abdurrahman Gemei
It's 100% true, depending on how you setup windows to show numbers in regional settings... the user can select the "standard digits", and "digit substitution" (I'd suggest using *Context*).You don't need to play with the unicode characters, what's next? specifying exact unicode character shapes for every letter???
Osama ALASSIRY