Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/237.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
Php 发布日期不可翻译_Php_Wordpress_Translation_Qtranslate X - Fatal编程技术网

Php 发布日期不可翻译

Php 发布日期不可翻译,php,wordpress,translation,qtranslate-x,Php,Wordpress,Translation,Qtranslate X,我正在使用qtranslate-x插件翻译我的wordpress网站。我正在用印地语和英语翻译我的网站。但是,我无法翻译我的发帖日期。邮寄日期用英语显示,如“1月10日”,但用印地语显示,如“???10”。如何使用qtranslate-x插件翻译特定语言中的发布日期 我的代码是 <time class="entry-date" style="padding:5px 10px;background-color:maroon;font-weight:bold;color:white;margi

我正在使用qtranslate-x插件翻译我的wordpress网站。我正在用印地语和英语翻译我的网站。但是,我无法翻译我的发帖日期。邮寄日期用英语显示,如“1月10日”,但用印地语显示,如“???10”。如何使用qtranslate-x插件翻译特定语言中的发布日期

我的代码是

<time class="entry-date" style="padding:5px 10px;background-color:maroon;font-weight:bold;color:white;margin-left:-10px;" datetime="<?php the_time('M j'); ?>" content="<?php the_time('M j'); ?>">
    <?php the_time('M'); ?>
</time>
简单解决方案:

将数组定义为:

// Months
$month["January"] = "Hindi translate";
$month["February"] = "Hindi translate";
$month["March"] = "Hindi translate";
$month["April"] = "Hindi translate";
$month["May"] = "Hindi translate"; // and etc.
然后检查您的语言并回显当前的语言装载名称

例如:

<small>
<?php the_time('j') ?> 
<?php
if($current_lang == 'en') {
      echo get_the_time('F');
} else {
      echo $month[get_the_time('F')];

}
?><?php the_time('Y') ?> <!-- by <?php the_author() ?> --></small>


如果我想在_time()中使用qtranslate-x语言标记,如[en:]、[HI:]?我像使用_time(“[HI:]M[en:]M[:]”)一样使用它,但它也会生成随机文本@htmlbrewery@Incarnate使用此函数获取当前语言
$current_lang=qtrans_getLanguage()