Penanggalan Wordpress Dalam Bahasa Indonesia

July 16, 2007

Wordpress (WP) emang dari sononya cuman mendukung bahasa Inggris. Sampe saat ini belum tersedia versi WP dalam bahasa Indonesia ato dalam bahasa lokal lainnya. Hal ini mempersulit kita yang kepengen punya tema dalam bahasa Indonesia akan tetapi penanggalan dalam WP-nya masih menggunakan bahasa Inggris.

Dengan sedikit editing terhadap file locale.php yang tersimpan di direktori /wp-includes/ (tepatnya /wp-includes/locale.php), kita bisa mendapatkan penanggalan dengan ‘rasa’ Indonesia. Bagi yang males mengubahnya sendiri bisa mengunduhnya dari sini. Perhatikan kode php dari locale.php dalam bahasa Inggris yang udah gue potong berikut ini:


// Date and Time

class WP_Locale {
var $weekday;
var $weekday_initial;
var $weekday_abbrev;

var $month;
var $month_abbrev;

var $meridiem;

var $text_direction = '';
var $locale_vars = array('text_direction');

function init() {
// The Weekdays
$this->weekday[0] = __('Sunday');
$this->weekday[1] = __('Monday');
$this->weekday[2] = __('Tuesday');
$this->weekday[3] = __('Wednesday');
$this->weekday[4] = __('Thursday');
$this->weekday[5] = __('Friday');
$this->weekday[6] = __('Saturday');

// The first letter of each day.  The _%day%_initial suffix is a hack to make
// sure the day initials are unique.
$this->weekday_initial[__('Sunday')]    = __('S_Sunday_initial');
$this->weekday_initial[__('Monday')]    = __('M_Monday_initial');
$this->weekday_initial[__('Tuesday')]   = __('T_Tuesday_initial');
$this->weekday_initial[__('Wednesday')] = __('W_Wednesday_initial');
$this->weekday_initial[__('Thursday')]  = __('T_Thursday_initial');
$this->weekday_initial[__('Friday')]    = __('F_Friday_initial');
$this->weekday_initial[__('Saturday')]  = __('S_Saturday_initial');

foreach ($this->weekday_initial as $weekday_ => $weekday_initial_) {
$this->weekday_initial[$weekday_] = preg_replace('/_.+_initial$/', '', $weekday_initial_);
}

// Abbreviations for each day.
$this->weekday_abbrev[__('Sunday')]    = __('Sun');
$this->weekday_abbrev[__('Monday')]    = __('Mon');
$this->weekday_abbrev[__('Tuesday')]   = __('Tue');
$this->weekday_abbrev[__('Wednesday')] = __('Wed');
$this->weekday_abbrev[__('Thursday')]  = __('Thu');
$this->weekday_abbrev[__('Friday')]    = __('Fri');
$this->weekday_abbrev[__('Saturday')]  = __('Sat');

// The Months
$this->month['01'] = __('January');
$this->month['02'] = __('February');
$this->month['03'] = __('March');
$this->month['04'] = __('April');
$this->month['05'] = __('May');
$this->month['06'] = __('June');
$this->month['07'] = __('July');
$this->month['08'] = __('August');
$this->month['09'] = __('September');
$this->month['10'] = __('October');
$this->month['11'] = __('November');
$this->month['12'] = __('December');

// Abbreviations for each month. Uses the same hack as above to get around the
// 'May' duplication.
$this->month_abbrev[__('January')] = __('Jan_January_abbreviation');
$this->month_abbrev[__('February')] = __('Feb_February_abbreviation');
$this->month_abbrev[__('March')] = __('Mar_March_abbreviation');
$this->month_abbrev[__('April')] = __('Apr_April_abbreviation');
$this->month_abbrev[__('May')] = __('May_May_abbreviation');
$this->month_abbrev[__('June')] = __('Jun_June_abbreviation');
$this->month_abbrev[__('July')] = __('Jul_July_abbreviation');
$this->month_abbrev[__('August')] = __('Aug_August_abbreviation');
$this->month_abbrev[__('September')] = __('Sep_September_abbreviation');
$this->month_abbrev[__('October')] = __('Oct_October_abbreviation');
$this->month_abbrev[__('November')] = __('Nov_November_abbreviation');
$this->month_abbrev[__('December')] = __('Dec_December_abbreviation');

foreach ($this->month_abbrev as $month_ => $month_abbrev_) {
$this->month_abbrev[$month_] = preg_replace('/_.+_abbreviation$/', '', $month_abbrev_);
}

Nah, kita tinggal mengganti penanggalan dalam bahasa Inggris tersebut menjadi penanggalan dalam bahasa Indonesia, seperti berikut ini:


// Date and Time

class WP_Locale {
var $weekday;
var $weekday_initial;
var $weekday_abbrev;

var $month;
var $month_abbrev;

var $meridiem;

var $text_direction = 'ltr';
var $locale_vars = array('text_direction');

function init() {
// The Weekdays
$this->weekday[0] = __('Minggu');
$this->weekday[1] = __('Senin');
$this->weekday[2] = __('Selasa');
$this->weekday[3] = __('Rabu');
$this->weekday[4] = __('Kamis');
$this->weekday[5] = __('Jumat');
$this->weekday[6] = __('Sabtu');

// The first letter of each day.  The _%day%_initial suffix is a hack to make
// sure the day initials are unique.
$this->weekday_initial[__('Minggu')]    = __('M_Minggu_initial');
$this->weekday_initial[__('Senin')]    = __('S_Senin_initial');
$this->weekday_initial[__('Selasa')]   = __('S_Selasa_initial');
$this->weekday_initial[__('Rabu')] = __('R_Rabu_initial');
$this->weekday_initial[__('Kamis')]  = __('K_Kamis_initial');
$this->weekday_initial[__('Jumat')]    = __('J_Jumat_initial');
$this->weekday_initial[__('Sabtu')]  = __('S_Sabtu_initial');

foreach ($this->weekday_initial as $weekday_ => $weekday_initial_) {
$this->weekday_initial[$weekday_] = preg_replace('/_.+_initial$/', '', $weekday_initial_);
}

// Abbreviations for each day.
$this->weekday_abbrev[__('Sunday')]    = __('Min');
$this->weekday_abbrev[__('Monday')]    = __('Sen');
$this->weekday_abbrev[__('Tuesday')]   = __('Sel');
$this->weekday_abbrev[__('Wednesday')] = __('Rab');
$this->weekday_abbrev[__('Thursday')]  = __('Kam');
$this->weekday_abbrev[__('Friday')]    = __('Jum');
$this->weekday_abbrev[__('Saturday')]  = __('Sab');

// The Months
$this->month['01'] = __('Januari');
$this->month['02'] = __('Februari');
$this->month['03'] = __('Maret');
$this->month['04'] = __('April');
$this->month['05'] = __('Mei');
$this->month['06'] = __('Juni');
$this->month['07'] = __('Juli');
$this->month['08'] = __('Agustus');
$this->month['09'] = __('September');
$this->month['10'] = __('Oktober');
$this->month['11'] = __('November');
$this->month['12'] = __('Desember');

// Abbreviations for each month. Uses the same hack as above to get around the
// 'May' duplication.
$this->month_abbrev[__('Januari')] = __('Jan_Januari_abbreviation');
$this->month_abbrev[__('Februari')] = __('Feb_Februari_abbreviation');
$this->month_abbrev[__('Maret')] = __('Mar_Maret_abbreviation');
$this->month_abbrev[__('April')] = __('Apr_April_abbreviation');
$this->month_abbrev[__('Mei')] = __('Mei_Mei_abbreviation');
$this->month_abbrev[__('Juni')] = __('Jun_Juni_abbreviation');
$this->month_abbrev[__('Juli')] = __('Jul_Juli_abbreviation');
$this->month_abbrev[__('Agustus')] = __('Agu_Agustus_abbreviation');
$this->month_abbrev[__('September')] = __('Sep_September_abbreviation');
$this->month_abbrev[__('Oktober')] = __('Okt_Oktober_abbreviation');
$this->month_abbrev[__('November')] = __('Nov_November_abbreviation');
$this->month_abbrev[__('Desember')] = __('Des_Desember_abbreviation');

foreach ($this->month_abbrev as $month_ => $month_abbrev_) {
$this->month_abbrev[$month_] = preg_replace('/_.+_abbreviation$/', '', $month_abbrev_);
}

Selesai.

ilamonaPosted by ilamona
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

1 response so far!

  • aLeNo Gravatar July 28, 2007

    Oke juga neh garapan :ciao:

Leave a Comment

:p 8) :lol: =( :8 ;) :(( :o: :[ :) :D :-| :-[) :bloody: :cool: :choler: :love: :oups: :aie: :beurk: :canny: :go: :miam: :neo: :ueue: :nose: :oh: :oups2: :prud: :yo: :sadd: :bloody2: :cache: :rose: :spd: :dream: :sure: :yes: :sweat: :kiss: :creve: :what: :pff: :hm: :bobo: :aie2: :aie3: :ciao: :dribble: :gene: