วันที่ ไม่เป็นภาษาไทย

2453 2

0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

วันที่ ไม่เป็นภาษาไทย
« เมื่อ: 14/04/17 เวลา 14:27 น. »


ตามรูปครับ แสดงเวลาเป็น อังกฤษ พึ่งสังเกต เลยมาดูใน DEMO แสดงเป็นภาษาไทย

แก้ตรงไหนครับ

Re: วันที่ ไม่เป็นภาษาไทย
« ตอบกลับ #1 เมื่อ: 15/04/17 เวลา 15:19 น. »
สำหรับคนที่เป็นเหมือนผม หรือ ไม่เป็น ก้ทำไวเพื่อคนไม่เข้าใจ  ;D

เข้าไปที่ไฟล์ wp-includes\class-wp-locale.php

หา
โค๊ด: [Select]
// The Months
$this->month['01'] = /* translators: month name */ __( 'January' );
$this->month['02'] = /* translators: month name */ __( 'February' );
$this->month['03'] = /* translators: month name */ __( 'March' );
$this->month['04'] = /* translators: month name */ __( 'April' );
$this->month['05'] = /* translators: month name */ __( 'May' );
$this->month['06'] = /* translators: month name */ __( 'June' );
$this->month['07'] = /* translators: month name */ __( 'July' );
$this->month['08'] = /* translators: month name */ __( 'August' );
$this->month['09'] = /* translators: month name */ __( 'September' );
$this->month['10'] = /* translators: month name */ __( 'October' );
$this->month['11'] = /* translators: month name */ __( 'November' );
$this->month['12'] = /* translators: month name */ __( 'December' );

แก้เป็น
โค๊ด: [Select]
// The Months
$this->month['01'] = /* translators: month name */ __( ' มกราคม' );
$this->month['02'] = /* translators: month name */ __( 'กุมภาพันธ์' );
$this->month['03'] = /* translators: month name */ __( 'มีนาคม' );
$this->month['04'] = /* translators: month name */ __( 'เมษายน' );
$this->month['05'] = /* translators: month name */ __( 'พฤษภาคม' );
$this->month['06'] = /* translators: month name */ __( 'มิถุนายน' );
$this->month['07'] = /* translators: month name */ __( 'กรกฎาคม' );
$this->month['08'] = /* translators: month name */ __( 'สิงหาคม' );
$this->month['09'] = /* translators: month name */ __( 'กันยายน' );
$this->month['10'] = /* translators: month name */ __( 'ตุลาคม' );
$this->month['11'] = /* translators: month name */ __( 'พฤศจิกายน' );
$this->month['12'] = /* translators: month name */ __( 'ธันวาคม' );

Re: วันที่ ไม่เป็นภาษาไทย
« ตอบกลับ #2 เมื่อ: 15/04/17 เวลา 18:00 น. »
วิธีช้างต้นก็ใช้ได้ครับ แต่มันจะเป็นการ hard code เกินไป คือ อาจจะเปลี่ยนไปมาระหว่างไทย-อังกฤษได้ลำบาก

วิธีก็คือให้ลูกค้าลงภาษาไทยเพิ่มลงใน wordpress ซึ่งผมคิดว่า ตอนนี้ลูกค้าน่าจะใช้เป็น version อังกฤษอยู่ครับ