I am creating a blog site in Bangla language. I am using a localization file called bn_BD.mo
for this pupose. It translates the whole site but the date and time remains english. Actually I am not getting the numbers converted to Bangla Language. I know the mo file will not help in these cases.
So I have extended my function.php
file of the theme folder with following function
function make_bangla_number($str)
{
$engNumber = array(1,2,3,4,5,6,7,8,9,0);
$bangNumber = array('১','২','৩','৪','৫','৬','à§','৮','৯','০');
$converted = str_replace($engNumber, $bangNumber, $str);
return $converted;
}
add_filter( 'get_the_time', 'make_bangla_number' );
add_filter( 'the_date', 'make_bangla_number' );
add_filter( 'get_the_date', 'make_bangla_number' );
add_filter( 'comments_number', 'make_bangla_number' );
add_filter( 'get_comment_date', 'make_bangla_number' );
add_filter( 'get_comment_time', 'make_bangla_number' );
It converts the date of the every post. But my pagination numbers and archive remains same like following
à¦à¦¾à¦¨à§à§à¦¾à¦°à§ 2012
which is translation of January 2012
ফà§à¦¬à§à¦°à§à§à¦¾à¦°à§ 2012
which is translation of February 2012
.
And the pagination looks like
পাতা 1 2 3 4 5 6
which is translation Page 1 2 3 4 5 6
But I want it to be in bangla digits like following.
পাতা ১ ২ ৩ ৪ ৫ ৬
.
What should I do? Thanks in Advance.
Would an preg replace not work for this?
I recommend using the WordPress APIs where possible, so try using the date_i18n function.