Php 发布日期不可翻译
我正在使用qtranslate-x插件翻译我的wordpress网站。我正在用印地语和英语翻译我的网站。但是,我无法翻译我的发帖日期。邮寄日期用英语显示,如“1月10日”,但用印地语显示,如“???10”。如何使用qtranslate-x插件翻译特定语言中的发布日期 我的代码是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
<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()若您的语言是En print默认值,或者当前语言是印地语,那个么您必须从挂载数组中获取值。