Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Localization 如何本地化wordpress帖子视图的数量?_Localization_Wordpress_Indic - Fatal编程技术网

Localization 如何本地化wordpress帖子视图的数量?

Localization 如何本地化wordpress帖子视图的数量?,localization,wordpress,indic,Localization,Wordpress,Indic,我想在本地化编号中显示post视图。为此,我在function.php中添加了这些函数 function make_bangla_number($str) { $engNumber = array(1,2,3,4,5,6,7,8,9,0); $bangNumber = array('১','২','৩','৪','৫','৬','৭','৮','৯','০'); $converted = str_replace($engNumber

我想在本地化编号中显示post视图。为此,我在function.php中添加了这些函数

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' );
但我无法在本地化中显示数字。无论何时我打电话给_,它都会显示英文号码。你知道如何用本地化语言显示post视图编号吗

有关更多信息,请参见我的后期查看功能:

// 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.' বার';
}
帕维斯

WordPress支持孟加拉语,请参考

您必须安装孟加拉语语言包到您的WordPress,您可以从下面的链接找到

此外,必须在HTML代码中检查字符集必须设置为UTF-8,并且必须使用排序规则字符集UTF-8创建MySQL数据库,以便在数据库中存储孟加拉文值

我还发现了一个用孟加拉语显示日期和时间的旧WordPress插件,你也可以参考他们的代码来解决你的问题。这里是插件链接。。。

或者你可以向WordPress支持团队寻求帮助

嘿,我最近在WordPress中找到了设置孟加拉语的详细草稿,请参考此链接。。。

我安装了孟加拉语包,我的站点字符集也是UTF-8。孟加拉语语言包完成所有功能,但无法将英语数字转换为孟加拉语数字。所以我使用了这个代码。有了它,我可以用孟加拉语转换日期,但无法转换视图。所以我在这里。@pervez让你们检查这个插件的代码,因为我看到他们对显示数字做了一些调整,请参考这个插件上的安装标签,他们提到加载孟加拉数字。。。“将Date and Time.zip中的孟加拉语数字上传到/wp content/plugins/目录并解压缩文件。”是。但该插件仅转换日期孟加拉语数字。但我想把视图计数转换成孟加拉语。所以我添加了过滤器add_filter('the_views','make_bangla_number');在function.php中,但它不起作用。@pervez已使用下面提到的语言参数更新了wp-config.php。替换define('WPLANG',');使用define('WPLANG','bn_BD')@佩尔韦兹:你能分享你的网站链接吗