how to localize the number of wordpress post views?

I want to display post view in localize number. I add these function in function.php to do so

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( 'the_views', 'make_bangla_number' );

But I am unable to show the number in localize. Whenever i call the_views it shows the english number. Any idea how to show the post view number in localize language?

Read More

For further info here is my post view function:

// function to count post views.
function setPostViews($postID) {
    $count_key = 'views';
    $count = get_post_meta($postID, $count_key, true);
    if($count==''){
        $count = 0;
        delete_post_meta($postID, $count_key);
        add_post_meta($postID, $count_key, '0');
    }else{
        $count++;
        update_post_meta($postID, $count_key, $count);
    }
}
// function to display number of post views.
function the_views($postID){
    $count_key = 'views';
    $count = get_post_meta($postID, $count_key, true);
    if($count==''){
        delete_post_meta($postID, $count_key);
        add_post_meta($postID, $count_key, '0');
        return "0 View";
    }
    return $count.' বার';
}

Related posts

Leave a Reply

1 comment

  1. Parvez,

    There is support available for Bangla Language in WordPress, please refer http://codex.wordpress.org/WordPress_in_Your_Language#Bangla_-Bengali.28bn_BD.29

    You must required to install Bangla Language Pack to your WordPress, which you can found from below links…

    http://svn.automattic.com/wordpress-i18n/bn_BD/trunk/messages/

    http://www.shadhinbangla.com/wordpress-bangla-language-pack-beta-3/2011/10/

    Also, you must check CHARSET must set to UTF-8 in your HTML code and your MySQL DB must be create with Collation CHARSET UTF-8 to store Bangla value in DB.

    Also I found one old WordPress Plugin to show Date & Time in Bangla, you can refer their code also to solve your problem. Here is plugin link…
    http://wordpress.org/extend/plugins/bangla-numbers-in-date-and-time/

    Or you can ask for help to WordPress Support team.

    Hey, I recently found detailed draft to setup Bangla Language in WordPress, please refer this link…
    http://www.lavluda.com/2008/11/08/wordpress-with-full-bangla-language-support/