• Plans & Pricing
  • Log in
  • Get started
  • WordPress Hosting
  • WordPress for Agencies
  • Become an Affiliate
  • Domain Names
  • AI Website Builder
  • Website Builder
  • Create a Blog
  • Newsletter
  • Professional Email
  • Website Design Services
  • Commerce
  • WordPress Studio
  • Enterprise WordPress 
  • Overview
  • WordPress Themes
  • WordPress Plugins
  • WordPress Patterns
  • Google Apps
  • Support Center
  • WordPress News
  • Business Name Generator
  • Logo Maker
  • Discover New Posts
  • Popular Tags
  • Blog Search
Get started
  • Sign up
  • Log in
About
  • Plans & Pricing
Products
  • WordPress Hosting
  • WordPress for Agencies
  • Become an Affiliate
  • Domain Names
  • AI Website Builder
  • Website Builder
  • Create a Blog
  • Newsletter
  • Professional Email
  • Website Design Services
  • Commerce
  • WordPress Studio
  • Enterprise WordPress  
Features
  • Overview
  • WordPress Themes
  • WordPress Plugins
  • WordPress Patterns
  • Google Apps
Resources
  • Support Center
  • WordPress News
  • Business Name Generator
  • Logo Maker
  • Discover New Posts
  • Popular Tags
  • Blog Search
Jetpack App
  • Learn more
  • Support Center
  • Guides
  • Courses
  • Forums
  • Contact
Search
  • Support Center
  • Guides
  • Courses
  • Forums
  • Contact
Forums / Cannot translate the post meta data (Date) in another language

Cannot translate the post meta data (Date) in another language

  • Unknown's avatar
    shamimasaleem23 · Member · Oct 7, 2018 at 4:11 am
    • Copy link Copy link
    • Add topic to favorites Add topic to favorites

    I want to translate the post meta data (date) in chines language for example, September 13, 2017, should be translated as 2017年9月13. But my code gives it in English. Do you see any error? Please help.

    Thank you in advance.

    printf(__('<span class="posted-on"><a href="%1$s" title="%2$s" rel="bookmark"><i class="fa fa-clock-o"></i> %3$s</a></span>', 'colormag'), 
                    esc_url(get_permalink()), esc_attr(get_the_time()), $time_string
                );
  • Unknown's avatar
    johnnytesting · Member · Oct 8, 2018 at 12:30 am
    • Copy link Copy link

    Hi… can you leave a link to the Blog you’re having problems with? It’ll help us figure out if you’re in the right Forum.

  • Unknown's avatar
    shamimasaleem23 · Member · Oct 8, 2018 at 9:56 am
    • Copy link Copy link

    Hi, I want to localize the post date/time. codex.

    I tried to google out a lot but still unable to solve the issue. This is the code.
    the function __() is not working.

     <?php
                $cur_cat = get_query_var('cat');
                $check_cat_nodate = array(84,85,86,87,89);
                if (in_array($cur_cat, $check_cat_nodate)) {
                }
                else{
    	            $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
    	            if (get_the_time('U') !== get_the_modified_time('U')) {
    	                $time_string .= '<time class="updated" datetime="%3$s">%4$s</time>';
    	            }
    	            $time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date())
    	            );
    	            printf(__('<span class="posted-on"><a href="%1$s" title="%2$s" rel="bookmark"><i class="fa fa-clock-o"></i> %3$s</a></span>', 'colormag'), esc_url(get_permalink()), esc_attr(get_the_time()), $time_string
    	            );
                }
                ?>
  • The topic ‘Cannot translate the post meta data (Date) in another language’ is closed to new replies.

Tags

  • php
  • post meta data
  • WordPress

About this topic

  • In: Themes
  • 2 participants
  • 2 replies
  • Last activity 7 years
  • Latest reply from shamimasaleem23

Couldn't find what you needed?

Contact us

Contact us

Get answers from our AI assistant, with access to 24/7 expert human support on paid plans.

Browse our guides

Browse our guides

Find step-by-step solutions to common questions in our comprehensive guides.

WordPress.com

Products
  • WordPress Hosting
  • WordPress for Agencies
  • Become an Affiliate
  • Domain Names
  • AI Website Builder
  • Website Builder
  • Create a Blog
  • Professional Email
  • Website Design Services
  • WordPress Studio
  • Enterprise WordPress
Features
  • Overview
  • WordPress Themes
  • WordPress Plugins
  • WordPress Patterns
  • Google Apps
Resources
  • WordPress.com Blog
  • Business Name Generator
  • Logo Maker
  • WordPress.com Reader
  • Accessibility
  • Remove Subscriptions
Help
  • Support Center
  • Guides
  • Courses
  • Forums
  • Contact
  • Developer Resources
Company
  • About
  • Press
  • Terms of Service
  • Privacy Policy
  • Do Not Sell or Share My Personal Information
  • Privacy Notice for California Users
DeutschEspañolFrançaisBahasa IndonesiaItalianoNederlandsPortuguês do BrasilSvenskaTürkçeРусскийالعربيةעִבְרִית日本語한국어简体中文繁體中文English

Mobile Apps

  • Download on the App Store
  • Get it on Google Play

Social Media

  • WordPress.com on Facebook
  • WordPress.com on X (Twitter)
  • WordPress.com on Instagram
  • WordPress.com on YouTube

Automattic

Automattic
Work With Us
    • WordPress.com Forums
    • Sign up
    • Log in
    • Copy shortlink
    • Report this content
    • Manage subscriptions